author | zecke <zecke> | 2004-08-24 13:38:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-24 13:38:23 (UTC) |
commit | 0a141c4a9719aa273867ad45c4293208545489b1 (patch) (unidiff) | |
tree | 4059ae180d00d33cc31dd9083d38a14b946253a2 /library/qpeapplication.cpp | |
parent | 102bb2b65c71da12c4f9f1ce7a5d1b37b6eb50ee (diff) | |
download | opie-0a141c4a9719aa273867ad45c4293208545489b1.zip opie-0a141c4a9719aa273867ad45c4293208545489b1.tar.gz opie-0a141c4a9719aa273867ad45c4293208545489b1.tar.bz2 |
Add RightOn Hold Visual Feedback and integrate it
into QPEApplication
Icons and Config Option will be comitted by WIMPIE
-rw-r--r-- | library/qpeapplication.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 59ca61b..acad81d 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -94,14 +94,18 @@ | |||
94 | #include <sys/ioctl.h> | 94 | #include <sys/ioctl.h> |
95 | #ifndef QT_NO_SOUND | 95 | #ifndef QT_NO_SOUND |
96 | #include <sys/soundcard.h> | 96 | #include <sys/soundcard.h> |
97 | #endif | 97 | #endif |
98 | #include "qt_override_p.h" | 98 | #include "qt_override_p.h" |
99 | 99 | ||
100 | #include <qpe/rohfeedback.h> | ||
101 | |||
102 | |||
100 | static bool useBigPixmaps = 0; | 103 | static bool useBigPixmaps = 0; |
101 | 104 | ||
105 | |||
102 | class HackWidget : public QWidget | 106 | class HackWidget : public QWidget |
103 | { | 107 | { |
104 | public: | 108 | public: |
105 | bool needsOk() | 109 | bool needsOk() |
106 | { return (getWState() & WState_Reserved1 ); } | 110 | { return (getWState() & WState_Reserved1 ); } |
107 | 111 | ||
@@ -123,12 +127,13 @@ public: | |||
123 | cfg.setGroup( "Appearance" ); | 127 | cfg.setGroup( "Appearance" ); |
124 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); | 128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); |
125 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); | 129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); |
126 | fontSize = cfg.readNumEntry( "FontSize", 10 ); | 130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); |
127 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); | 131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); |
128 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); | 132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); |
133 | RoH = 0; | ||
129 | } | 134 | } |
130 | 135 | ||
131 | int presstimer; | 136 | int presstimer; |
132 | QWidget* presswidget; | 137 | QWidget* presswidget; |
133 | QPoint presspos; | 138 | QPoint presspos; |
134 | 139 | ||
@@ -489,12 +494,14 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) | |||
489 | else { | 494 | else { |
490 | lib->unload(); | 495 | lib->unload(); |
491 | delete lib; | 496 | delete lib; |
492 | } | 497 | } |
493 | } | 498 | } |
494 | } | 499 | } |
500 | |||
501 | Opie::Internal::RoHFeedback * RoH; | ||
495 | }; | 502 | }; |
496 | 503 | ||
497 | class ResourceMimeFactory : public QMimeSourceFactory | 504 | class ResourceMimeFactory : public QMimeSourceFactory |
498 | { | 505 | { |
499 | public: | 506 | public: |
500 | ResourceMimeFactory() : resImage( 0 ) | 507 | ResourceMimeFactory() : resImage( 0 ) |
@@ -1202,13 +1209,13 @@ QPEApplication::~QPEApplication() | |||
1202 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1209 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1203 | // Need to delete QCopChannels early, since the display will | 1210 | // Need to delete QCopChannels early, since the display will |
1204 | // be gone by the time we get to ~QObject(). | 1211 | // be gone by the time we get to ~QObject(). |
1205 | delete sysChannel; | 1212 | delete sysChannel; |
1206 | delete pidChannel; | 1213 | delete pidChannel; |
1207 | #endif | 1214 | #endif |
1208 | 1215 | delete d->RoH; | |
1209 | delete d; | 1216 | delete d; |
1210 | } | 1217 | } |
1211 | 1218 | ||
1212 | /*! | 1219 | /*! |
1213 | Returns <tt>$OPIEDIR/</tt>. | 1220 | Returns <tt>$OPIEDIR/</tt>. |
1214 | */ | 1221 | */ |
@@ -2020,29 +2027,47 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
2020 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 2027 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
2021 | switch (mode) { | 2028 | switch (mode) { |
2022 | case RightOnHold: | 2029 | case RightOnHold: |
2023 | switch ( me->type() ) { | 2030 | switch ( me->type() ) { |
2024 | case QEvent::MouseButtonPress: | 2031 | case QEvent::MouseButtonPress: |
2025 | if ( me->button() == LeftButton ) { | 2032 | if ( me->button() == LeftButton ) { |
2026 | if (!d->presstimer ) | ||
2027 | d->presstimer = startTimer(500); // #### pref. | ||
2028 | d->presswidget = (QWidget*)o; | 2033 | d->presswidget = (QWidget*)o; |
2029 | d->presspos = me->pos(); | 2034 | d->presspos = me->pos(); |
2030 | d->rightpressed = FALSE; | 2035 | d->rightpressed = FALSE; |
2036 | // just for the time being | ||
2037 | static int pref = 500; | ||
2038 | #ifdef WITHROHFEEDBACK | ||
2039 | if( ! d->RoH ) | ||
2040 | d->RoH = new Opie::Internal::RoHFeedback; | ||
2041 | |||
2042 | d->RoH->init( me->globalPos(), d->presswidget ); | ||
2043 | pref = d->RoH->delay(); | ||
2044 | #endif | ||
2045 | if (!d->presstimer ) | ||
2046 | d->presstimer = startTimer( pref ); // #### pref. | ||
2047 | |||
2031 | } | 2048 | } |
2032 | break; | 2049 | break; |
2033 | case QEvent::MouseMove: | 2050 | case QEvent::MouseMove: |
2034 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 2051 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
2035 | killTimer(d->presstimer); | 2052 | killTimer(d->presstimer); |
2053 | #ifdef WITHROHFEEDBACK | ||
2054 | if( d->RoH ) | ||
2055 | d->RoH->stop( ); | ||
2056 | #endif | ||
2036 | d->presstimer = 0; | 2057 | d->presstimer = 0; |
2037 | } | 2058 | } |
2038 | break; | 2059 | break; |
2039 | case QEvent::MouseButtonRelease: | 2060 | case QEvent::MouseButtonRelease: |
2040 | if ( me->button() == LeftButton ) { | 2061 | if ( me->button() == LeftButton ) { |
2041 | if ( d->presstimer ) { | 2062 | if ( d->presstimer ) { |
2042 | killTimer(d->presstimer); | 2063 | killTimer(d->presstimer); |
2064 | #ifdef WITHROHFEEDBACK | ||
2065 | if( d->RoH ) | ||
2066 | d->RoH->stop( ); | ||
2067 | #endif | ||
2043 | d->presstimer = 0; | 2068 | d->presstimer = 0; |
2044 | } | 2069 | } |
2045 | if ( d->rightpressed && d->presswidget ) { | 2070 | if ( d->rightpressed && d->presswidget ) { |
2046 | // Right released | 2071 | // Right released |
2047 | postEvent( d->presswidget, | 2072 | postEvent( d->presswidget, |
2048 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 2073 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
@@ -2090,12 +2115,13 @@ void QPEApplication::timerEvent( QTimerEvent *e ) | |||
2090 | postEvent( d->presswidget, | 2115 | postEvent( d->presswidget, |
2091 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 2116 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
2092 | RightButton, LeftButton ) ); | 2117 | RightButton, LeftButton ) ); |
2093 | killTimer( d->presstimer ); | 2118 | killTimer( d->presstimer ); |
2094 | d->presstimer = 0; | 2119 | d->presstimer = 0; |
2095 | d->rightpressed = TRUE; | 2120 | d->rightpressed = TRUE; |
2121 | d->RoH->stop(); | ||
2096 | } | 2122 | } |
2097 | } | 2123 | } |
2098 | 2124 | ||
2099 | void QPEApplication::removeSenderFromStylusDict() | 2125 | void QPEApplication::removeSenderFromStylusDict() |
2100 | { | 2126 | { |
2101 | stylusDict->remove | 2127 | stylusDict->remove |