-rw-r--r-- | library/backend/rohfeedback.cpp | 28 | ||||
-rw-r--r-- | library/backend/rohfeedback.h | 3 | ||||
-rw-r--r-- | library/config.in | 4 | ||||
-rw-r--r-- | library/library.pro | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 58 | ||||
-rw-r--r-- | library/qpeapplication.h | 2 |
6 files changed, 57 insertions, 44 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,4 +1,4 @@ | |||
1 | #include <rohfeedback.h> | 1 | #ifdef OPIE_WITHROHFEEDBACK |
2 | |||
3 | 2 | ||
3 | #include <rohfeedback.h> | ||
4 | #include <stdio.h> | 4 | #include <stdio.h> |
@@ -37,8 +37,7 @@ RoHFeedback::RoHFeedback() : | |||
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 | } |
@@ -68,6 +67,6 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) { | |||
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 | } |
@@ -75,5 +74,3 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) { | |||
75 | void RoHFeedback::stop( void ) { | 74 | void RoHFeedback::stop( void ) { |
76 | IconNr = -2; // stop | 75 | IconNr = FeedbackStopped; // stop |
77 | hide(); | ||
78 | Timer.stop(); | ||
79 | } | 76 | } |
@@ -102,3 +99,3 @@ void RoHFeedback::iconShow( void ) { | |||
102 | case FeedbackTimerStart: | 99 | case FeedbackTimerStart: |
103 | IconNr = 0; | 100 | IconNr = FeedbackShow; |
104 | Timer.start( SPEED/NOOFICONS ); | 101 | Timer.start( SPEED/NOOFICONS ); |
@@ -109,2 +106,3 @@ void RoHFeedback::iconShow( void ) { | |||
109 | hide(); | 106 | hide(); |
107 | Timer.stop(); | ||
110 | break; | 108 | break; |
@@ -124,2 +122,4 @@ void RoHFeedback::iconShow( void ) { | |||
124 | } | 122 | } |
125 | } \ No newline at end of file | 123 | } |
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 | |||
@@ -3,2 +3,4 @@ | |||
3 | 3 | ||
4 | #ifdef OPIE_WITHROHFEEDBACK | ||
5 | |||
4 | /* | 6 | /* |
@@ -62 +64,2 @@ protected : | |||
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 | |||
@@ -2 +2,5 @@ config LIBQPE | |||
2 | boolean "Qpe Library (Qt/Embedded version)" | 2 | boolean "Qpe Library (Qt/Embedded version)" |
3 | |||
4 | config 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 | |||
@@ -49,2 +49,3 @@ HEADERS = calendar.h \ | |||
49 | backend/contact.h\ | 49 | backend/contact.h\ |
50 | backend/rohfeedback.h \ | ||
50 | categorymenu.h \ | 51 | categorymenu.h \ |
@@ -108,2 +109,3 @@ SOURCES = calendar.cpp \ | |||
108 | backend/contact.cpp \ | 109 | backend/contact.cpp \ |
110 | backend/rohfeedback.cpp \ | ||
109 | categorymenu.cpp \ | 111 | categorymenu.cpp \ |
@@ -137 +139,5 @@ contains( CONFIG, no-override ){ | |||
137 | } | 139 | } |
140 | |||
141 | contains( 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 | |||
@@ -99,3 +99,3 @@ | |||
99 | 99 | ||
100 | #include <qpe/rohfeedback.h> | 100 | #include <backend/rohfeedback.h> |
101 | 101 | ||
@@ -104,3 +104,2 @@ static bool useBigPixmaps = 0; | |||
104 | 104 | ||
105 | |||
106 | class HackWidget : public QWidget | 105 | class HackWidget : public QWidget |
@@ -118,4 +117,4 @@ class QPEApplicationData | |||
118 | public: | 117 | public: |
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 ), |
@@ -132,3 +131,3 @@ public: | |||
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; |
@@ -140,3 +139,3 @@ public: | |||
140 | QPoint presspos; | 139 | QPoint presspos; |
141 | #ifdef OPIE_ROHFEEDBACK | 140 | #ifdef OPIE_WITHROHFEEDBACK |
142 | Opie::Internal::RoHFeedback *RoH; | 141 | Opie::Internal::RoHFeedback *RoH; |
@@ -504,2 +503,3 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) | |||
504 | } | 503 | } |
504 | |||
505 | }; | 505 | }; |
@@ -1217,4 +1217,6 @@ QPEApplication::~QPEApplication() | |||
1217 | #endif | 1217 | #endif |
1218 | #ifdef OPIE_ROHFEEDBACK | 1218 | |
1219 | delete d->RoH; | 1219 | #ifdef OPIE_WITHROHFEEDBACK |
1220 | if( d->RoH ) | ||
1221 | delete d->RoH; | ||
1220 | #endif | 1222 | #endif |
@@ -2037,2 +2039,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
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; |
@@ -2040,5 +2043,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
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 ) |
@@ -2047,6 +2048,7 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
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 | ||
@@ -2057,5 +2059,4 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
2057 | killTimer(d->presstimer); | 2059 | killTimer(d->presstimer); |
2058 | #ifdef OPIE_ROHFEEDBACK | 2060 | #ifdef OPIE_WITHROHFEEDBACK |
2059 | if( d->RoH ) | 2061 | d->RoH->stop(); |
2060 | d->RoH->stop( ); | ||
2061 | #endif | 2062 | #endif |
@@ -2068,5 +2069,4 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
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 |
@@ -2075,2 +2075,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
2075 | if ( d->rightpressed && d->presswidget ) { | 2075 | if ( d->rightpressed && d->presswidget ) { |
2076 | printf( "Send ButtonRelease\n" ); | ||
2076 | // Right released | 2077 | // Right released |
@@ -2118,11 +2119,12 @@ void QPEApplication::timerEvent( QTimerEvent *e ) | |||
2118 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 2119 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
2119 | // Right pressed | 2120 | |
2120 | postEvent( d->presswidget, | 2121 | // Right pressed |
2121 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 2122 | postEvent( d->presswidget, |
2122 | RightButton, LeftButton ) ); | 2123 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
2123 | killTimer( d->presstimer ); | 2124 | RightButton, LeftButton ) ); |
2124 | d->presstimer = 0; | 2125 | killTimer( d->presstimer ); |
2125 | d->rightpressed = TRUE; | 2126 | d->presstimer = 0; |
2126 | #ifdef OPIE_ROHFEEDBACK | 2127 | d->rightpressed = TRUE; |
2127 | d->RoH->stop(); | 2128 | #ifdef OPIE_WITHROHFEEDBACK |
2129 | d->RoH->stop(); | ||
2128 | #endif | 2130 | #endif |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index d2782e4..b07802f 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -186,4 +186,2 @@ private: | |||
186 | 186 | ||
187 | |||
188 | |||
189 | }; | 187 | }; |