summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-24 17:37:59 (UTC)
committer zecke <zecke>2004-08-24 17:37:59 (UTC)
commite90847c784c48bd21bf8768cb38edb853b832697 (patch) (unidiff)
tree7c95b22cc4e9b69aa384c041ae67babb8fafe319
parent0a141c4a9719aa273867ad45c4293208545489b1 (diff)
downloadopie-e90847c784c48bd21bf8768cb38edb853b832697.zip
opie-e90847c784c48bd21bf8768cb38edb853b832697.tar.gz
opie-e90847c784c48bd21bf8768cb38edb853b832697.tar.bz2
Allow to completely turn off/on Right on Hold Visual Feedback
mickey thanks for spotting the linking failures :}
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index acad81d..35f433c 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -121,30 +121,35 @@ public:
121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
122 keep_running( true ), qcopQok( false ), 122 keep_running( true ), qcopQok( false ),
123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), 123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
124 bigIconSize( 32 ), qpe_main_widget( 0 ) 124 bigIconSize( 32 ), qpe_main_widget( 0 )
125 { 125 {
126 Config cfg( "qpe" ); 126 Config cfg( "qpe" );
127 cfg.setGroup( "Appearance" ); 127 cfg.setGroup( "Appearance" );
128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); 128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
129 fontFamily = cfg.readEntry( "FontFamily", "Vera" ); 129 fontFamily = cfg.readEntry( "FontFamily", "Vera" );
130 fontSize = cfg.readNumEntry( "FontSize", 10 ); 130 fontSize = cfg.readNumEntry( "FontSize", 10 );
131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
133#ifdef OPIE_ROHFEEDBACK
133 RoH = 0; 134 RoH = 0;
135#endif
134 } 136 }
135 137
136 int presstimer; 138 int presstimer;
137 QWidget* presswidget; 139 QWidget* presswidget;
138 QPoint presspos; 140 QPoint presspos;
141#ifdef OPIE_ROHFEEDBACK
142 Opie::Internal::RoHFeedback *RoH;
143#endif
139 144
140 bool rightpressed : 1; 145 bool rightpressed : 1;
141 bool kbgrabbed : 1; 146 bool kbgrabbed : 1;
142 bool notbusysent : 1; 147 bool notbusysent : 1;
143 bool preloaded : 1; 148 bool preloaded : 1;
144 bool forceshow : 1; 149 bool forceshow : 1;
145 bool nomaximize : 1; 150 bool nomaximize : 1;
146 bool keep_running : 1; 151 bool keep_running : 1;
147 bool qcopQok : 1; 152 bool qcopQok : 1;
148 153
149 QCString fontFamily; 154 QCString fontFamily;
150 int fontSize; 155 int fontSize;
@@ -488,26 +493,24 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
488 QStringList formats = iface->keys(); 493 QStringList formats = iface->keys();
489 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { 494 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
490 (void)iface->installIOHandler(*i); 495 (void)iface->installIOHandler(*i);
491 // ### it exists now; need to remember if we can delete it 496 // ### it exists now; need to remember if we can delete it
492 } 497 }
493 } 498 }
494 else { 499 else {
495 lib->unload(); 500 lib->unload();
496 delete lib; 501 delete lib;
497 } 502 }
498 } 503 }
499 } 504 }
500
501 Opie::Internal::RoHFeedback * RoH;
502}; 505};
503 506
504class ResourceMimeFactory : public QMimeSourceFactory 507class ResourceMimeFactory : public QMimeSourceFactory
505{ 508{
506public: 509public:
507 ResourceMimeFactory() : resImage( 0 ) 510 ResourceMimeFactory() : resImage( 0 )
508 { 511 {
509 setFilePath( Global::helpPath() ); 512 setFilePath( Global::helpPath() );
510 setExtensionType( "html", "text/html;charset=UTF-8" ); 513 setExtensionType( "html", "text/html;charset=UTF-8" );
511 } 514 }
512 ~ResourceMimeFactory() { 515 ~ResourceMimeFactory() {
513 delete resImage; 516 delete resImage;
@@ -1203,25 +1206,27 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
1203/*! 1206/*!
1204 Destroys the QPEApplication. 1207 Destroys the QPEApplication.
1205*/ 1208*/
1206QPEApplication::~QPEApplication() 1209QPEApplication::~QPEApplication()
1207{ 1210{
1208 ungrabKeyboard(); 1211 ungrabKeyboard();
1209#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1212#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1210 // Need to delete QCopChannels early, since the display will 1213 // Need to delete QCopChannels early, since the display will
1211 // be gone by the time we get to ~QObject(). 1214 // be gone by the time we get to ~QObject().
1212 delete sysChannel; 1215 delete sysChannel;
1213 delete pidChannel; 1216 delete pidChannel;
1214#endif 1217#endif
1218#ifdef OPIE_ROHFEEDBACK
1215 delete d->RoH; 1219 delete d->RoH;
1220#endif
1216 delete d; 1221 delete d;
1217} 1222}
1218 1223
1219/*! 1224/*!
1220 Returns <tt>$OPIEDIR/</tt>. 1225 Returns <tt>$OPIEDIR/</tt>.
1221*/ 1226*/
1222QString QPEApplication::qpeDir() 1227QString QPEApplication::qpeDir()
1223{ 1228{
1224 const char * base = getenv( "OPIEDIR" ); 1229 const char * base = getenv( "OPIEDIR" );
1225 if ( base ) 1230 if ( base )
1226 return QString( base ) + "/"; 1231 return QString( base ) + "/";
1227 1232
@@ -2026,51 +2031,51 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2026 QMouseEvent * me = ( QMouseEvent* ) e; 2031 QMouseEvent * me = ( QMouseEvent* ) e;
2027 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 2032 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
2028 switch (mode) { 2033 switch (mode) {
2029 case RightOnHold: 2034 case RightOnHold:
2030 switch ( me->type() ) { 2035 switch ( me->type() ) {
2031 case QEvent::MouseButtonPress: 2036 case QEvent::MouseButtonPress:
2032 if ( me->button() == LeftButton ) { 2037 if ( me->button() == LeftButton ) {
2033 d->presswidget = (QWidget*)o; 2038 d->presswidget = (QWidget*)o;
2034 d->presspos = me->pos(); 2039 d->presspos = me->pos();
2035 d->rightpressed = FALSE; 2040 d->rightpressed = FALSE;
2036 // just for the time being 2041 // just for the time being
2037 static int pref = 500; 2042 static int pref = 500;
2038#ifdef WITHROHFEEDBACK 2043#ifdef OPIE_ROHFEEDBACK
2039 if( ! d->RoH ) 2044 if( ! d->RoH )
2040 d->RoH = new Opie::Internal::RoHFeedback; 2045 d->RoH = new Opie::Internal::RoHFeedback;
2041 2046
2042 d->RoH->init( me->globalPos(), d->presswidget ); 2047 d->RoH->init( me->globalPos(), d->presswidget );
2043 pref = d->RoH->delay(); 2048 pref = d->RoH->delay();
2044#endif 2049#endif
2045 if (!d->presstimer ) 2050 if (!d->presstimer )
2046 d->presstimer = startTimer( pref ); // #### pref. 2051 d->presstimer = startTimer( pref ); // #### pref.
2047 2052
2048 } 2053 }
2049 break; 2054 break;
2050 case QEvent::MouseMove: 2055 case QEvent::MouseMove:
2051 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 2056 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
2052 killTimer(d->presstimer); 2057 killTimer(d->presstimer);
2053#ifdef WITHROHFEEDBACK 2058#ifdef OPIE_ROHFEEDBACK
2054 if( d->RoH ) 2059 if( d->RoH )
2055 d->RoH->stop( ); 2060 d->RoH->stop( );
2056#endif 2061#endif
2057 d->presstimer = 0; 2062 d->presstimer = 0;
2058 } 2063 }
2059 break; 2064 break;
2060 case QEvent::MouseButtonRelease: 2065 case QEvent::MouseButtonRelease:
2061 if ( me->button() == LeftButton ) { 2066 if ( me->button() == LeftButton ) {
2062 if ( d->presstimer ) { 2067 if ( d->presstimer ) {
2063 killTimer(d->presstimer); 2068 killTimer(d->presstimer);
2064#ifdef WITHROHFEEDBACK 2069#ifdef OPIE_ROHFEEDBACK
2065 if( d->RoH ) 2070 if( d->RoH )
2066 d->RoH->stop( ); 2071 d->RoH->stop( );
2067#endif 2072#endif
2068 d->presstimer = 0; 2073 d->presstimer = 0;
2069 } 2074 }
2070 if ( d->rightpressed && d->presswidget ) { 2075 if ( d->rightpressed && d->presswidget ) {
2071 // Right released 2076 // Right released
2072 postEvent( d->presswidget, 2077 postEvent( d->presswidget,
2073 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 2078 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
2074 RightButton, LeftButton + RightButton ) ); 2079 RightButton, LeftButton + RightButton ) );
2075 // Left released, off-widget 2080 // Left released, off-widget
2076 postEvent( d->presswidget, 2081 postEvent( d->presswidget,
@@ -2109,25 +2114,27 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
2109 \reimp 2114 \reimp
2110*/ 2115*/
2111void QPEApplication::timerEvent( QTimerEvent *e ) 2116void QPEApplication::timerEvent( QTimerEvent *e )
2112{ 2117{
2113 if ( e->timerId() == d->presstimer && d->presswidget ) { 2118 if ( e->timerId() == d->presstimer && d->presswidget ) {
2114 // Right pressed 2119 // Right pressed
2115 postEvent( d->presswidget, 2120 postEvent( d->presswidget,
2116 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 2121 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
2117 RightButton, LeftButton ) ); 2122 RightButton, LeftButton ) );
2118 killTimer( d->presstimer ); 2123 killTimer( d->presstimer );
2119 d->presstimer = 0; 2124 d->presstimer = 0;
2120 d->rightpressed = TRUE; 2125 d->rightpressed = TRUE;
2126#ifdef OPIE_ROHFEEDBACK
2121 d->RoH->stop(); 2127 d->RoH->stop();
2128#endif
2122 } 2129 }
2123} 2130}
2124 2131
2125void QPEApplication::removeSenderFromStylusDict() 2132void QPEApplication::removeSenderFromStylusDict()
2126{ 2133{
2127 stylusDict->remove 2134 stylusDict->remove
2128 ( ( void* ) sender() ); 2135 ( ( void* ) sender() );
2129 if ( d->presswidget == sender() ) 2136 if ( d->presswidget == sender() )
2130 d->presswidget = 0; 2137 d->presswidget = 0;
2131} 2138}
2132 2139
2133/*! 2140/*!