author | sandman <sandman> | 2002-09-30 22:48:46 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-30 22:48:46 (UTC) |
commit | 6fdaab436d4fa72b3de06a1a9cf9be0bd964677a (patch) (unidiff) | |
tree | 7e7fb0fdbc5d4c4e2b2da9be790a764b8f45e0a5 | |
parent | 21cacdafcef980a5ef712de6432750128a61ccdb (diff) | |
download | opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.zip opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.gz opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.bz2 |
Changes to use the new ODevice API
-rw-r--r-- | core/launcher/main.cpp | 107 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 10 |
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 | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "../calibrate/calibrate.h" | 45 | #include "../calibrate/calibrate.h" |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | using namespace Opie; | ||
48 | 49 | ||
49 | void initEnvironment() | 50 | void initEnvironment() |
50 | { | 51 | { |
@@ -65,106 +66,9 @@ void initEnvironment() | |||
65 | setenv( "LANG", lang, 1 ); | 66 | setenv( "LANG", lang, 1 ); |
66 | } | 67 | } |
67 | 68 | ||
68 | static void initBacklight() | ||
69 | { | ||
70 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | ||
71 | e << -3; // Forced on | ||
72 | } | ||
73 | |||
74 | |||
75 | class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter | ||
76 | { | ||
77 | public: | ||
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 | |||
157 | private: | ||
158 | OModel m_model; | ||
159 | int m_power_timer; | ||
160 | }; | ||
161 | |||
162 | |||
163 | 69 | ||
164 | int initApplication( int argc, char ** argv ) | 70 | int 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) |
@@ -175,9 +79,12 @@ int initApplication( int argc, char ** argv ) | |||
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 | ||
@@ -212,7 +119,7 @@ int initApplication( int argc, char ** argv ) | |||
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 | } |
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 | |||
@@ -51,6 +51,8 @@ | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | 53 | ||
54 | using 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 ); \ |
@@ -281,7 +283,13 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
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 | ||