-rw-r--r-- | library/qpeapplication.h | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 579fc44..00d3d31 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -22,24 +22,25 @@ | |||
22 | 22 | ||
23 | #include <stdlib.h> // for setenv() | 23 | #include <stdlib.h> // for setenv() |
24 | 24 | ||
25 | #include <qglobal.h> | 25 | #include <qglobal.h> |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qdialog.h> | 27 | #include <qdialog.h> |
28 | #include <qwsdisplay_qws.h> | 28 | #include <qwsdisplay_qws.h> |
29 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) | 29 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) |
30 | #define Q_WS_QWS | 30 | #define Q_WS_QWS |
31 | #endif | 31 | #endif |
32 | #include "qpedecoration_qws.h" | 32 | #include "qpedecoration_qws.h" |
33 | #include "timestring.h" | 33 | #include "timestring.h" |
34 | #include "qpeglobal.h" | ||
34 | 35 | ||
35 | class QCopChannel; | 36 | class QCopChannel; |
36 | class QPEApplicationData; | 37 | class QPEApplicationData; |
37 | class QWSEvent; | 38 | class QWSEvent; |
38 | class QWSKeyEvent; | 39 | class QWSKeyEvent; |
39 | 40 | ||
40 | /** | 41 | /** |
41 | \brief The QPEApplication class implements various system services | 42 | \brief The QPEApplication class implements various system services |
42 | that are available to all Qtopia applications. | 43 | that are available to all Qtopia applications. |
43 | 44 | ||
44 | Simply by using QPEApplication instead of QApplication, a standard Qt | 45 | Simply by using QPEApplication instead of QApplication, a standard Qt |
45 | application becomes a Qtopia application. It automatically follows | 46 | application becomes a Qtopia application. It automatically follows |
@@ -111,27 +112,28 @@ public: | |||
111 | enum screenSaverHint { | 112 | enum screenSaverHint { |
112 | Disable = 0, | 113 | Disable = 0, |
113 | DisableLightOff = 1, | 114 | DisableLightOff = 1, |
114 | DisableSuspend = 2, | 115 | DisableSuspend = 2, |
115 | Enable = 100 | 116 | Enable = 100 |
116 | }; | 117 | }; |
117 | 118 | ||
118 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 119 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
119 | static InputMethodHint inputMethodHint( QWidget * ); | 120 | static InputMethodHint inputMethodHint( QWidget * ); |
120 | 121 | ||
121 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 122 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
122 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 123 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
123 | static void showDialog( QDialog*, bool nomax=FALSE ); | 124 | |
124 | static int execDialog( QDialog*, bool nomax=FALSE ); | 125 | static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; |
125 | static void showWidget( QWidget*, bool nomax=FALSE ); | 126 | static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; |
127 | static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; | ||
126 | /* Merge setTempScreenSaverMode */ | 128 | /* Merge setTempScreenSaverMode */ |
127 | #ifdef QTOPIA_INTERNAL_INITAPP | 129 | #ifdef QTOPIA_INTERNAL_INITAPP |
128 | void initApp( int argv, char **argv ); | 130 | void initApp( int argv, char **argv ); |
129 | #endif | 131 | #endif |
130 | 132 | ||
131 | static void setKeepRunning(); | 133 | static void setKeepRunning(); |
132 | bool keepRunning() const; | 134 | bool keepRunning() const; |
133 | 135 | ||
134 | bool keyboardGrabbed() const; | 136 | bool keyboardGrabbed() const; |
135 | 137 | ||
136 | int exec(); | 138 | int exec(); |
137 | 139 | ||
@@ -174,68 +176,25 @@ private: | |||
174 | void processQCopFile(); | 176 | void processQCopFile(); |
175 | 177 | ||
176 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 178 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
177 | QCopChannel *sysChannel; | 179 | QCopChannel *sysChannel; |
178 | QCopChannel *pidChannel; | 180 | QCopChannel *pidChannel; |
179 | #endif | 181 | #endif |
180 | QPEApplicationData *d; | 182 | QPEApplicationData *d; |
181 | 183 | ||
182 | bool reserved_sh; | 184 | bool reserved_sh; |
183 | 185 | ||
184 | }; | 186 | }; |
185 | 187 | ||
186 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | ||
187 | { | ||
188 | showWidget( d, nomax ); | ||
189 | } | ||
190 | 188 | ||
191 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | ||
192 | { | ||
193 | showDialog( d, nomax ); | ||
194 | return d->exec(); | ||
195 | } | ||
196 | |||
197 | #ifdef Q_WS_QWS | ||
198 | extern Q_EXPORT QRect qt_maxWindowRect; | ||
199 | #endif | ||
200 | |||
201 | inline void QPEApplication::showWidget( QWidget* wg, bool nomax ) | ||
202 | { | ||
203 | if ( wg->isVisible() ) | ||
204 | wg->show(); | ||
205 | else | ||
206 | { | ||
207 | if ( !nomax | ||
208 | && ( qApp->desktop()->width() <= 320 ) ) | ||
209 | { | ||
210 | wg->showMaximized(); | ||
211 | } else { | ||
212 | #ifdef Q_WS_QWS | ||
213 | QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() ); | ||
214 | #else | ||
215 | QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() ); | ||
216 | #endif | ||
217 | |||
218 | QSize sh = wg->sizeHint(); | ||
219 | int w = QMAX( sh.width(), wg->width() ); | ||
220 | int h = QMAX( sh.height(), wg->height() ); | ||
221 | // desktop widget-frame taskbar | ||
222 | w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) ); | ||
223 | h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) ); | ||
224 | |||
225 | wg->resize( w, h ); | ||
226 | wg->show(); | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | 189 | ||
231 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 190 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
232 | 191 | ||
233 | inline int TransToDeg ( Transformation t ) | 192 | inline int TransToDeg ( Transformation t ) |
234 | { | 193 | { |
235 | int d = static_cast<int>( t ); | 194 | int d = static_cast<int>( t ); |
236 | return d * 90; | 195 | return d * 90; |
237 | } | 196 | } |
238 | 197 | ||
239 | inline Transformation DegToTrans ( int d ) | 198 | inline Transformation DegToTrans ( int d ) |
240 | { | 199 | { |
241 | Transformation t = static_cast<Transformation>( d / 90 ); | 200 | Transformation t = static_cast<Transformation>( d / 90 ); |
@@ -253,13 +212,20 @@ inline void QPEApplication::setCurrentRotation( int r ) | |||
253 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | 212 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots |
254 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | 213 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() |
255 | #if QT_VERSION > 233 | 214 | #if QT_VERSION > 233 |
256 | Transformation e = DegToTrans( r ); | 215 | Transformation e = DegToTrans( r ); |
257 | ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 216 | ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
258 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 217 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
259 | #else | 218 | #else |
260 | setDefaultRotation( r ); | 219 | setDefaultRotation( r ); |
261 | #endif | 220 | #endif |
262 | } | 221 | } |
263 | 222 | ||
264 | 223 | ||
224 | /* | ||
225 | * -remove me | ||
226 | */ | ||
227 | #ifdef Q_WS_QWS | ||
228 | extern Q_EXPORT QRect qt_maxWindowRect; | ||
229 | #endif | ||
230 | |||
265 | #endif | 231 | #endif |