summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 22:48:46 (UTC)
committer sandman <sandman>2002-09-30 22:48:46 (UTC)
commit6fdaab436d4fa72b3de06a1a9cf9be0bd964677a (patch) (unidiff)
tree7e7fb0fdbc5d4c4e2b2da9be790a764b8f45e0a5
parent21cacdafcef980a5ef712de6432750128a61ccdb (diff)
downloadopie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.zip
opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.gz
opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.bz2
Changes to use the new ODevice API
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp107
-rw-r--r--core/launcher/taskbar.cpp10
2 files changed, 16 insertions, 101 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 490af39..073e19a 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -44,8 +44,9 @@
44#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 44#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
45#include "../calibrate/calibrate.h" 45#include "../calibrate/calibrate.h"
46#endif 46#endif
47 47
48using namespace Opie;
48 49
49void initEnvironment() 50void initEnvironment()
50{ 51{
51 Config config("locale"); 52 Config config("locale");
@@ -64,108 +65,11 @@ void initEnvironment()
64 if ( !lang.isNull() ) 65 if ( !lang.isNull() )
65 setenv( "LANG", lang, 1 ); 66 setenv( "LANG", lang, 1 );
66} 67}
67 68
68static void initBacklight()
69{
70 QCopEnvelope e("QPE/System", "setBacklight(int)" );
71 e << -3; // Forced on
72}
73
74
75class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
76{
77public:
78 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
79 {
80 bool doinst = false;
81
82 m_model = ODevice::inst ( )-> model ( );
83 m_power_timer = 0;
84
85 switch ( m_model ) {
86 case OMODEL_iPAQ_H31xx:
87 case OMODEL_iPAQ_H36xx:
88 case OMODEL_iPAQ_H37xx:
89 case OMODEL_iPAQ_H38xx: doinst = true;
90 break;
91 default : break;
92 }
93 if ( doinst )
94 QWSServer::setKeyboardFilter ( this );
95 }
96
97 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
98 {
99 bool kill = false;
100
101 // Rotate cursor keys 180°
102 switch ( m_model ) {
103 case OMODEL_iPAQ_H31xx:
104 case OMODEL_iPAQ_H38xx: {
105 int newkeycode = keycode;
106
107 switch ( keycode ) {
108 case Key_Left : newkeycode = Key_Right; break;
109 case Key_Right: newkeycode = Key_Left; break;
110 case Key_Up : newkeycode = Key_Down; break;
111 case Key_Down : newkeycode = Key_Up; break;
112 }
113 if ( newkeycode != keycode ) {
114 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
115 kill = true;
116 }
117 break;
118 }
119 default: break;
120 }
121
122 // map Power Button short/long press to F34/F35
123 switch ( m_model ) {
124 case OMODEL_iPAQ_H31xx:
125 case OMODEL_iPAQ_H36xx:
126 case OMODEL_iPAQ_H37xx:
127 case OMODEL_iPAQ_H38xx: {
128 if ( keycode == Key_SysReq ) {
129 if ( isPress ) {
130 if ( m_power_timer )
131 killTimer ( m_power_timer );
132 m_power_timer = startTimer ( 500 );
133 }
134 else if ( m_power_timer ) {
135 killTimer ( m_power_timer );
136 m_power_timer = 0;
137 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
138 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
139 }
140 kill = true;
141 }
142 break;
143 }
144 default: break;
145 }
146 return kill;
147 }
148
149 virtual void timerEvent ( QTimerEvent * )
150 {
151 killTimer ( m_power_timer );
152 m_power_timer = 0;
153 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
154 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
155 }
156
157private:
158 OModel m_model;
159 int m_power_timer;
160};
161
162
163 69
164int initApplication( int argc, char ** argv ) 70int initApplication( int argc, char ** argv )
165{ 71{
166 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE );
167
168 initEnvironment(); 72 initEnvironment();
169 73
170#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 74#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
171 setenv( "QWS_SIZE", "240x320", 0 ); 75 setenv( "QWS_SIZE", "240x320", 0 );
@@ -174,11 +78,14 @@ int initApplication( int argc, char ** argv )
174 //Don't flicker at startup: 78 //Don't flicker at startup:
175 QWSServer::setDesktopBackground( QImage() ); 79 QWSServer::setDesktopBackground( QImage() );
176 DesktopApplication a( argc, argv, QApplication::GuiServer ); 80 DesktopApplication a( argc, argv, QApplication::GuiServer );
177 81
178 (void) new ModelKeyFilter ( ); 82 ODevice::inst ( )-> setSoftSuspend ( true );
179 83
180 initBacklight(); 84 { // init backlight
85 QCopEnvelope e("QPE/System", "setBacklight(int)" );
86 e << -3; // Forced on
87 }
181 88
182 AlarmServer::initialize(); 89 AlarmServer::initialize();
183 90
184 Desktop *d = new Desktop(); 91 Desktop *d = new Desktop();
@@ -211,9 +118,9 @@ int initApplication( int argc, char ** argv )
211 int rv = a.exec(); 118 int rv = a.exec();
212 119
213 delete d; 120 delete d;
214 121
215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); 122 ODevice::inst ( )-> setSoftSuspend ( false );
216 123
217 return rv; 124 return rv;
218} 125}
219 126
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 1feae4a..46bcdb3 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -50,8 +50,10 @@
50#include <qgfx_qws.h> 50#include <qgfx_qws.h>
51#endif 51#endif
52 52
53 53
54using namespace Opie;
55
54#define FACTORY(T) \ 56#define FACTORY(T) \
55 static QWidget *new##T( bool maximized ) { \ 57 static QWidget *new##T( bool maximized ) { \
56 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 58 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
57 if ( maximized ) { \ 59 if ( maximized ) { \
@@ -280,9 +282,15 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
280 else if ( msg == "setLed(int,bool)" ) { 282 else if ( msg == "setLed(int,bool)" ) {
281 int led, status; 283 int led, status;
282 stream >> led >> status; 284 stream >> led >> status;
283 285
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 286 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
287 if ( ll. count ( )){
288 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
289 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
290
291 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
292 }
285 } 293 }
286} 294}
287 295
288QWidget *TaskBar::calibrate(bool) 296QWidget *TaskBar::calibrate(bool)