summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-22 13:00:46 (UTC)
committer llornkcor <llornkcor>2002-05-22 13:00:46 (UTC)
commit492c5c3c07a192b3a00e76f227e40d98459db1aa (patch) (unidiff)
tree0c07a9c56b528d693ff14b4fc3e4cba4407a682b
parentd3466b66bd9189219b6dff7fd248169b5725a1b8 (diff)
downloadopie-492c5c3c07a192b3a00e76f227e40d98459db1aa.zip
opie-492c5c3c07a192b3a00e76f227e40d98459db1aa.tar.gz
opie-492c5c3c07a192b3a00e76f227e40d98459db1aa.tar.bz2
added #include custom-ipaq.h for ipaq builds for ipaq sounds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp3
-rw-r--r--core/launcher/taskbar.cpp92
2 files changed, 51 insertions, 44 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 85ba160..649862b 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -36,16 +36,19 @@
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/power.h> 37#include <qpe/power.h>
38#include <qpe/timeconversion.h> 38#include <qpe/timeconversion.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/global.h> 40#include <qpe/global.h>
41#ifdef QT_QWS_CUSTOM 41#ifdef QT_QWS_CUSTOM
42#include "qpe/custom.h" 42#include "qpe/custom.h"
43#endif 43#endif
44#if defined(QT_QWS_IPAQ)
45#include "qpe/custom-ipaq.h"
46#endif
44 47
45#include <qgfx_qws.h> 48#include <qgfx_qws.h>
46#include <qmainwindow.h> 49#include <qmainwindow.h>
47#include <qmessagebox.h> 50#include <qmessagebox.h>
48#include <qtimer.h> 51#include <qtimer.h>
49#include <qwindowsystem_qws.h> 52#include <qwindowsystem_qws.h>
50 53
51#include <qvaluelist.h> 54#include <qvaluelist.h>
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
@@ -30,41 +30,45 @@
30#include "desktop.h" 30#include "desktop.h"
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35#ifdef QT_QWS_CUSTOM 35#ifdef QT_QWS_CUSTOM
36#include <qpe/custom.h> 36#include <qpe/custom.h>
37#endif 37#endif
38#if defined(QT_QWS_IPAQ)
39#include "qpe/custom-ipaq.h"
40#endif
41
38 42
39#include <qlabel.h> 43#include <qlabel.h>
40#include <qlayout.h> 44#include <qlayout.h>
41#include <qtimer.h> 45#include <qtimer.h>
42#include <qwindowsystem_qws.h> 46#include <qwindowsystem_qws.h>
43#include <qwidgetstack.h> 47#include <qwidgetstack.h>
44 48
45#if defined( Q_WS_QWS ) 49#if defined( Q_WS_QWS )
46#include <qwsdisplay_qws.h> 50#include <qwsdisplay_qws.h>
47#include <qgfx_qws.h> 51#include <qgfx_qws.h>
48#endif 52#endif
49 53
50 54
51#define FACTORY(T) \ 55#define FACTORY(T) \
52 static QWidget *new##T( bool maximized ) { \ 56 static QWidget *new##T( bool maximized ) { \
53 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
54 if ( maximized ) { \ 58 if ( maximized ) { \
55 if ( qApp->desktop()->width() <= 350 ) { \ 59 if ( qApp->desktop()->width() <= 350 ) { \
56 w->showMaximized(); \ 60 w->showMaximized(); \
57 } else { \ 61 } else { \
58 w->resize( QSize( 300, 300 ) ); \ 62 w->resize( QSize( 300, 300 ) ); \
59 } \ 63 } \
60 } \ 64 } \
61 w->show(); \ 65 w->show(); \
62 return w; \ 66 return w; \
63 } 67 }
64 68
65 69
66#ifdef SINGLE_APP 70#ifdef SINGLE_APP
67#define APP(a,b,c,d) FACTORY(b) 71#define APP(a,b,c,d) FACTORY(b)
68#include "../launcher/apps.h" 72#include "../launcher/apps.h"
69#undef APP 73#undef APP
70#endif // SINGLE_APP 74#endif // SINGLE_APP
@@ -73,64 +77,64 @@ static Global::Command builtins[] = {
73 77
74#ifdef SINGLE_APP 78#ifdef SINGLE_APP
75#define APP(a,b,c,d) { a, new##b, c }, 79#define APP(a,b,c,d) { a, new##b, c },
76#include "../launcher/apps.h" 80#include "../launcher/apps.h"
77#undef APP 81#undef APP
78#endif 82#endif
79 83
80#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 84#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
81 { "calibrate", TaskBar::calibrate,1, 0 }, 85 { "calibrate", TaskBar::calibrate, 1, 0 },
82#endif 86#endif
83#if !defined(QT_QWS_CASSIOPEIA) 87#if !defined(QT_QWS_CASSIOPEIA)
84 { "shutdown", Global::shutdown, 1, 0 }, 88 { "shutdown", Global::shutdown, 1, 0 },
85 // { "run", run, 1, 0 }, 89// { "run", run, 1, 0 },
86#endif 90#endif
87 91
88 { 0, TaskBar::calibrate,0, 0 }, 92 { 0, TaskBar::calibrate, 0, 0 },
89}; 93};
90 94
91static bool initNumLock() 95static bool initNumLock()
92{ 96{
93#ifdef QPE_INITIAL_NUMLOCK_STATE 97#ifdef QPE_INITIAL_NUMLOCK_STATE
94 QPE_INITIAL_NUMLOCK_STATE 98 QPE_INITIAL_NUMLOCK_STATE
95#endif 99#endif
96 return FALSE; 100 return FALSE;
97} 101}
98 102
99class LockKeyState : public QWidget 103class LockKeyState : public QWidget
100{ 104{
101public: 105public:
102 LockKeyState( QWidget *parent ) : 106 LockKeyState( QWidget *parent ) :
103 QWidget(parent), 107 QWidget(parent),
104 nl(initNumLock()), cl(FALSE) 108 nl(initNumLock()), cl(FALSE)
105 { 109 {
106 nl_pm = Resource::loadPixmap("numlock"); 110 nl_pm = Resource::loadPixmap("numlock");
107 cl_pm = Resource::loadPixmap("capslock"); 111 cl_pm = Resource::loadPixmap("capslock");
108 } 112 }
109 QSize sizeHint() const 113 QSize sizeHint() const
110 { 114 {
111 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 115 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
112 } 116 }
113 void toggleNumLockState() 117 void toggleNumLockState()
114 { 118 {
115 nl = !nl; repaint(); 119 nl = !nl; repaint();
116 } 120 }
117 void toggleCapsLockState() 121 void toggleCapsLockState()
118 { 122 {
119 cl = !cl; repaint(); 123 cl = !cl; repaint();
120 } 124 }
121 void paintEvent( QPaintEvent * ) 125 void paintEvent( QPaintEvent * )
122 { 126 {
123 int y = (height()-sizeHint().height())/2; 127 int y = (height()-sizeHint().height())/2;
124 QPainter p(this); 128 QPainter p(this);
125 if ( nl ) 129 if ( nl )
126 p.drawPixmap(1,y,nl_pm); 130 p.drawPixmap(1,y,nl_pm);
127 if ( cl ) 131 if ( cl )
128 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
129 } 133 }
130private: 134private:
131 QPixmap nl_pm, cl_pm; 135 QPixmap nl_pm, cl_pm;
132 bool nl, cl; 136 bool nl, cl;
133}; 137};
134 138
135TaskBar::~TaskBar() 139TaskBar::~TaskBar()
136{ 140{
@@ -140,17 +144,17 @@ TaskBar::~TaskBar()
140TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
141{ 145{
142 Global::setBuiltinCommands(builtins); 146 Global::setBuiltinCommands(builtins);
143 147
144 sm = new StartMenu( this ); 148 sm = new StartMenu( this );
145 149
146 inputMethods = new InputMethods( this ); 150 inputMethods = new InputMethods( this );
147 connect( inputMethods, SIGNAL(inputToggled(bool)), 151 connect( inputMethods, SIGNAL(inputToggled(bool)),
148 this, SLOT(calcMaxWindowRect()) ); 152 this, SLOT(calcMaxWindowRect()) );
149 //new QuickLauncher( this ); 153 //new QuickLauncher( this );
150 154
151 stack = new QWidgetStack( this ); 155 stack = new QWidgetStack( this );
152 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
153 label = new QLabel(stack); 157 label = new QLabel(stack);
154 158
155 mru = new MRUList( stack ); 159 mru = new MRUList( stack );
156 stack->raiseWidget( mru ); 160 stack->raiseWidget( mru );
@@ -166,32 +170,32 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn
166#else 170#else
167 lockState = 0; 171 lockState = 0;
168#endif 172#endif
169 173
170#if defined(Q_WS_QWS) 174#if defined(Q_WS_QWS)
171#if !defined(QT_NO_COP) 175#if !defined(QT_NO_COP)
172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 176 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 177 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
174 this, SLOT(receive(const QCString&, const QByteArray&)) ); 178 this, SLOT(receive(const QCString&, const QByteArray&)) );
175#endif 179#endif
176#endif 180#endif
177 waitTimer = new QTimer( this ); 181 waitTimer = new QTimer( this );
178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 182 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
179 clearer = new QTimer( this ); 183 clearer = new QTimer( this );
180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 184 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 185 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
182} 186}
183 187
184void TaskBar::setStatusMessage( const QString &text ) 188void TaskBar::setStatusMessage( const QString &text )
185{ 189{
186 label->setText( text ); 190 label->setText( text );
187 stack->raiseWidget( label ); 191 stack->raiseWidget( label );
188 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 192 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
189 sysTray->hide(); 193 sysTray->hide();
190 clearer->start( 3000 ); 194 clearer->start( 3000 );
191} 195}
192 196
193void TaskBar::clearStatusBar() 197void TaskBar::clearStatusBar()
194{ 198{
195 label->clear(); 199 label->clear();
196 stack->raiseWidget( mru ); 200 stack->raiseWidget( mru );
197} 201}
@@ -230,54 +234,54 @@ void TaskBar::styleChange( QStyle &s )
230 234
231void TaskBar::calcMaxWindowRect() 235void TaskBar::calcMaxWindowRect()
232{ 236{
233#ifdef Q_WS_QWS 237#ifdef Q_WS_QWS
234 QRect wr; 238 QRect wr;
235 int displayWidth = qApp->desktop()->width(); 239 int displayWidth = qApp->desktop()->width();
236 QRect ir = inputMethods->inputRect(); 240 QRect ir = inputMethods->inputRect();
237 if ( ir.isValid() ) { 241 if ( ir.isValid() ) {
238 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 242 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
239 } else { 243 } else {
240 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 244 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
241 } 245 }
242 246
243#if QT_VERSION < 300 247#if QT_VERSION < 300
244 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 248 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
245 QSize(qt_screen->width(),qt_screen->height())) 249 QSize(qt_screen->width(),qt_screen->height()))
246 ); 250 );
247#else 251#else
248 QWSServer::setMaxWindowRect( wr ); 252 QWSServer::setMaxWindowRect( wr );
249#endif 253#endif
250#endif 254#endif
251} 255}
252 256
253void TaskBar::receive( const QCString &msg, const QByteArray &data ) 257void TaskBar::receive( const QCString &msg, const QByteArray &data )
254{ 258{
255 QDataStream stream( data, IO_ReadOnly ); 259 QDataStream stream( data, IO_ReadOnly );
256 if ( msg == "message(QString)" ) { 260 if ( msg == "message(QString)" ) {
257 QString text; 261 QString text;
258 stream >> text; 262 stream >> text;
259 setStatusMessage( text ); 263 setStatusMessage( text );
260 } else if ( msg == "hideInputMethod()" ) { 264 } else if ( msg == "hideInputMethod()" ) {
261 inputMethods->hideInputMethod(); 265 inputMethods->hideInputMethod();
262 } else if ( msg == "showInputMethod()" ) { 266 } else if ( msg == "showInputMethod()" ) {
263 inputMethods->showInputMethod(); 267 inputMethods->showInputMethod();
264 } else if ( msg == "reloadInputMethods()" ) { 268 } else if ( msg == "reloadInputMethods()" ) {
265 inputMethods->loadInputMethods(); 269 inputMethods->loadInputMethods();
266 } else if ( msg == "reloadApplets()" ) { 270 } else if ( msg == "reloadApplets()" ) {
267 sysTray->loadApplets(); 271 sysTray->loadApplets();
268 } else if ( msg == "soundAlarm()" ) { 272 } else if ( msg == "soundAlarm()" ) {
269 Desktop::soundAlarm(); 273 Desktop::soundAlarm();
270 } 274 }
271#ifdef CUSTOM_LEDS 275#ifdef CUSTOM_LEDS
272 else if ( msg == "setLed(int,bool)" ) { 276 else if ( msg == "setLed(int,bool)" ) {
273 int led, status; 277 int led, status;
274 stream >> led >> status; 278 stream >> led >> status;
275 CUSTOM_LEDS( led, status ); 279 CUSTOM_LEDS( led, status );
276 } 280 }
277#endif 281#endif
278} 282}
279 283
280QWidget *TaskBar::calibrate(bool) 284QWidget *TaskBar::calibrate(bool)
281{ 285{
282#ifdef Q_WS_QWS 286#ifdef Q_WS_QWS
283 Calibrate *c = new Calibrate; 287 Calibrate *c = new Calibrate;
@@ -296,19 +300,19 @@ void TaskBar::toggleNumLockState()
296void TaskBar::toggleCapsLockState() 300void TaskBar::toggleCapsLockState()
297{ 301{
298 if ( lockState ) lockState->toggleCapsLockState(); 302 if ( lockState ) lockState->toggleCapsLockState();
299} 303}
300 304
301void TaskBar::toggleSymbolInput() 305void TaskBar::toggleSymbolInput()
302{ 306{
303 if ( inputMethods->currentShown() == "Unicode" ) { 307 if ( inputMethods->currentShown() == "Unicode" ) {
304 inputMethods->hideInputMethod(); 308 inputMethods->hideInputMethod();
305 } else { 309 } else {
306 inputMethods->showInputMethod("Unicode"); 310 inputMethods->showInputMethod("Unicode");
307 } 311 }
308} 312}
309 313
310bool TaskBar::recoverMemory() 314bool TaskBar::recoverMemory()
311{ 315{
312 return mru->quitOldApps(); 316 return mru->quitOldApps();
313} 317}
314 318