author | sandman <sandman> | 2002-10-04 00:41:19 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-04 00:41:19 (UTC) |
commit | 41e252c02eb10dcaa4622341f706b7817d6a70b2 (patch) (unidiff) | |
tree | 786be18c31413b7ab5ff52c38bbb3bcdfa3fa0c8 | |
parent | 0490713bb9cf600e14951195c58558e605063940 (diff) | |
download | opie-41e252c02eb10dcaa4622341f706b7817d6a70b2.zip opie-41e252c02eb10dcaa4622341f706b7817d6a70b2.tar.gz opie-41e252c02eb10dcaa4622341f706b7817d6a70b2.tar.bz2 |
- fixed a bug in style loading
- changed the config key format for styles
-rw-r--r-- | library/qpeapplication.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 533d7bd..e92b4dd 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1158,137 +1158,142 @@ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | |||
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/lib" + style. lower ( ) + ".so"; | 1222 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1223 | |||
1224 | if ( style. find ( ".so" ) > 0 ) | ||
1225 | path += style; | ||
1226 | else | ||
1227 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | ||
1223 | 1228 | ||
1224 | static QLibrary *lastlib = 0; | 1229 | static QLibrary *lastlib = 0; |
1225 | static StyleInterface *lastiface = 0; | 1230 | static StyleInterface *lastiface = 0; |
1226 | 1231 | ||
1227 | QLibrary *lib = new QLibrary ( path ); | 1232 | QLibrary *lib = new QLibrary ( path ); |
1228 | StyleInterface *iface = 0; | 1233 | StyleInterface *iface = 0; |
1229 | 1234 | ||
1230 | if ( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) | 1235 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1231 | sty = iface-> create ( ); | 1236 | sty = iface-> create ( ); |
1232 | 1237 | ||
1233 | if ( sty ) { | 1238 | if ( sty ) { |
1234 | setStyle ( sty ); | 1239 | setStyle ( sty ); |
1235 | 1240 | ||
1236 | if ( lastiface ) | 1241 | if ( lastiface ) |
1237 | lastiface-> release ( ); | 1242 | lastiface-> release ( ); |
1238 | lastiface = iface; | 1243 | lastiface = iface; |
1239 | 1244 | ||
1240 | if ( lastlib ) { | 1245 | if ( lastlib ) { |
1241 | lastlib-> unload ( ); | 1246 | lastlib-> unload ( ); |
1242 | delete lastlib; | 1247 | delete lastlib; |
1243 | } | 1248 | } |
1244 | lastlib = lib; | 1249 | lastlib = lib; |
1245 | } | 1250 | } |
1246 | else { | 1251 | else { |
1247 | if ( iface ) | 1252 | if ( iface ) |
1248 | iface-> release ( ); | 1253 | iface-> release ( ); |
1249 | delete lib; | 1254 | delete lib; |
1250 | 1255 | ||
1251 | setStyle ( new QPEStyle ( )); | 1256 | setStyle ( new QPEStyle ( )); |
1252 | } | 1257 | } |
1253 | } | 1258 | } |
1254 | #endif | 1259 | #endif |
1255 | } | 1260 | } |
1256 | 1261 | ||
1257 | /*! | 1262 | /*! |
1258 | \internal | 1263 | \internal |
1259 | */ | 1264 | */ |
1260 | void QPEApplication::prepareForTermination( bool willrestart ) | 1265 | void QPEApplication::prepareForTermination( bool willrestart ) |
1261 | { | 1266 | { |
1262 | if ( willrestart ) { | 1267 | if ( willrestart ) { |
1263 | // 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 |
1264 | // QWidget *d = QApplication::desktop(); | 1269 | // QWidget *d = QApplication::desktop(); |
1265 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1270 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1266 | QPixmap pix; | 1271 | QPixmap pix; |
1267 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 1272 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
1268 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 1273 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
1269 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1274 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1270 | lblWait->setPixmap( pix ); | 1275 | lblWait->setPixmap( pix ); |
1271 | lblWait->setAlignment( QWidget::AlignCenter ); | 1276 | lblWait->setAlignment( QWidget::AlignCenter ); |
1272 | lblWait->show(); | 1277 | lblWait->show(); |
1273 | lblWait->showMaximized(); | 1278 | lblWait->showMaximized(); |
1274 | } | 1279 | } |
1275 | #ifndef SINGLE_APP | 1280 | #ifndef SINGLE_APP |
1276 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1281 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1277 | } | 1282 | } |
1278 | processEvents(); // ensure the message goes out. | 1283 | processEvents(); // ensure the message goes out. |
1279 | sleep( 1 ); // You have 1 second to comply. | 1284 | sleep( 1 ); // You have 1 second to comply. |
1280 | #endif | 1285 | #endif |
1281 | } | 1286 | } |
1282 | 1287 | ||
1283 | /*! | 1288 | /*! |
1284 | \internal | 1289 | \internal |
1285 | */ | 1290 | */ |
1286 | void QPEApplication::shutdown() | 1291 | void QPEApplication::shutdown() |
1287 | { | 1292 | { |
1288 | // Implement in server's QPEApplication subclass | 1293 | // Implement in server's QPEApplication subclass |
1289 | } | 1294 | } |
1290 | 1295 | ||
1291 | /*! | 1296 | /*! |
1292 | \internal | 1297 | \internal |
1293 | */ | 1298 | */ |
1294 | void QPEApplication::restart() | 1299 | void QPEApplication::restart() |