author | sandman <sandman> | 2002-10-04 01:22:50 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-04 01:22:50 (UTC) |
commit | b7ec6d0674f0f7835da7f114683dcfa74e6bc546 (patch) (unidiff) | |
tree | a2dff60b917d943543458f3e47d67f1584fbfb6c /library/qpeapplication.cpp | |
parent | e2f23d8a5169ffef63dcbbac920f68ef0f113792 (diff) | |
download | opie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.zip opie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.tar.gz opie-b7ec6d0674f0f7835da7f114683dcfa74e6bc546.tar.bz2 |
changes to make the style interface BC with Qtopia 1.6, while still
supporting our extended features
-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index e92b4dd..f65f3ab 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1140,193 +1140,193 @@ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | |||
1140 | \sa showMainWidget() | 1140 | \sa showMainWidget() |
1141 | */ | 1141 | */ |
1142 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1142 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1143 | { | 1143 | { |
1144 | if ( mw && argc() == 2 ) | 1144 | if ( mw && argc() == 2 ) |
1145 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1145 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1146 | 1146 | ||
1147 | d->show(mw, nomaximize ); | 1147 | d->show(mw, nomaximize ); |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | 1150 | ||
1151 | /*! | 1151 | /*! |
1152 | If an application is started via a \link qcop.html QCop\endlink | 1152 | If an application is started via a \link qcop.html QCop\endlink |
1153 | message, the application will process the \link qcop.html | 1153 | message, the application will process the \link qcop.html |
1154 | QCop\endlink message and then quit. If the application calls this | 1154 | QCop\endlink message and then quit. If the application calls this |
1155 | function while processing a \link qcop.html QCop\endlink message, | 1155 | function while processing a \link qcop.html QCop\endlink message, |
1156 | after processing its outstanding \link qcop.html QCop\endlink | 1156 | after processing its outstanding \link qcop.html QCop\endlink |
1157 | messages the application will start 'properly' and show itself. | 1157 | messages the application will start 'properly' and show itself. |
1158 | 1158 | ||
1159 | \sa keepRunning() | 1159 | \sa keepRunning() |
1160 | */ | 1160 | */ |
1161 | void QPEApplication::setKeepRunning() | 1161 | void QPEApplication::setKeepRunning() |
1162 | { | 1162 | { |
1163 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1163 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1164 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1164 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1165 | qpeApp->d->keep_running = TRUE; | 1165 | qpeApp->d->keep_running = TRUE; |
1166 | } | 1166 | } |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | /*! | 1169 | /*! |
1170 | Returns TRUE if the application will quit after processing the | 1170 | Returns TRUE if the application will quit after processing the |
1171 | current list of qcop messages; otherwise returns FALSE. | 1171 | current list of qcop messages; otherwise returns FALSE. |
1172 | 1172 | ||
1173 | \sa setKeepRunning() | 1173 | \sa setKeepRunning() |
1174 | */ | 1174 | */ |
1175 | bool QPEApplication::keepRunning() const | 1175 | bool QPEApplication::keepRunning() const |
1176 | { | 1176 | { |
1177 | return d->keep_running; | 1177 | return d->keep_running; |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | /*! | 1180 | /*! |
1181 | \internal | 1181 | \internal |
1182 | */ | 1182 | */ |
1183 | void QPEApplication::internalSetStyle( const QString &style ) | 1183 | void QPEApplication::internalSetStyle( const QString &style ) |
1184 | { | 1184 | { |
1185 | #if QT_VERSION >= 300 | 1185 | #if QT_VERSION >= 300 |
1186 | if ( style == "QPE" ) { | 1186 | if ( style == "QPE" ) { |
1187 | setStyle( new QPEStyle ); | 1187 | setStyle( new QPEStyle ); |
1188 | } | 1188 | } |
1189 | else { | 1189 | else { |
1190 | QStyle *s = QStyleFactory::create( style ); | 1190 | QStyle *s = QStyleFactory::create( style ); |
1191 | if ( s ) | 1191 | if ( s ) |
1192 | setStyle( s ); | 1192 | setStyle( s ); |
1193 | } | 1193 | } |
1194 | #else | 1194 | #else |
1195 | if ( style == "Windows" ) { | 1195 | if ( style == "Windows" ) { |
1196 | setStyle( new QWindowsStyle ); | 1196 | setStyle( new QWindowsStyle ); |
1197 | } | 1197 | } |
1198 | else if ( style == "QPE" ) { | 1198 | else if ( style == "QPE" ) { |
1199 | setStyle( new QPEStyle ); | 1199 | setStyle( new QPEStyle ); |
1200 | } | 1200 | } |
1201 | else if ( style == "Light" ) { | 1201 | else if ( style == "Light" ) { |
1202 | setStyle( new LightStyle ); | 1202 | setStyle( new LightStyle ); |
1203 | } | 1203 | } |
1204 | #ifndef QT_NO_STYLE_PLATINUM | 1204 | #ifndef QT_NO_STYLE_PLATINUM |
1205 | else if ( style == "Platinum" ) { | 1205 | else if ( style == "Platinum" ) { |
1206 | setStyle( new QPlatinumStyle ); | 1206 | setStyle( new QPlatinumStyle ); |
1207 | } | 1207 | } |
1208 | #endif | 1208 | #endif |
1209 | #ifndef QT_NO_STYLE_MOTIF | 1209 | #ifndef QT_NO_STYLE_MOTIF |
1210 | else if ( style == "Motif" ) { | 1210 | else if ( style == "Motif" ) { |
1211 | setStyle( new QMotifStyle ); | 1211 | setStyle( new QMotifStyle ); |
1212 | } | 1212 | } |
1213 | #endif | 1213 | #endif |
1214 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1214 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1215 | else if ( style == "MotifPlus" ) { | 1215 | else if ( style == "MotifPlus" ) { |
1216 | setStyle( new QMotifPlusStyle ); | 1216 | setStyle( new QMotifPlusStyle ); |
1217 | } | 1217 | } |
1218 | #endif | 1218 | #endif |
1219 | 1219 | ||
1220 | else { | 1220 | else { |
1221 | QStyle *sty = 0; | 1221 | QStyle *sty = 0; |
1222 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1222 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1223 | 1223 | ||
1224 | if ( style. find ( ".so" ) > 0 ) | 1224 | if ( style. find ( ".so" ) > 0 ) |
1225 | path += style; | 1225 | path += style; |
1226 | else | 1226 | else |
1227 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1227 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1228 | 1228 | ||
1229 | static QLibrary *lastlib = 0; | 1229 | static QLibrary *lastlib = 0; |
1230 | static StyleInterface *lastiface = 0; | 1230 | static StyleInterface *lastiface = 0; |
1231 | 1231 | ||
1232 | QLibrary *lib = new QLibrary ( path ); | 1232 | QLibrary *lib = new QLibrary ( path ); |
1233 | StyleInterface *iface = 0; | 1233 | StyleInterface *iface = 0; |
1234 | 1234 | ||
1235 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1235 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1236 | sty = iface-> create ( ); | 1236 | sty = iface-> style ( ); |
1237 | 1237 | ||
1238 | if ( sty ) { | 1238 | if ( sty ) { |
1239 | setStyle ( sty ); | 1239 | setStyle ( sty ); |
1240 | 1240 | ||
1241 | if ( lastiface ) | 1241 | if ( lastiface ) |
1242 | lastiface-> release ( ); | 1242 | lastiface-> release ( ); |
1243 | lastiface = iface; | 1243 | lastiface = iface; |
1244 | 1244 | ||
1245 | if ( lastlib ) { | 1245 | if ( lastlib ) { |
1246 | lastlib-> unload ( ); | 1246 | lastlib-> unload ( ); |
1247 | delete lastlib; | 1247 | delete lastlib; |
1248 | } | 1248 | } |
1249 | lastlib = lib; | 1249 | lastlib = lib; |
1250 | } | 1250 | } |
1251 | else { | 1251 | else { |
1252 | if ( iface ) | 1252 | if ( iface ) |
1253 | iface-> release ( ); | 1253 | iface-> release ( ); |
1254 | delete lib; | 1254 | delete lib; |
1255 | 1255 | ||
1256 | setStyle ( new QPEStyle ( )); | 1256 | setStyle ( new QPEStyle ( )); |
1257 | } | 1257 | } |
1258 | } | 1258 | } |
1259 | #endif | 1259 | #endif |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | /*! | 1262 | /*! |
1263 | \internal | 1263 | \internal |
1264 | */ | 1264 | */ |
1265 | void QPEApplication::prepareForTermination( bool willrestart ) | 1265 | void QPEApplication::prepareForTermination( bool willrestart ) |
1266 | { | 1266 | { |
1267 | if ( willrestart ) { | 1267 | if ( willrestart ) { |
1268 | // Draw a big wait icon, the image can be altered in later revisions | 1268 | // Draw a big wait icon, the image can be altered in later revisions |
1269 | // QWidget *d = QApplication::desktop(); | 1269 | // QWidget *d = QApplication::desktop(); |
1270 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1270 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1271 | QPixmap pix; | 1271 | QPixmap pix; |
1272 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 1272 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
1273 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 1273 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
1274 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1274 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1275 | lblWait->setPixmap( pix ); | 1275 | lblWait->setPixmap( pix ); |
1276 | lblWait->setAlignment( QWidget::AlignCenter ); | 1276 | lblWait->setAlignment( QWidget::AlignCenter ); |
1277 | lblWait->show(); | 1277 | lblWait->show(); |
1278 | lblWait->showMaximized(); | 1278 | lblWait->showMaximized(); |
1279 | } | 1279 | } |
1280 | #ifndef SINGLE_APP | 1280 | #ifndef SINGLE_APP |
1281 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1281 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1282 | } | 1282 | } |
1283 | processEvents(); // ensure the message goes out. | 1283 | processEvents(); // ensure the message goes out. |
1284 | sleep( 1 ); // You have 1 second to comply. | 1284 | sleep( 1 ); // You have 1 second to comply. |
1285 | #endif | 1285 | #endif |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | /*! | 1288 | /*! |
1289 | \internal | 1289 | \internal |
1290 | */ | 1290 | */ |
1291 | void QPEApplication::shutdown() | 1291 | void QPEApplication::shutdown() |
1292 | { | 1292 | { |
1293 | // Implement in server's QPEApplication subclass | 1293 | // Implement in server's QPEApplication subclass |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | /*! | 1296 | /*! |
1297 | \internal | 1297 | \internal |
1298 | */ | 1298 | */ |
1299 | void QPEApplication::restart() | 1299 | void QPEApplication::restart() |
1300 | { | 1300 | { |
1301 | // Implement in server's QPEApplication subclass | 1301 | // Implement in server's QPEApplication subclass |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | static QPtrDict<void>* stylusDict = 0; | 1304 | static QPtrDict<void>* stylusDict = 0; |
1305 | static void createDict() | 1305 | static void createDict() |
1306 | { | 1306 | { |
1307 | if ( !stylusDict ) | 1307 | if ( !stylusDict ) |
1308 | stylusDict = new QPtrDict<void>; | 1308 | stylusDict = new QPtrDict<void>; |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | /*! | 1311 | /*! |
1312 | Returns the current StylusMode for widget \a w. | 1312 | Returns the current StylusMode for widget \a w. |
1313 | 1313 | ||
1314 | \sa setStylusOperation() StylusMode | 1314 | \sa setStylusOperation() StylusMode |
1315 | */ | 1315 | */ |
1316 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1316 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1317 | { | 1317 | { |
1318 | if ( stylusDict ) | 1318 | if ( stylusDict ) |
1319 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1319 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1320 | return LeftOnly; | 1320 | return LeftOnly; |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | /*! | 1323 | /*! |
1324 | \enum QPEApplication::StylusMode | 1324 | \enum QPEApplication::StylusMode |
1325 | 1325 | ||
1326 | \value LeftOnly the stylus only generates LeftButton | 1326 | \value LeftOnly the stylus only generates LeftButton |
1327 | events (the default). | 1327 | events (the default). |
1328 | \value RightOnHold the stylus generates RightButton events | 1328 | \value RightOnHold the stylus generates RightButton events |
1329 | if the user uses the press-and-hold gesture. | 1329 | if the user uses the press-and-hold gesture. |
1330 | 1330 | ||
1331 | \sa setStylusOperation() stylusOperation() | 1331 | \sa setStylusOperation() stylusOperation() |
1332 | */ | 1332 | */ |