author | mickeyl <mickeyl> | 2003-05-30 20:05:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-30 20:05:49 (UTC) |
commit | 4e9f13ddaea55f33dc5d9de6f2bb1b64cdc3d11f (patch) (unidiff) | |
tree | d22bbfde34ba34d506083316eb10f8e1d5d1697d | |
parent | 832b2e4a824254f16e1d89f8b6f4367068719cf8 (diff) | |
download | opie-4e9f13ddaea55f33dc5d9de6f2bb1b64cdc3d11f.zip opie-4e9f13ddaea55f33dc5d9de6f2bb1b64cdc3d11f.tar.gz opie-4e9f13ddaea55f33dc5d9de6f2bb1b64cdc3d11f.tar.bz2 |
slight fix to simpad buttons. opie-button-settings really has to be adapted
to support the larger screen size
-rw-r--r-- | libopie/odevice.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 01932c9..f0429d4 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -94,419 +94,421 @@ public: | |||
94 | virtual bool setLedState ( OLed led, OLedState st ); | 94 | virtual bool setLedState ( OLed led, OLedState st ); |
95 | 95 | ||
96 | virtual bool hasLightSensor ( ) const; | 96 | virtual bool hasLightSensor ( ) const; |
97 | virtual int readLightSensor ( ); | 97 | virtual int readLightSensor ( ); |
98 | virtual int lightSensorResolution ( ) const; | 98 | virtual int lightSensorResolution ( ) const; |
99 | 99 | ||
100 | protected: | 100 | protected: |
101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
102 | virtual void timerEvent ( QTimerEvent *te ); | 102 | virtual void timerEvent ( QTimerEvent *te ); |
103 | 103 | ||
104 | int m_power_timer; | 104 | int m_power_timer; |
105 | 105 | ||
106 | OLedState m_leds [2]; | 106 | OLedState m_leds [2]; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | class Zaurus : public ODevice { | 109 | class Zaurus : public ODevice { |
110 | protected: | 110 | protected: |
111 | virtual void init ( ); | 111 | virtual void init ( ); |
112 | virtual void initButtons ( ); | 112 | virtual void initButtons ( ); |
113 | 113 | ||
114 | public: | 114 | public: |
115 | virtual bool setSoftSuspend ( bool soft ); | 115 | virtual bool setSoftSuspend ( bool soft ); |
116 | 116 | ||
117 | virtual bool setDisplayBrightness ( int b ); | 117 | virtual bool setDisplayBrightness ( int b ); |
118 | virtual int displayBrightnessResolution ( ) const; | 118 | virtual int displayBrightnessResolution ( ) const; |
119 | 119 | ||
120 | virtual void alarmSound ( ); | 120 | virtual void alarmSound ( ); |
121 | virtual void keySound ( ); | 121 | virtual void keySound ( ); |
122 | virtual void touchSound ( ); | 122 | virtual void touchSound ( ); |
123 | 123 | ||
124 | virtual QValueList <OLed> ledList ( ) const; | 124 | virtual QValueList <OLed> ledList ( ) const; |
125 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 125 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
126 | virtual OLedState ledState ( OLed led ) const; | 126 | virtual OLedState ledState ( OLed led ) const; |
127 | virtual bool setLedState ( OLed led, OLedState st ); | 127 | virtual bool setLedState ( OLed led, OLedState st ); |
128 | 128 | ||
129 | protected: | 129 | protected: |
130 | virtual void buzzer ( int snd ); | 130 | virtual void buzzer ( int snd ); |
131 | 131 | ||
132 | OLedState m_leds [1]; | 132 | OLedState m_leds [1]; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 135 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
136 | protected: | 136 | protected: |
137 | virtual void init ( ); | 137 | virtual void init ( ); |
138 | virtual void initButtons ( ); | 138 | virtual void initButtons ( ); |
139 | 139 | ||
140 | public: | 140 | public: |
141 | virtual bool setSoftSuspend ( bool soft ); | 141 | virtual bool setSoftSuspend ( bool soft ); |
142 | virtual bool suspend(); | 142 | virtual bool suspend(); |
143 | 143 | ||
144 | virtual bool setDisplayStatus( bool on ); | 144 | virtual bool setDisplayStatus( bool on ); |
145 | virtual bool setDisplayBrightness ( int b ); | 145 | virtual bool setDisplayBrightness ( int b ); |
146 | virtual int displayBrightnessResolution ( ) const; | 146 | virtual int displayBrightnessResolution ( ) const; |
147 | 147 | ||
148 | virtual void alarmSound ( ); | 148 | virtual void alarmSound ( ); |
149 | 149 | ||
150 | virtual QValueList <OLed> ledList ( ) const; | 150 | virtual QValueList <OLed> ledList ( ) const; |
151 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 151 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
152 | virtual OLedState ledState ( OLed led ) const; | 152 | virtual OLedState ledState ( OLed led ) const; |
153 | virtual bool setLedState ( OLed led, OLedState st ); | 153 | virtual bool setLedState ( OLed led, OLedState st ); |
154 | 154 | ||
155 | protected: | 155 | protected: |
156 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 156 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
157 | virtual void timerEvent ( QTimerEvent *te ); | 157 | virtual void timerEvent ( QTimerEvent *te ); |
158 | 158 | ||
159 | int m_power_timer; | 159 | int m_power_timer; |
160 | 160 | ||
161 | OLedState m_leds [1]; //FIXME check if really only one | 161 | OLedState m_leds [1]; //FIXME check if really only one |
162 | }; | 162 | }; |
163 | 163 | ||
164 | struct i_button { | 164 | struct i_button { |
165 | uint model; | 165 | uint model; |
166 | Qt::Key code; | 166 | Qt::Key code; |
167 | char *utext; | 167 | char *utext; |
168 | char *pix; | 168 | char *pix; |
169 | char *fpressedservice; | 169 | char *fpressedservice; |
170 | char *fpressedaction; | 170 | char *fpressedaction; |
171 | char *fheldservice; | 171 | char *fheldservice; |
172 | char *fheldaction; | 172 | char *fheldaction; |
173 | } ipaq_buttons [] = { | 173 | } ipaq_buttons [] = { |
174 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 174 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
175 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 175 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
176 | "devicebuttons/ipaq_calendar", | 176 | "devicebuttons/ipaq_calendar", |
177 | "datebook", "nextView()", | 177 | "datebook", "nextView()", |
178 | "today", "raise()" }, | 178 | "today", "raise()" }, |
179 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 179 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
180 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 180 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
181 | "devicebuttons/ipaq_contact", | 181 | "devicebuttons/ipaq_contact", |
182 | "addressbook", "raise()", | 182 | "addressbook", "raise()", |
183 | "addressbook", "beamBusinessCard()" }, | 183 | "addressbook", "beamBusinessCard()" }, |
184 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 184 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
185 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 185 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
186 | "devicebuttons/ipaq_menu", | 186 | "devicebuttons/ipaq_menu", |
187 | "QPE/TaskBar", "toggleMenu()", | 187 | "QPE/TaskBar", "toggleMenu()", |
188 | "QPE/TaskBar", "toggleStartMenu()" }, | 188 | "QPE/TaskBar", "toggleStartMenu()" }, |
189 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 189 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
190 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 190 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
191 | "devicebuttons/ipaq_mail", | 191 | "devicebuttons/ipaq_mail", |
192 | "mail", "raise()", | 192 | "mail", "raise()", |
193 | "mail", "newMail()" }, | 193 | "mail", "newMail()" }, |
194 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 194 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
195 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 195 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
196 | "devicebuttons/ipaq_home", | 196 | "devicebuttons/ipaq_home", |
197 | "QPE/Launcher", "home()", | 197 | "QPE/Launcher", "home()", |
198 | "buttonsettings", "raise()" }, | 198 | "buttonsettings", "raise()" }, |
199 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 199 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
200 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 200 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
201 | "devicebuttons/ipaq_record", | 201 | "devicebuttons/ipaq_record", |
202 | "QPE/VMemo", "toggleRecord()", | 202 | "QPE/VMemo", "toggleRecord()", |
203 | "sound", "raise()" }, | 203 | "sound", "raise()" }, |
204 | }; | 204 | }; |
205 | 205 | ||
206 | struct z_button { | 206 | struct z_button { |
207 | Qt::Key code; | 207 | Qt::Key code; |
208 | char *utext; | 208 | char *utext; |
209 | char *pix; | 209 | char *pix; |
210 | char *fpressedservice; | 210 | char *fpressedservice; |
211 | char *fpressedaction; | 211 | char *fpressedaction; |
212 | char *fheldservice; | 212 | char *fheldservice; |
213 | char *fheldaction; | 213 | char *fheldaction; |
214 | } z_buttons [] = { | 214 | } z_buttons [] = { |
215 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 215 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
216 | "devicebuttons/z_calendar", | 216 | "devicebuttons/z_calendar", |
217 | "datebook", "nextView()", | 217 | "datebook", "nextView()", |
218 | "today", "raise()" }, | 218 | "today", "raise()" }, |
219 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 219 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
220 | "devicebuttons/z_contact", | 220 | "devicebuttons/z_contact", |
221 | "addressbook", "raise()", | 221 | "addressbook", "raise()", |
222 | "addressbook", "beamBusinessCard()" }, | 222 | "addressbook", "beamBusinessCard()" }, |
223 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 223 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
224 | "devicebuttons/z_home", | 224 | "devicebuttons/z_home", |
225 | "QPE/Launcher", "home()", | 225 | "QPE/Launcher", "home()", |
226 | "buttonsettings", "raise()" }, | 226 | "buttonsettings", "raise()" }, |
227 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 227 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
228 | "devicebuttons/z_menu", | 228 | "devicebuttons/z_menu", |
229 | "QPE/TaskBar", "toggleMenu()", | 229 | "QPE/TaskBar", "toggleMenu()", |
230 | "QPE/TaskBar", "toggleStartMenu()" }, | 230 | "QPE/TaskBar", "toggleStartMenu()" }, |
231 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 231 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
232 | "devicebuttons/z_mail", | 232 | "devicebuttons/z_mail", |
233 | "mail", "raise()", | 233 | "mail", "raise()", |
234 | "mail", "newMail()" }, | 234 | "mail", "newMail()" }, |
235 | }; | 235 | }; |
236 | 236 | ||
237 | struct z_button z_buttons_c700 [] = { | 237 | struct z_button z_buttons_c700 [] = { |
238 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 238 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
239 | "devicebuttons/z_calendar", | 239 | "devicebuttons/z_calendar", |
240 | "datebook", "nextView()", | 240 | "datebook", "nextView()", |
241 | "today", "raise()" }, | 241 | "today", "raise()" }, |
242 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 242 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
243 | "devicebuttons/z_contact", | 243 | "devicebuttons/z_contact", |
244 | "addressbook", "raise()", | 244 | "addressbook", "raise()", |
245 | "addressbook", "beamBusinessCard()" }, | 245 | "addressbook", "beamBusinessCard()" }, |
246 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 246 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
247 | "devicebuttons/z_home", | 247 | "devicebuttons/z_home", |
248 | "QPE/Launcher", "home()", | 248 | "QPE/Launcher", "home()", |
249 | "buttonsettings", "raise()" }, | 249 | "buttonsettings", "raise()" }, |
250 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 250 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
251 | "devicebuttons/z_menu", | 251 | "devicebuttons/z_menu", |
252 | "QPE/TaskBar", "toggleMenu()", | 252 | "QPE/TaskBar", "toggleMenu()", |
253 | "QPE/TaskBar", "toggleStartMenu()" }, | 253 | "QPE/TaskBar", "toggleStartMenu()" }, |
254 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 254 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
255 | "", | 255 | "", |
256 | "QPE/Rotation", "flip()", | 256 | "QPE/Rotation", "flip()", |
257 | "QPE/Rotation", "flip()" }, | 257 | "QPE/Rotation", "flip()" }, |
258 | }; | 258 | }; |
259 | 259 | ||
260 | struct s_button { | 260 | struct s_button { |
261 | uint model; | 261 | uint model; |
262 | Qt::Key code; | 262 | Qt::Key code; |
263 | char *utext; | 263 | char *utext; |
264 | char *pix; | 264 | char *pix; |
265 | char *fpressedservice; | 265 | char *fpressedservice; |
266 | char *fpressedaction; | 266 | char *fpressedaction; |
267 | char *fheldservice; | 267 | char *fheldservice; |
268 | char *fheldaction; | 268 | char *fheldaction; |
269 | } simpad_buttons [] = { | 269 | } simpad_buttons [] = { |
270 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 270 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
271 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 271 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
272 | "devicebuttons/simpad_lower_up", | 272 | "devicebuttons/simpad_lower_up", |
273 | "datebook", "nextView()", | 273 | "datebook", "nextView()", |
274 | "today", "raise()" }, | 274 | "today", "raise()" }, |
275 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 275 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
276 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 276 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
277 | "devicebuttons/simpad_lower_down", | 277 | "devicebuttons/simpad_lower_down", |
278 | "addressbook", "raise()", | 278 | "addressbook", "raise()", |
279 | "addressbook", "beamBusinessCard()" }, | 279 | "addressbook", "beamBusinessCard()" }, |
280 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 280 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
281 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | 281 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), |
282 | "devicebuttons/simpad_lower_right", | 282 | "devicebuttons/simpad_lower_right", |
283 | "QPE/TaskBar", "toggleMenu()", | 283 | "QPE/TaskBar", "toggleMenu()", |
284 | "QPE/TaskBar", "toggleStartMenu()" }, | 284 | "QPE/TaskBar", "toggleStartMenu()" }, |
285 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 285 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
286 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | ||
287 | "devicebuttons/simpad_lower_upper", | ||
288 | "QPE/Launcher", "home()", | ||
289 | "buttonsettings", "raise()" }, | ||
290 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
291 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), | 286 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), |
292 | "devicebuttons/simpad_lower_left", | 287 | "devicebuttons/simpad_lower_left", |
293 | "mail", "raise()", | 288 | "mail", "raise()", |
294 | "mail", "newMail()" }, | 289 | "mail", "newMail()" }, |
295 | 290 | ||
296 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 291 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
297 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), | 292 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), |
298 | "devicebuttons/simpad_upper_up", | 293 | "devicebuttons/simpad_upper_up", |
299 | "datebook", "nextView()", | 294 | "QPE/Launcher", "home()", |
300 | "today", "raise()" }, | 295 | "buttonsettings", "raise()" }, |
301 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 296 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
302 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), | 297 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), |
303 | "devicebuttons/simpad_upper_down", | 298 | "devicebuttons/simpad_upper_down", |
304 | "addressbook", "raise()", | 299 | "addressbook", "raise()", |
305 | "addressbook", "beamBusinessCard()" }, | 300 | "addressbook", "beamBusinessCard()" }, |
306 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 301 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
307 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), | 302 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), |
308 | "devicebuttons/simpad_upper_right", | 303 | "devicebuttons/simpad_upper_right", |
309 | "QPE/TaskBar", "toggleMenu()", | 304 | "QPE/TaskBar", "toggleMenu()", |
310 | "QPE/TaskBar", "toggleStartMenu()" }, | 305 | "QPE/TaskBar", "toggleStartMenu()" }, |
311 | /*{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 306 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
307 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | ||
308 | "devicebuttons/simpad_upper_left", | ||
309 | "QPE/Rotation", "flip()", | ||
310 | "QPE/Rotation", "flip()" }, | ||
311 | /* | ||
312 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | ||
312 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 313 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
313 | "devicebuttons/simpad_lower_upper", | 314 | "devicebuttons/simpad_lower_upper", |
314 | "QPE/Launcher", "home()", | 315 | "QPE/Launcher", "home()", |
315 | "buttonsettings", "raise()" },*/ | 316 | "buttonsettings", "raise()" }, |
316 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 317 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
317 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | 318 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
318 | "devicebuttons/simpad_upper_left", | 319 | "devicebuttons/simpad_upper_lower", |
319 | "mail", "raise()", | 320 | "QPE/Launcher", "home()", |
320 | "mail", "newMail()" }, | 321 | "buttonsettings", "raise()" }, |
322 | */ | ||
321 | }; | 323 | }; |
322 | 324 | ||
323 | static QCString makeChannel ( const char *str ) | 325 | static QCString makeChannel ( const char *str ) |
324 | { | 326 | { |
325 | if ( str && !::strchr ( str, '/' )) | 327 | if ( str && !::strchr ( str, '/' )) |
326 | return QCString ( "QPE/Application/" ) + str; | 328 | return QCString ( "QPE/Application/" ) + str; |
327 | else | 329 | else |
328 | return str; | 330 | return str; |
329 | } | 331 | } |
330 | 332 | ||
331 | static inline bool isQWS() | 333 | static inline bool isQWS() |
332 | { | 334 | { |
333 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 335 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
334 | } | 336 | } |
335 | 337 | ||
336 | ODevice *ODevice::inst ( ) | 338 | ODevice *ODevice::inst ( ) |
337 | { | 339 | { |
338 | static ODevice *dev = 0; | 340 | static ODevice *dev = 0; |
339 | 341 | ||
340 | if ( !dev ) { | 342 | if ( !dev ) { |
341 | if ( QFile::exists ( "/proc/hal/model" )) | 343 | if ( QFile::exists ( "/proc/hal/model" )) |
342 | dev = new iPAQ ( ); | 344 | dev = new iPAQ ( ); |
343 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 345 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
344 | dev = new Zaurus ( ); | 346 | dev = new Zaurus ( ); |
345 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) | 347 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) |
346 | dev = new SIMpad ( ); | 348 | dev = new SIMpad ( ); |
347 | else | 349 | else |
348 | dev = new ODevice ( ); | 350 | dev = new ODevice ( ); |
349 | 351 | ||
350 | dev-> init ( ); | 352 | dev-> init ( ); |
351 | } | 353 | } |
352 | return dev; | 354 | return dev; |
353 | } | 355 | } |
354 | 356 | ||
355 | 357 | ||
356 | /************************************************** | 358 | /************************************************** |
357 | * | 359 | * |
358 | * common | 360 | * common |
359 | * | 361 | * |
360 | **************************************************/ | 362 | **************************************************/ |
361 | 363 | ||
362 | 364 | ||
363 | ODevice::ODevice ( ) | 365 | ODevice::ODevice ( ) |
364 | { | 366 | { |
365 | d = new ODeviceData; | 367 | d = new ODeviceData; |
366 | 368 | ||
367 | d-> m_modelstr = "Unknown"; | 369 | d-> m_modelstr = "Unknown"; |
368 | d-> m_model = Model_Unknown; | 370 | d-> m_model = Model_Unknown; |
369 | d-> m_vendorstr = "Unknown"; | 371 | d-> m_vendorstr = "Unknown"; |
370 | d-> m_vendor = Vendor_Unknown; | 372 | d-> m_vendor = Vendor_Unknown; |
371 | d-> m_systemstr = "Unknown"; | 373 | d-> m_systemstr = "Unknown"; |
372 | d-> m_system = System_Unknown; | 374 | d-> m_system = System_Unknown; |
373 | d-> m_sysverstr = "0.0"; | 375 | d-> m_sysverstr = "0.0"; |
374 | d-> m_rotation = Rot0; | 376 | d-> m_rotation = Rot0; |
375 | d-> m_direction = CW; | 377 | d-> m_direction = CW; |
376 | 378 | ||
377 | d-> m_holdtime = 1000; // 1000ms | 379 | d-> m_holdtime = 1000; // 1000ms |
378 | d-> m_buttons = 0; | 380 | d-> m_buttons = 0; |
379 | } | 381 | } |
380 | 382 | ||
381 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 383 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
382 | { | 384 | { |
383 | if ( msg == "deviceButtonMappingChanged()" ) { | 385 | if ( msg == "deviceButtonMappingChanged()" ) { |
384 | reloadButtonMapping ( ); | 386 | reloadButtonMapping ( ); |
385 | } | 387 | } |
386 | } | 388 | } |
387 | 389 | ||
388 | void ODevice::init ( ) | 390 | void ODevice::init ( ) |
389 | { | 391 | { |
390 | } | 392 | } |
391 | 393 | ||
392 | /** | 394 | /** |
393 | * This method initialises the button mapping | 395 | * This method initialises the button mapping |
394 | */ | 396 | */ |
395 | void ODevice::initButtons ( ) | 397 | void ODevice::initButtons ( ) |
396 | { | 398 | { |
397 | if ( d-> m_buttons ) | 399 | if ( d-> m_buttons ) |
398 | return; | 400 | return; |
399 | 401 | ||
400 | // Simulation uses iPAQ 3660 device buttons | 402 | // Simulation uses iPAQ 3660 device buttons |
401 | 403 | ||
402 | qDebug ( "init Buttons" ); | 404 | qDebug ( "init Buttons" ); |
403 | d-> m_buttons = new QValueList <ODeviceButton>; | 405 | d-> m_buttons = new QValueList <ODeviceButton>; |
404 | 406 | ||
405 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 407 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
406 | i_button *ib = ipaq_buttons + i; | 408 | i_button *ib = ipaq_buttons + i; |
407 | ODeviceButton b; | 409 | ODeviceButton b; |
408 | 410 | ||
409 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 411 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
410 | b. setKeycode ( ib-> code ); | 412 | b. setKeycode ( ib-> code ); |
411 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 413 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
412 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 414 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
413 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 415 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
414 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 416 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
415 | d-> m_buttons-> append ( b ); | 417 | d-> m_buttons-> append ( b ); |
416 | } | 418 | } |
417 | } | 419 | } |
418 | reloadButtonMapping ( ); | 420 | reloadButtonMapping ( ); |
419 | 421 | ||
420 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 422 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
421 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 423 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
422 | } | 424 | } |
423 | 425 | ||
424 | ODevice::~ODevice ( ) | 426 | ODevice::~ODevice ( ) |
425 | { | 427 | { |
426 | delete d; | 428 | delete d; |
427 | } | 429 | } |
428 | 430 | ||
429 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 431 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
430 | { | 432 | { |
431 | return false; | 433 | return false; |
432 | } | 434 | } |
433 | 435 | ||
434 | //#include <linux/apm_bios.h> | 436 | //#include <linux/apm_bios.h> |
435 | 437 | ||
436 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 438 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
437 | 439 | ||
438 | /** | 440 | /** |
439 | * This method will try to suspend the device | 441 | * This method will try to suspend the device |
440 | * It only works if the user is the QWS Server and the apm application | 442 | * It only works if the user is the QWS Server and the apm application |
441 | * is installed. | 443 | * is installed. |
442 | * It tries to suspend and then waits some time cause some distributions | 444 | * It tries to suspend and then waits some time cause some distributions |
443 | * do have asynchronus apm implementations. | 445 | * do have asynchronus apm implementations. |
444 | * This method will either fail and return false or it'll suspend the | 446 | * This method will either fail and return false or it'll suspend the |
445 | * device and return once the device got woken up | 447 | * device and return once the device got woken up |
446 | * | 448 | * |
447 | * @return if the device got suspended | 449 | * @return if the device got suspended |
448 | */ | 450 | */ |
449 | bool ODevice::suspend ( ) | 451 | bool ODevice::suspend ( ) |
450 | { | 452 | { |
451 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 453 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
452 | return false; | 454 | return false; |
453 | 455 | ||
454 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 456 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
455 | return false; | 457 | return false; |
456 | 458 | ||
457 | bool res = false; | 459 | bool res = false; |
458 | 460 | ||
459 | struct timeval tvs, tvn; | 461 | struct timeval tvs, tvn; |
460 | ::gettimeofday ( &tvs, 0 ); | 462 | ::gettimeofday ( &tvs, 0 ); |
461 | 463 | ||
462 | ::sync ( ); // flush fs caches | 464 | ::sync ( ); // flush fs caches |
463 | res = ( ::system ( "apm --suspend" ) == 0 ); | 465 | res = ( ::system ( "apm --suspend" ) == 0 ); |
464 | 466 | ||
465 | // This is needed because the iPAQ apm implementation is asynchronous and we | 467 | // This is needed because the iPAQ apm implementation is asynchronous and we |
466 | // can not be sure when exactly the device is really suspended | 468 | // can not be sure when exactly the device is really suspended |
467 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 469 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
468 | 470 | ||
469 | if ( res ) { | 471 | if ( res ) { |
470 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 472 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
471 | ::usleep ( 200 * 1000 ); | 473 | ::usleep ( 200 * 1000 ); |
472 | ::gettimeofday ( &tvn, 0 ); | 474 | ::gettimeofday ( &tvn, 0 ); |
473 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 475 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
474 | } | 476 | } |
475 | 477 | ||
476 | return res; | 478 | return res; |
477 | } | 479 | } |
478 | 480 | ||
479 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 481 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
480 | 482 | ||
481 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 483 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
482 | 484 | ||
483 | /* VESA Blanking Levels */ | 485 | /* VESA Blanking Levels */ |
484 | #define VESA_NO_BLANKING 0 | 486 | #define VESA_NO_BLANKING 0 |
485 | #define VESA_VSYNC_SUSPEND 1 | 487 | #define VESA_VSYNC_SUSPEND 1 |
486 | #define VESA_HSYNC_SUSPEND 2 | 488 | #define VESA_HSYNC_SUSPEND 2 |
487 | #define VESA_POWERDOWN 3 | 489 | #define VESA_POWERDOWN 3 |
488 | 490 | ||
489 | /** | 491 | /** |
490 | * This sets the display on or off | 492 | * This sets the display on or off |
491 | */ | 493 | */ |
492 | bool ODevice::setDisplayStatus ( bool on ) | 494 | bool ODevice::setDisplayStatus ( bool on ) |
493 | { | 495 | { |
494 | if ( d-> m_model == Model_Unknown ) | 496 | if ( d-> m_model == Model_Unknown ) |
495 | return false; | 497 | return false; |
496 | 498 | ||
497 | bool res = false; | 499 | bool res = false; |
498 | int fd; | 500 | int fd; |
499 | 501 | ||
500 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 502 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
501 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 503 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
502 | ::close ( fd ); | 504 | ::close ( fd ); |
503 | } | 505 | } |
504 | return res; | 506 | return res; |
505 | } | 507 | } |
506 | 508 | ||
507 | /** | 509 | /** |
508 | * This sets the display brightness | 510 | * This sets the display brightness |
509 | * @return success or failure | 511 | * @return success or failure |
510 | */ | 512 | */ |
511 | bool ODevice::setDisplayBrightness ( int p) | 513 | bool ODevice::setDisplayBrightness ( int p) |
512 | { | 514 | { |