summaryrefslogtreecommitdiff
path: root/library
authorwimpie <wimpie>2004-08-25 01:47:35 (UTC)
committer wimpie <wimpie>2004-08-25 01:47:35 (UTC)
commitf6a6fe57c9e0047379f4b8b40da4776f1c4d7b25 (patch) (unidiff)
tree2db64e885b1a67058fa45533819993c8dcb4fb96 /library
parent49c47e98bed6e35d0bdc8e1e4cc40bdbb07eab06 (diff)
downloadopie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.zip
opie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.tar.gz
opie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.tar.bz2
Final changes for RoH Feedback
- changed *.pro file to compile in backend - some more fixes to rohfeedback and qpeapplication
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/rohfeedback.cpp26
-rw-r--r--library/backend/rohfeedback.h3
-rw-r--r--library/config.in4
-rw-r--r--library/library.pro6
-rw-r--r--library/qpeapplication.cpp36
-rw-r--r--library/qpeapplication.h2
6 files changed, 45 insertions, 32 deletions
diff --git a/library/backend/rohfeedback.cpp b/library/backend/rohfeedback.cpp
index ff76a36..21aad34 100644
--- a/library/backend/rohfeedback.cpp
+++ b/library/backend/rohfeedback.cpp
@@ -1,6 +1,6 @@
1#include <rohfeedback.h> 1#ifdef OPIE_WITHROHFEEDBACK
2
3 2
3#include <rohfeedback.h>
4#include <stdio.h> 4#include <stdio.h>
5#include <qpeapplication.h> 5#include <qpeapplication.h>
6#include <qevent.h> 6#include <qevent.h>
@@ -35,12 +35,11 @@ RoHFeedback::RoHFeedback() :
35 35
36 36
37 for( int i = 0; i < NOOFICONS ; i ++ ) { 37 for( int i = 0; i < NOOFICONS ; i ++ ) {
38 Imgs[i] = new QPixmap( Resource::loadPixmap("RoH/star/"+ 38 Imgs[i] = new QPixmap( Resource::loadPixmap(
39 QString::number(i+1) + 39 "RoH/star/"+ QString::number(i+1) + ".png" ));
40 ".png" ));
41 Masks[i] = new QBitmap(); 40 Masks[i] = new QBitmap();
42 (*Masks[i]) = Resource::loadPixmap("RoH/star/"+QString::number(i+1) + 41 (*Masks[i]) = Resource::loadPixmap(
43 ".png" ); 42 "RoH/star/"+QString::number(i+1) + "-mask.png" );
44 } 43 }
45 } 44 }
46 45
@@ -66,16 +65,14 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) {
66 return; 65 return;
67 66
68 Receiver = wid; 67 Receiver = wid;
69 IconNr = -1; 68 IconNr = FeedbackTimerStart;
70 move( P.x()-IconWidth/2, P.y() - IconHeight/2 ); 69 move( P.x()-IconWidth/2, P.y() - IconHeight/2 );
71 // to initialize 70 // to initialize
72 Timer.start( DELAY - SPEED/NOOFICONS ); 71 Timer.start( DELAY );
73} 72}
74 73
75void RoHFeedback::stop( void ) { 74void RoHFeedback::stop( void ) {
76 IconNr = -2; // stop 75 IconNr = FeedbackStopped; // stop
77 hide();
78 Timer.stop();
79} 76}
80 77
81bool RoHFeedback::event( QEvent * E ) { 78bool RoHFeedback::event( QEvent * E ) {
@@ -100,13 +97,14 @@ bool RoHFeedback::event( QEvent * E ) {
100void RoHFeedback::iconShow( void ) { 97void RoHFeedback::iconShow( void ) {
101 switch( IconNr ) { 98 switch( IconNr ) {
102 case FeedbackTimerStart: 99 case FeedbackTimerStart:
103 IconNr = 0; 100 IconNr = FeedbackShow;
104 Timer.start( SPEED/NOOFICONS ); 101 Timer.start( SPEED/NOOFICONS );
105 break; 102 break;
106 case FeedbackStopped: 103 case FeedbackStopped:
107 // stopped 104 // stopped
108 IconNr = FeedbackTimerStart; 105 IconNr = FeedbackTimerStart;
109 hide(); 106 hide();
107 Timer.stop();
110 break; 108 break;
111 case FeedbackShow: // first 109 case FeedbackShow: // first
112 show(); 110 show();
@@ -123,3 +121,5 @@ void RoHFeedback::iconShow( void ) {
123 121
124} 122}
125} \ No newline at end of file 123} \ No newline at end of file
124
125#endif
diff --git a/library/backend/rohfeedback.h b/library/backend/rohfeedback.h
index f38a095..9ffd35a 100644
--- a/library/backend/rohfeedback.h
+++ b/library/backend/rohfeedback.h
@@ -1,6 +1,8 @@
1#ifndef ROHFEEDBACK_H 1#ifndef ROHFEEDBACK_H
2#define ROHFEEDBACK_H 2#define ROHFEEDBACK_H
3 3
4#ifdef OPIE_WITHROHFEEDBACK
5
4/* 6/*
5 7
6 RightOnHold feedback show 8 RightOnHold feedback show
@@ -60,3 +62,4 @@ protected :
60} 62}
61 63
62#endif 64#endif
65#endif
diff --git a/library/config.in b/library/config.in
index ea69ccb..5273976 100644
--- a/library/config.in
+++ b/library/config.in
@@ -1,2 +1,6 @@
1config LIBQPE 1config LIBQPE
2 boolean "Qpe Library (Qt/Embedded version)" 2 boolean "Qpe Library (Qt/Embedded version)"
3
4config LIBQPE_WITHROHFEEDBACK
5 boolean "Give visual feedback for RightOnHold"
6 depends LIBQPE
diff --git a/library/library.pro b/library/library.pro
index eb4bde3..af07fa3 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -47,6 +47,7 @@ HEADERS = calendar.h \
47 backend/task.h \ 47 backend/task.h \
48 backend/event.h \ 48 backend/event.h \
49 backend/contact.h\ 49 backend/contact.h\
50 backend/rohfeedback.h \
50 categorymenu.h \ 51 categorymenu.h \
51 categoryedit_p.h \ 52 categoryedit_p.h \
52 categoryselect.h \ 53 categoryselect.h \
@@ -106,6 +107,7 @@ SOURCES = calendar.cpp \
106 backend/task.cpp \ 107 backend/task.cpp \
107 backend/event.cpp \ 108 backend/event.cpp \
108 backend/contact.cpp \ 109 backend/contact.cpp \
110 backend/rohfeedback.cpp \
109 categorymenu.cpp \ 111 categorymenu.cpp \
110 categoryedit_p.cpp \ 112 categoryedit_p.cpp \
111 categoryselect.cpp \ 113 categoryselect.cpp \
@@ -135,3 +137,7 @@ include ( $(OPIEDIR)/include.pro )
135contains( CONFIG, no-override ){ 137contains( CONFIG, no-override ){
136 DEFINES += OPIE_NO_OVERRIDE_QT 138 DEFINES += OPIE_NO_OVERRIDE_QT
137} 139}
140
141contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
142 DEFINES += WITHROHFEEDBACK
143}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 35f433c..c6d9cfd 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -97,12 +97,11 @@
97#endif 97#endif
98#include "qt_override_p.h" 98#include "qt_override_p.h"
99 99
100#include <qpe/rohfeedback.h> 100#include <backend/rohfeedback.h>
101 101
102 102
103static bool useBigPixmaps = 0; 103static bool useBigPixmaps = 0;
104 104
105
106class HackWidget : public QWidget 105class HackWidget : public QWidget
107{ 106{
108public: 107public:
@@ -116,8 +115,8 @@ public:
116class QPEApplicationData 115class QPEApplicationData
117{ 116{
118public: 117public:
119 QPEApplicationData ( ) 118 QPEApplicationData ( ) :
120 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 119 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 120 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
122 keep_running( true ), qcopQok( false ), 121 keep_running( true ), qcopQok( false ),
123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), 122 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
@@ -130,7 +129,7 @@ public:
130 fontSize = cfg.readNumEntry( "FontSize", 10 ); 129 fontSize = cfg.readNumEntry( "FontSize", 10 );
131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 130 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 131 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
133#ifdef OPIE_ROHFEEDBACK 132#ifdef OPIE_WITHROHFEEDBACK
134 RoH = 0; 133 RoH = 0;
135#endif 134#endif
136 } 135 }
@@ -138,7 +137,7 @@ public:
138 int presstimer; 137 int presstimer;
139 QWidget* presswidget; 138 QWidget* presswidget;
140 QPoint presspos; 139 QPoint presspos;
141#ifdef OPIE_ROHFEEDBACK 140#ifdef OPIE_WITHROHFEEDBACK
142 Opie::Internal::RoHFeedback *RoH; 141 Opie::Internal::RoHFeedback *RoH;
143#endif 142#endif
144 143
@@ -502,6 +501,7 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
502 } 501 }
503 } 502 }
504 } 503 }
504
505}; 505};
506 506
507class ResourceMimeFactory : public QMimeSourceFactory 507class ResourceMimeFactory : public QMimeSourceFactory
@@ -1215,7 +1215,9 @@ QPEApplication::~QPEApplication()
1215 delete sysChannel; 1215 delete sysChannel;
1216 delete pidChannel; 1216 delete pidChannel;
1217#endif 1217#endif
1218#ifdef OPIE_ROHFEEDBACK 1218
1219#ifdef OPIE_WITHROHFEEDBACK
1220 if( d->RoH )
1219 delete d->RoH; 1221 delete d->RoH;
1220#endif 1222#endif
1221 delete d; 1223 delete d;
@@ -2035,28 +2037,27 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2035 switch ( me->type() ) { 2037 switch ( me->type() ) {
2036 case QEvent::MouseButtonPress: 2038 case QEvent::MouseButtonPress:
2037 if ( me->button() == LeftButton ) { 2039 if ( me->button() == LeftButton ) {
2040 static long Pref = 500; // #### pref.
2038 d->presswidget = (QWidget*)o; 2041 d->presswidget = (QWidget*)o;
2039 d->presspos = me->pos(); 2042 d->presspos = me->pos();
2040 d->rightpressed = FALSE; 2043 d->rightpressed = FALSE;
2041 // just for the time being 2044#ifdef OPIE_WITHROHFEEDBACK
2042 static int pref = 500;
2043#ifdef OPIE_ROHFEEDBACK
2044 if( ! d->RoH ) 2045 if( ! d->RoH )
2045 d->RoH = new Opie::Internal::RoHFeedback; 2046 d->RoH = new Opie::Internal::RoHFeedback;
2046 2047
2047 d->RoH->init( me->globalPos(), d->presswidget ); 2048 d->RoH->init( me->globalPos(), d->presswidget );
2048 pref = d->RoH->delay(); 2049 Pref = d->RoH->delay();
2050
2049#endif 2051#endif
2050 if (!d->presstimer ) 2052 if (!d->presstimer )
2051 d->presstimer = startTimer( pref ); // #### pref. 2053 d->presstimer = startTimer( Pref ); // #### pref.
2052 2054
2053 } 2055 }
2054 break; 2056 break;
2055 case QEvent::MouseMove: 2057 case QEvent::MouseMove:
2056 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 2058 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
2057 killTimer(d->presstimer); 2059 killTimer(d->presstimer);
2058#ifdef OPIE_ROHFEEDBACK 2060#ifdef OPIE_WITHROHFEEDBACK
2059 if( d->RoH )
2060 d->RoH->stop( ); 2061 d->RoH->stop( );
2061#endif 2062#endif
2062 d->presstimer = 0; 2063 d->presstimer = 0;
@@ -2066,13 +2067,13 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2066 if ( me->button() == LeftButton ) { 2067 if ( me->button() == LeftButton ) {
2067 if ( d->presstimer ) { 2068 if ( d->presstimer ) {
2068 killTimer(d->presstimer); 2069 killTimer(d->presstimer);
2069#ifdef OPIE_ROHFEEDBACK 2070#ifdef OPIE_WITHROHFEEDBACK
2070 if( d->RoH )
2071 d->RoH->stop( ); 2071 d->RoH->stop( );
2072#endif 2072#endif
2073 d->presstimer = 0; 2073 d->presstimer = 0;
2074 } 2074 }
2075 if ( d->rightpressed && d->presswidget ) { 2075 if ( d->rightpressed && d->presswidget ) {
2076 printf( "Send ButtonRelease\n" );
2076 // Right released 2077 // Right released
2077 postEvent( d->presswidget, 2078 postEvent( d->presswidget,
2078 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 2079 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
@@ -2116,6 +2117,7 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2116void QPEApplication::timerEvent( QTimerEvent *e ) 2117void QPEApplication::timerEvent( QTimerEvent *e )
2117{ 2118{
2118 if ( e->timerId() == d->presstimer && d->presswidget ) { 2119 if ( e->timerId() == d->presstimer && d->presswidget ) {
2120
2119 // Right pressed 2121 // Right pressed
2120 postEvent( d->presswidget, 2122 postEvent( d->presswidget,
2121 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 2123 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
@@ -2123,7 +2125,7 @@ void QPEApplication::timerEvent( QTimerEvent *e )
2123 killTimer( d->presstimer ); 2125 killTimer( d->presstimer );
2124 d->presstimer = 0; 2126 d->presstimer = 0;
2125 d->rightpressed = TRUE; 2127 d->rightpressed = TRUE;
2126#ifdef OPIE_ROHFEEDBACK 2128#ifdef OPIE_WITHROHFEEDBACK
2127 d->RoH->stop(); 2129 d->RoH->stop();
2128#endif 2130#endif
2129 } 2131 }
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index d2782e4..b07802f 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -184,8 +184,6 @@ private:
184 184
185 bool reserved_sh; 185 bool reserved_sh;
186 186
187
188
189}; 187};
190 188
191inline void QPEApplication::showDialog( QDialog* d, bool nomax ) 189inline void QPEApplication::showDialog( QDialog* d, bool nomax )