author | sandman <sandman> | 2002-06-21 01:23:55 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-21 01:23:55 (UTC) |
commit | 3f1129f79e945135828191679559da70cf4ac6fa (patch) (side-by-side diff) | |
tree | ac5a2e4698a93a201c6bdb5bcf377e1e429c32ed | |
parent | 2a7407325b1607c9ee40ed3558c8549672a36ad4 (diff) | |
download | opie-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
-rw-r--r-- | library/qpeapplication.cpp | 22 |
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 @@ -61,64 +61,65 @@ #include <qmotifstyle.h> #include <qmotifplusstyle.h> #include "lightstyle.h" #endif #include "global.h" #include "resource.h" #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include "qutfcodec.h" #endif #include "config.h" #include "network.h" #include "fontmanager.h" #include "fontdatabase.h" #include "power.h" #include "alarmserver.h" #include "applnk.h" #include "qpemenubar.h" #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/soundcard.h> // for setBacklight() #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) #include <linux/fb.h> #include <sys/types.h> #include <sys/stat.h> #endif #include <stdlib.h> +#include <dlfcn.h> // for Liquid HACK class QPEApplicationData { public: QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE), kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE), forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0), keep_running(TRUE) { qcopq.setAutoDelete(TRUE); } int presstimer; QWidget* presswidget; QPoint presspos; bool rightpressed; int kbgrabber; bool kbregrab; bool notbusysent; QString appName; struct QCopRec { QCopRec(const QCString &ch, const QCString &msg, const QByteArray &d) : channel(ch), message(msg), data(d) { } QCString channel; QCString message; QByteArray data; }; bool preloaded; bool forceshow; bool nomaximize; QWidget* qpe_main_widget; @@ -1285,64 +1286,85 @@ bool QPEApplication::keepRunning() const void QPEApplication::internalSetStyle( const QString &style ) { #if QT_VERSION >= 300 if ( style == "QPE" ) { setStyle( new QPEStyle ); } else { QStyle *s = QStyleFactory::create(style); if ( s ) setStyle(s); } #else if ( style == "Windows" ) { setStyle( new QWindowsStyle ); } else if ( style == "QPE" ) { setStyle( new QPEStyle ); } else if ( style == "Light" ) { setStyle( new LightStyle ); } #ifndef QT_NO_STYLE_PLATINUM else if ( style == "Platinum" ) { setStyle( new QPlatinumStyle ); } #endif #ifndef QT_NO_STYLE_MOTIF else if ( style == "Motif" ) { setStyle( new QMotifStyle ); } #endif #ifndef QT_NO_STYLE_MOTIFPLUS else if ( style == "MotifPlus" ) { setStyle( new QMotifPlusStyle ); } #endif + + // HACK for Qt2 only + else if ( style == "Liquid" ) { + static void *lib = 0; + QStyle *sty = 0; + + + if ( !lib ) { + QString path = QPEApplication::qpeDir() + "/plugins/styles/" + "libliquid.so"; + lib = ::dlopen ( path. local8Bit ( ), RTLD_NOW | RTLD_GLOBAL ); + } + if ( lib ) { + void *sym = ::dlsym ( lib, "allocate" ); + + if ( sym ) + sty = ((QStyle * (*) ( )) sym ) ( ); + } + if ( sty ) + setStyle ( sty ); + } + // HACK for Qt2 only #endif } /*! \internal */ void QPEApplication::prepareForTermination(bool willrestart) { if ( willrestart ) { // Draw a big wait icon, the image can be altered in later revisions // QWidget *d = QApplication::desktop(); QImage img = Resource::loadImage( "launcher/new_wait" ); QPixmap pix; pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height())); QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); lblWait->setPixmap( pix ); lblWait->setAlignment( QWidget::AlignCenter ); lblWait->show(); lblWait->showMaximized(); } #ifndef SINGLE_APP { QCopEnvelope envelope("QPE/System", "forceQuit()"); } processEvents(); // ensure the message goes out. sleep(1); // You have 1 second to comply. #endif } /*! \internal */ void QPEApplication::shutdown() |