summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Side-by-side diff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp61
1 files changed, 45 insertions, 16 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 76d62ef..6e2db7c 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -51,78 +51,80 @@
//#include <linux/fb.h> better not rely on kernel headers in userspace ...
/* VESA Blanking Levels */
#define VESA_NO_BLANKING 0
#define VESA_VSYNC_SUSPEND 1
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
#define FBIOBLANK 0x4611
#include <qsignal.h>
#include "qpeapplication.h"
#include "qpestyle.h"
#if QT_VERSION >= 300
#include <qstylefactory.h>
#else
#include <qplatinumstyle.h>
#include <qwindowsstyle.h>
#include <qmotifstyle.h>
#include <qmotifplusstyle.h>
#include "lightstyle.h"
+
+#include <qpe/qlibrary.h>
+#include <dlfcn.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) { }
@@ -1307,65 +1309,92 @@ void QPEApplication::internalSetStyle( const QString &style )
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;
+ else {
+ // style == "Liquid Style (libliquid.so)" (or "Windows XP (libxp.so)"
+
+ int p2 = style. findRev ( ']' );
+ int p1 = style. findRev ( '[' );
+ QString style2;
-
- 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 (( p1 > 0 ) && ( p2 > 0 ) && (( p1 + 1 ) < p2 ))
+ style2 = "lib" + style. mid ( p1 + 1, p2 - p1 - 1 ). lower ( ) + ".so";
+ else
+ style2 = "lib" + style. lower ( ) + ".so";
- if ( sym )
- sty = ((QStyle * (*) ( )) sym ) ( );
- }
- if ( sty )
- setStyle ( sty );
+ // static QLibrary *currentlib = 0;
+ static void *currentlib = 0;
+
+ QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/" + style2;
+
+ do { // try/catch simulation
+ // QLibrary *lib = new QLibrary ( path, QLibrary::Immediately );
+ void *lib = ::dlopen ( path. local8Bit ( ), RTLD_NOW | RTLD_GLOBAL );
+
+ if ( lib ) {
+ //QStyle * (*fpa) ( ) = (QStyle * (*) ( )) lib-> resolve ( "allocate" );
+ QStyle * (*fpa) ( ) = (QStyle * (*) ( )) ::dlsym ( lib, "allocate" );
+
+ if ( fpa ) {
+ QStyle *sty = ( *fpa ) ( );
+
+ if ( sty ) {
+ setStyle ( sty );
+
+ if ( currentlib ) {
+ //delete currentlib;
+ ::dlclose ( currentlib );
+ }
+ currentlib = lib;
+
+ break;
+ }
+ }
+ //delete lib;
+ ::dlclose ( lib );
+ }
+ } while ( false );
}
// 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