-rw-r--r-- | core/launcher/taskbar.cpp | 92 |
1 files changed, 48 insertions, 44 deletions
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 18d28cb..54777c6 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -35,6 +35,10 @@ #ifdef QT_QWS_CUSTOM #include <qpe/custom.h> #endif +#if defined(QT_QWS_IPAQ) +#include "qpe/custom-ipaq.h" +#endif + #include <qlabel.h> #include <qlayout.h> @@ -50,16 +54,16 @@ #define FACTORY(T) \ static QWidget *new##T( bool maximized ) { \ - QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ - if ( maximized ) { \ - if ( qApp->desktop()->width() <= 350 ) { \ - w->showMaximized(); \ - } else { \ - w->resize( QSize( 300, 300 ) ); \ - } \ - } \ - w->show(); \ - return w; \ + QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ + if ( maximized ) { \ + if ( qApp->desktop()->width() <= 350 ) { \ + w->showMaximized(); \ + } else { \ + w->resize( QSize( 300, 300 ) ); \ + } \ + } \ + w->show(); \ + return w; \ } @@ -78,14 +82,14 @@ static Global::Command builtins[] = { #endif #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) - { "calibrate", TaskBar::calibrate, 1, 0 }, + { "calibrate", TaskBar::calibrate, 1, 0 }, #endif #if !defined(QT_QWS_CASSIOPEIA) - { "shutdown", Global::shutdown, 1, 0 }, -// { "run", run, 1, 0 }, + { "shutdown", Global::shutdown, 1, 0 }, +// { "run", run, 1, 0 }, #endif - { 0, TaskBar::calibrate, 0, 0 }, + { 0, TaskBar::calibrate, 0, 0 }, }; static bool initNumLock() @@ -100,32 +104,32 @@ class LockKeyState : public QWidget { public: LockKeyState( QWidget *parent ) : - QWidget(parent), - nl(initNumLock()), cl(FALSE) + QWidget(parent), + nl(initNumLock()), cl(FALSE) { - nl_pm = Resource::loadPixmap("numlock"); - cl_pm = Resource::loadPixmap("capslock"); + nl_pm = Resource::loadPixmap("numlock"); + cl_pm = Resource::loadPixmap("capslock"); } QSize sizeHint() const { - return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); + return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); } void toggleNumLockState() { - nl = !nl; repaint(); + nl = !nl; repaint(); } void toggleCapsLockState() { - cl = !cl; repaint(); + cl = !cl; repaint(); } void paintEvent( QPaintEvent * ) { - int y = (height()-sizeHint().height())/2; - QPainter p(this); - if ( nl ) - p.drawPixmap(1,y,nl_pm); - if ( cl ) - p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); + int y = (height()-sizeHint().height())/2; + QPainter p(this); + if ( nl ) + p.drawPixmap(1,y,nl_pm); + if ( cl ) + p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); } private: QPixmap nl_pm, cl_pm; @@ -145,7 +149,7 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn inputMethods = new InputMethods( this ); connect( inputMethods, SIGNAL(inputToggled(bool)), - this, SLOT(calcMaxWindowRect()) ); + this, SLOT(calcMaxWindowRect()) ); //new QuickLauncher( this ); stack = new QWidgetStack( this ); @@ -171,7 +175,7 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); + this, SLOT(receive(const QCString&, const QByteArray&)) ); #endif #endif waitTimer = new QTimer( this ); @@ -186,7 +190,7 @@ void TaskBar::setStatusMessage( const QString &text ) label->setText( text ); stack->raiseWidget( label ); if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) - sysTray->hide(); + sysTray->hide(); clearer->start( 3000 ); } @@ -235,15 +239,15 @@ void TaskBar::calcMaxWindowRect() int displayWidth = qApp->desktop()->width(); QRect ir = inputMethods->inputRect(); if ( ir.isValid() ) { - wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); + wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); } else { - wr.setCoords( 0, 0, displayWidth-1, y()-1 ); + wr.setCoords( 0, 0, displayWidth-1, y()-1 ); } #if QT_VERSION < 300 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, - QSize(qt_screen->width(),qt_screen->height())) - ); + QSize(qt_screen->width(),qt_screen->height())) + ); #else QWSServer::setMaxWindowRect( wr ); #endif @@ -258,21 +262,21 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) stream >> text; setStatusMessage( text ); } else if ( msg == "hideInputMethod()" ) { - inputMethods->hideInputMethod(); + inputMethods->hideInputMethod(); } else if ( msg == "showInputMethod()" ) { - inputMethods->showInputMethod(); + inputMethods->showInputMethod(); } else if ( msg == "reloadInputMethods()" ) { - inputMethods->loadInputMethods(); + inputMethods->loadInputMethods(); } else if ( msg == "reloadApplets()" ) { - sysTray->loadApplets(); + sysTray->loadApplets(); } else if ( msg == "soundAlarm()" ) { - Desktop::soundAlarm(); + Desktop::soundAlarm(); } #ifdef CUSTOM_LEDS else if ( msg == "setLed(int,bool)" ) { - int led, status; - stream >> led >> status; - CUSTOM_LEDS( led, status ); + int led, status; + stream >> led >> status; + CUSTOM_LEDS( led, status ); } #endif } @@ -301,9 +305,9 @@ void TaskBar::toggleCapsLockState() void TaskBar::toggleSymbolInput() { if ( inputMethods->currentShown() == "Unicode" ) { - inputMethods->hideInputMethod(); + inputMethods->hideInputMethod(); } else { - inputMethods->showInputMethod("Unicode"); + inputMethods->showInputMethod("Unicode"); } } |