summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-21 01:23:55 (UTC)
committer sandman <sandman>2002-06-21 01:23:55 (UTC)
commit3f1129f79e945135828191679559da70cf4ac6fa (patch) (unidiff)
treeac5a2e4698a93a201c6bdb5bcf377e1e429c32ed
parent2a7407325b1607c9ee40ed3558c8549672a36ad4 (diff)
downloadopie-3f1129f79e945135828191679559da70cf4ac6fa.zip
opie-3f1129f79e945135828191679559da70cf4ac6fa.tar.gz
opie-3f1129f79e945135828191679559da70cf4ac6fa.tar.bz2
Added a hack to support on-demand loading of liquid style with Qt2
Will be removed, once we switch to Qt3
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index f84bc0e..1534b0b 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -69,48 +69,49 @@
69#endif 69#endif
70#include "config.h" 70#include "config.h"
71#include "network.h" 71#include "network.h"
72#include "fontmanager.h" 72#include "fontmanager.h"
73#include "fontdatabase.h" 73#include "fontdatabase.h"
74 74
75#include "power.h" 75#include "power.h"
76#include "alarmserver.h" 76#include "alarmserver.h"
77#include "applnk.h" 77#include "applnk.h"
78#include "qpemenubar.h" 78#include "qpemenubar.h"
79 79
80#include <unistd.h> 80#include <unistd.h>
81#include <sys/file.h> 81#include <sys/file.h>
82#include <sys/ioctl.h> 82#include <sys/ioctl.h>
83#include <sys/soundcard.h> 83#include <sys/soundcard.h>
84 84
85// for setBacklight() 85// for setBacklight()
86#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 86#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
87#include <linux/fb.h> 87#include <linux/fb.h>
88#include <sys/types.h> 88#include <sys/types.h>
89#include <sys/stat.h> 89#include <sys/stat.h>
90#endif 90#endif
91#include <stdlib.h> 91#include <stdlib.h>
92 92
93#include <dlfcn.h> // for Liquid HACK
93 94
94class QPEApplicationData { 95class QPEApplicationData {
95public: 96public:
96 QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE), 97 QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE),
97 kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE), 98 kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE),
98 forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0), 99 forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0),
99 keep_running(TRUE) 100 keep_running(TRUE)
100 { 101 {
101 qcopq.setAutoDelete(TRUE); 102 qcopq.setAutoDelete(TRUE);
102 } 103 }
103 104
104 int presstimer; 105 int presstimer;
105 QWidget* presswidget; 106 QWidget* presswidget;
106 QPoint presspos; 107 QPoint presspos;
107 bool rightpressed; 108 bool rightpressed;
108 int kbgrabber; 109 int kbgrabber;
109 bool kbregrab; 110 bool kbregrab;
110 bool notbusysent; 111 bool notbusysent;
111 QString appName; 112 QString appName;
112 struct QCopRec { 113 struct QCopRec {
113 QCopRec(const QCString &ch, const QCString &msg, 114 QCopRec(const QCString &ch, const QCString &msg,
114 const QByteArray &d) : 115 const QByteArray &d) :
115 channel(ch), message(msg), data(d) { } 116 channel(ch), message(msg), data(d) { }
116 117
@@ -1293,48 +1294,69 @@ void QPEApplication::internalSetStyle( const QString &style )
1293 } 1294 }
1294#else 1295#else
1295 if ( style == "Windows" ) { 1296 if ( style == "Windows" ) {
1296 setStyle( new QWindowsStyle ); 1297 setStyle( new QWindowsStyle );
1297 } else if ( style == "QPE" ) { 1298 } else if ( style == "QPE" ) {
1298 setStyle( new QPEStyle ); 1299 setStyle( new QPEStyle );
1299 } else if ( style == "Light" ) { 1300 } else if ( style == "Light" ) {
1300 setStyle( new LightStyle ); 1301 setStyle( new LightStyle );
1301 } 1302 }
1302#ifndef QT_NO_STYLE_PLATINUM 1303#ifndef QT_NO_STYLE_PLATINUM
1303 else if ( style == "Platinum" ) { 1304 else if ( style == "Platinum" ) {
1304 setStyle( new QPlatinumStyle ); 1305 setStyle( new QPlatinumStyle );
1305 } 1306 }
1306#endif 1307#endif
1307#ifndef QT_NO_STYLE_MOTIF 1308#ifndef QT_NO_STYLE_MOTIF
1308 else if ( style == "Motif" ) { 1309 else if ( style == "Motif" ) {
1309 setStyle( new QMotifStyle ); 1310 setStyle( new QMotifStyle );
1310 } 1311 }
1311#endif 1312#endif
1312#ifndef QT_NO_STYLE_MOTIFPLUS 1313#ifndef QT_NO_STYLE_MOTIFPLUS
1313 else if ( style == "MotifPlus" ) { 1314 else if ( style == "MotifPlus" ) {
1314 setStyle( new QMotifPlusStyle ); 1315 setStyle( new QMotifPlusStyle );
1315 } 1316 }
1316#endif 1317#endif
1318
1319 // HACK for Qt2 only
1320 else if ( style == "Liquid" ) {
1321 static void *lib = 0;
1322 QStyle *sty = 0;
1323
1324
1325 if ( !lib ) {
1326 QString path = QPEApplication::qpeDir() + "/plugins/styles/" + "libliquid.so";
1327 lib = ::dlopen ( path. local8Bit ( ), RTLD_NOW | RTLD_GLOBAL );
1328 }
1329 if ( lib ) {
1330 void *sym = ::dlsym ( lib, "allocate" );
1331
1332 if ( sym )
1333 sty = ((QStyle * (*) ( )) sym ) ( );
1334 }
1335 if ( sty )
1336 setStyle ( sty );
1337 }
1338 // HACK for Qt2 only
1317#endif 1339#endif
1318} 1340}
1319 1341
1320/*! 1342/*!
1321 \internal 1343 \internal
1322*/ 1344*/
1323void QPEApplication::prepareForTermination(bool willrestart) 1345void QPEApplication::prepareForTermination(bool willrestart)
1324{ 1346{
1325 if ( willrestart ) { 1347 if ( willrestart ) {
1326 // Draw a big wait icon, the image can be altered in later revisions 1348 // Draw a big wait icon, the image can be altered in later revisions
1327// QWidget *d = QApplication::desktop(); 1349// QWidget *d = QApplication::desktop();
1328 QImage img = Resource::loadImage( "launcher/new_wait" ); 1350 QImage img = Resource::loadImage( "launcher/new_wait" );
1329 QPixmap pix; 1351 QPixmap pix;
1330 pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height())); 1352 pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height()));
1331 QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize | 1353 QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize |
1332 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1354 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1333 lblWait->setPixmap( pix ); 1355 lblWait->setPixmap( pix );
1334 lblWait->setAlignment( QWidget::AlignCenter ); 1356 lblWait->setAlignment( QWidget::AlignCenter );
1335 lblWait->show(); 1357 lblWait->show();
1336 lblWait->showMaximized(); 1358 lblWait->showMaximized();
1337 } 1359 }
1338#ifndef SINGLE_APP 1360#ifndef SINGLE_APP
1339 { QCopEnvelope envelope("QPE/System", "forceQuit()"); } 1361 { QCopEnvelope envelope("QPE/System", "forceQuit()"); }
1340 processEvents(); // ensure the message goes out. 1362 processEvents(); // ensure the message goes out.