-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 @@ -#include <rohfeedback.h> - +#ifdef OPIE_WITHROHFEEDBACK +#include <rohfeedback.h> #include <stdio.h> @@ -37,8 +37,7 @@ RoHFeedback::RoHFeedback() : for( int i = 0; i < NOOFICONS ; i ++ ) { - Imgs[i] = new QPixmap( Resource::loadPixmap("RoH/star/"+ - QString::number(i+1) + - ".png" )); + Imgs[i] = new QPixmap( Resource::loadPixmap( + "RoH/star/"+ QString::number(i+1) + ".png" )); Masks[i] = new QBitmap(); - (*Masks[i]) = Resource::loadPixmap("RoH/star/"+QString::number(i+1) + - ".png" ); + (*Masks[i]) = Resource::loadPixmap( + "RoH/star/"+QString::number(i+1) + "-mask.png" ); } @@ -68,6 +67,6 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) { Receiver = wid; - IconNr = -1; + IconNr = FeedbackTimerStart; move( P.x()-IconWidth/2, P.y() - IconHeight/2 ); // to initialize - Timer.start( DELAY - SPEED/NOOFICONS ); + Timer.start( DELAY ); } @@ -75,5 +74,3 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) { void RoHFeedback::stop( void ) { - IconNr = -2; // stop - hide(); - Timer.stop(); + IconNr = FeedbackStopped; // stop } @@ -102,3 +99,3 @@ void RoHFeedback::iconShow( void ) { case FeedbackTimerStart: - IconNr = 0; + IconNr = FeedbackShow; Timer.start( SPEED/NOOFICONS ); @@ -109,2 +106,3 @@ void RoHFeedback::iconShow( void ) { hide(); + Timer.stop(); break; @@ -124,2 +122,4 @@ void RoHFeedback::iconShow( void ) { } -}
\ No newline at end of file +} + +#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 @@ +#ifdef OPIE_WITHROHFEEDBACK + /* @@ -62 +64,2 @@ protected : #endif +#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 boolean "Qpe Library (Qt/Embedded version)" + +config LIBQPE_WITHROHFEEDBACK + boolean "Give visual feedback for RightOnHold" + 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 \ backend/contact.h\ + backend/rohfeedback.h \ categorymenu.h \ @@ -108,2 +109,3 @@ SOURCES = calendar.cpp \ backend/contact.cpp \ + backend/rohfeedback.cpp \ categorymenu.cpp \ @@ -137 +139,5 @@ contains( CONFIG, no-override ){ } + +contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ + DEFINES += WITHROHFEEDBACK +} 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 @@ -#include <qpe/rohfeedback.h> +#include <backend/rohfeedback.h> @@ -104,3 +104,2 @@ static bool useBigPixmaps = 0; - class HackWidget : public QWidget @@ -118,4 +117,4 @@ class QPEApplicationData public: - QPEApplicationData ( ) - : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), + QPEApplicationData ( ) : + presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), @@ -132,3 +131,3 @@ public: bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK RoH = 0; @@ -140,3 +139,3 @@ public: QPoint presspos; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK Opie::Internal::RoHFeedback *RoH; @@ -504,2 +503,3 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) } + }; @@ -1217,4 +1217,6 @@ QPEApplication::~QPEApplication() #endif -#ifdef OPIE_ROHFEEDBACK - delete d->RoH; + +#ifdef OPIE_WITHROHFEEDBACK + if( d->RoH ) + delete d->RoH; #endif @@ -2037,2 +2039,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) if ( me->button() == LeftButton ) { + static long Pref = 500; // #### pref. d->presswidget = (QWidget*)o; @@ -2040,5 +2043,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) d->rightpressed = FALSE; - // just for the time being - static int pref = 500; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK if( ! d->RoH ) @@ -2047,6 +2048,7 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) d->RoH->init( me->globalPos(), d->presswidget ); - pref = d->RoH->delay(); + Pref = d->RoH->delay(); + #endif if (!d->presstimer ) - d->presstimer = startTimer( pref ); // #### pref. + d->presstimer = startTimer( Pref ); // #### pref. @@ -2057,5 +2059,4 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #endif @@ -2068,5 +2069,4 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop( ); #endif @@ -2075,2 +2075,3 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) if ( d->rightpressed && d->presswidget ) { + printf( "Send ButtonRelease\n" ); // Right released @@ -2118,11 +2119,12 @@ void QPEApplication::timerEvent( QTimerEvent *e ) if ( e->timerId() == d->presstimer && d->presswidget ) { - // Right pressed - postEvent( d->presswidget, - new QMouseEvent( QEvent::MouseButtonPress, d->presspos, - RightButton, LeftButton ) ); - killTimer( d->presstimer ); - d->presstimer = 0; - d->rightpressed = TRUE; -#ifdef OPIE_ROHFEEDBACK - d->RoH->stop(); + + // Right pressed + postEvent( d->presswidget, + new QMouseEvent( QEvent::MouseButtonPress, d->presspos, + RightButton, LeftButton ) ); + killTimer( d->presstimer ); + d->presstimer = 0; + d->rightpressed = TRUE; +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #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: - - }; |