author | zecke <zecke> | 2004-02-07 18:51:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-07 18:51:44 (UTC) |
commit | e74082b93d1948385d8d32ed92e61396b74d72f1 (patch) (unidiff) | |
tree | 72fa998043e8218412b593626093f62b629154cc | |
parent | a41eba9e8404fb6321097e86736e23fbce4ead7a (diff) | |
download | opie-e74082b93d1948385d8d32ed92e61396b74d72f1.zip opie-e74082b93d1948385d8d32ed92e61396b74d72f1.tar.gz opie-e74082b93d1948385d8d32ed92e61396b74d72f1.tar.bz2 |
Rename the rest bunch of functions <- fix compiling...
Readd the todo mark about constness initButtons is not const...
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 12 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 6 |
8 files changed, 21 insertions, 19 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 6c8432f..72b9ac7 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -325,93 +325,93 @@ QString ODevice::systemString() const | |||
325 | * Return System as OSystem value | 325 | * Return System as OSystem value |
326 | */ | 326 | */ |
327 | OSystem ODevice::system() const | 327 | OSystem ODevice::system() const |
328 | { | 328 | { |
329 | return d->m_system; | 329 | return d->m_system; |
330 | } | 330 | } |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * @return the version string of the base system | 333 | * @return the version string of the base system |
334 | */ | 334 | */ |
335 | QString ODevice::systemVersionString() const | 335 | QString ODevice::systemVersionString() const |
336 | { | 336 | { |
337 | return d->m_sysverstr; | 337 | return d->m_sysverstr; |
338 | } | 338 | } |
339 | 339 | ||
340 | /** | 340 | /** |
341 | * @return the current Transformation | 341 | * @return the current Transformation |
342 | */ | 342 | */ |
343 | Transformation ODevice::rotation() const | 343 | Transformation ODevice::rotation() const |
344 | { | 344 | { |
345 | return d->m_rotation; | 345 | return d->m_rotation; |
346 | } | 346 | } |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * @return the current rotation direction | 349 | * @return the current rotation direction |
350 | */ | 350 | */ |
351 | ODirection ODevice::direction() const | 351 | ODirection ODevice::direction() const |
352 | { | 352 | { |
353 | return d->m_direction; | 353 | return d->m_direction; |
354 | } | 354 | } |
355 | 355 | ||
356 | /** | 356 | /** |
357 | * This plays an alarmSound | 357 | * This plays an alarm sound |
358 | */ | 358 | */ |
359 | void ODevice::alarmSound() | 359 | void ODevice::playAlarmSound() |
360 | { | 360 | { |
361 | #ifndef QT_NO_SOUND | 361 | #ifndef QT_NO_SOUND |
362 | static Sound snd ( "alarm" ); | 362 | static Sound snd ( "alarm" ); |
363 | 363 | ||
364 | if ( snd. isFinished()) | 364 | if ( snd. isFinished()) |
365 | snd. play(); | 365 | snd. play(); |
366 | #endif | 366 | #endif |
367 | } | 367 | } |
368 | 368 | ||
369 | /** | 369 | /** |
370 | * This plays a key sound | 370 | * This plays a key sound |
371 | */ | 371 | */ |
372 | void ODevice::keySound() | 372 | void ODevice::playKeySound() |
373 | { | 373 | { |
374 | #ifndef QT_NO_SOUND | 374 | #ifndef QT_NO_SOUND |
375 | static Sound snd ( "keysound" ); | 375 | static Sound snd ( "keysound" ); |
376 | 376 | ||
377 | if ( snd. isFinished()) | 377 | if ( snd. isFinished()) |
378 | snd. play(); | 378 | snd. play(); |
379 | #endif | 379 | #endif |
380 | } | 380 | } |
381 | 381 | ||
382 | /** | 382 | /** |
383 | * This plays a touch sound | 383 | * This plays a touch sound |
384 | */ | 384 | */ |
385 | void ODevice::touchSound() | 385 | void ODevice::playTouchSound() |
386 | { | 386 | { |
387 | #ifndef QT_NO_SOUND | 387 | #ifndef QT_NO_SOUND |
388 | static Sound snd ( "touchsound" ); | 388 | static Sound snd ( "touchsound" ); |
389 | 389 | ||
390 | if ( snd. isFinished()) | 390 | if ( snd. isFinished()) |
391 | snd. play(); | 391 | snd. play(); |
392 | #endif | 392 | #endif |
393 | } | 393 | } |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * This method will return a list of leds | 396 | * This method will return a list of leds |
397 | * available on this device | 397 | * available on this device |
398 | * @return a list of LEDs. | 398 | * @return a list of LEDs. |
399 | */ | 399 | */ |
400 | QValueList <OLed> ODevice::ledList() const | 400 | QValueList <OLed> ODevice::ledList() const |
401 | { | 401 | { |
402 | return QValueList <OLed>(); | 402 | return QValueList <OLed>(); |
403 | } | 403 | } |
404 | 404 | ||
405 | /** | 405 | /** |
406 | * This does return the state of the LEDs | 406 | * This does return the state of the LEDs |
407 | */ | 407 | */ |
408 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 408 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
409 | { | 409 | { |
410 | return QValueList <OLedState>(); | 410 | return QValueList <OLedState>(); |
411 | } | 411 | } |
412 | 412 | ||
413 | /** | 413 | /** |
414 | * @return the state for a given OLed | 414 | * @return the state for a given OLed |
415 | */ | 415 | */ |
416 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 416 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
417 | { | 417 | { |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 8ae7ffa..791ccb3 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -196,91 +196,93 @@ public: | |||
196 | OModel model() const; | 196 | OModel model() const; |
197 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 197 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
198 | 198 | ||
199 | QString vendorString() const; | 199 | QString vendorString() const; |
200 | OVendor vendor() const; | 200 | OVendor vendor() const; |
201 | 201 | ||
202 | QString systemString() const; | 202 | QString systemString() const; |
203 | OSystem system() const; | 203 | OSystem system() const; |
204 | 204 | ||
205 | QString systemVersionString() const; | 205 | QString systemVersionString() const; |
206 | 206 | ||
207 | virtual Transformation rotation() const; | 207 | virtual Transformation rotation() const; |
208 | virtual ODirection direction() const; | 208 | virtual ODirection direction() const; |
209 | 209 | ||
210 | // system | 210 | // system |
211 | 211 | ||
212 | virtual bool setSoftSuspend ( bool on ); | 212 | virtual bool setSoftSuspend ( bool on ); |
213 | virtual bool suspend(); | 213 | virtual bool suspend(); |
214 | 214 | ||
215 | virtual bool setDisplayStatus ( bool on ); | 215 | virtual bool setDisplayStatus ( bool on ); |
216 | virtual bool setDisplayBrightness ( int brightness ); | 216 | virtual bool setDisplayBrightness ( int brightness ); |
217 | virtual int displayBrightnessResolution() const; | 217 | virtual int displayBrightnessResolution() const; |
218 | virtual bool setDisplayContrast ( int contrast ); | 218 | virtual bool setDisplayContrast ( int contrast ); |
219 | virtual int displayContrastResolution() const; | 219 | virtual int displayContrastResolution() const; |
220 | 220 | ||
221 | // don't add new virtual methods, use this: | 221 | // don't add new virtual methods, use this: |
222 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 222 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
223 | // and in your subclass do do overwrite | 223 | // and in your subclass do do overwrite |
224 | //protected virtual int virtual_hook(int, void *) | 224 | //protected virtual int virtual_hook(int, void *) |
225 | // which is defined below | 225 | // which is defined below |
226 | 226 | ||
227 | // input / output | 227 | // input / output |
228 | //FIXME playAlarmSound and al might be better -zecke | 228 | virtual void playAlarmSound(); |
229 | virtual void alarmSound(); | 229 | virtual void playKeySound(); |
230 | virtual void keySound(); | 230 | virtual void playTouchSound(); |
231 | virtual void touchSound(); | ||
232 | 231 | ||
233 | virtual QValueList <OLed> ledList() const; | 232 | virtual QValueList <OLed> ledList() const; |
234 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 233 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
235 | virtual OLedState ledState ( OLed led ) const; | 234 | virtual OLedState ledState ( OLed led ) const; |
236 | virtual bool setLedState ( OLed led, OLedState st ); | 235 | virtual bool setLedState ( OLed led, OLedState st ); |
237 | 236 | ||
238 | virtual bool hasLightSensor() const; | 237 | virtual bool hasLightSensor() const; |
239 | virtual int readLightSensor(); | 238 | virtual int readLightSensor(); |
240 | virtual int lightSensorResolution() const; | 239 | virtual int lightSensorResolution() const; |
241 | 240 | ||
242 | virtual bool hasHingeSensor() const; | 241 | virtual bool hasHingeSensor() const; |
243 | virtual OHingeStatus readHingeSensor(); | 242 | virtual OHingeStatus readHingeSensor(); |
244 | 243 | ||
245 | const QStrList &allowedCpuFrequencies() const; | 244 | const QStrList &allowedCpuFrequencies() const; |
246 | bool setCurrentCpuFrequency(uint index); | 245 | bool setCurrentCpuFrequency(uint index); |
247 | 246 | ||
248 | /** | 247 | /** |
249 | * Returns the available buttons on this device. The number and location | 248 | * Returns the available buttons on this device. The number and location |
250 | * of buttons will vary depending on the device. Button numbers will be assigned | 249 | * of buttons will vary depending on the device. Button numbers will be assigned |
251 | * by the device manufacturer and will be from most preferred button to least preffered | 250 | * by the device manufacturer and will be from most preferred button to least preffered |
252 | * button. Note that this list only contains "user mappable" buttons. | 251 | * button. Note that this list only contains "user mappable" buttons. |
252 | * | ||
253 | * @todo Make method const and take care of calling initButtons or make that const too | ||
254 | * | ||
253 | */ | 255 | */ |
254 | const QValueList<ODeviceButton> &buttons() /* ### make const */; | 256 | const QValueList<ODeviceButton> &buttons(); |
255 | 257 | ||
256 | /** | 258 | /** |
257 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 259 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
258 | * returns 0L | 260 | * returns 0L |
259 | */ | 261 | */ |
260 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 262 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
261 | 263 | ||
262 | /** | 264 | /** |
263 | * Reassigns the pressed action for \a button. To return to the factory | 265 | * Reassigns the pressed action for \a button. To return to the factory |
264 | * default pass an empty string as \a qcopMessage. | 266 | * default pass an empty string as \a qcopMessage. |
265 | */ | 267 | */ |
266 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 268 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
267 | 269 | ||
268 | /** | 270 | /** |
269 | * Reassigns the held action for \a button. To return to the factory | 271 | * Reassigns the held action for \a button. To return to the factory |
270 | * default pass an empty string as \a qcopMessage. | 272 | * default pass an empty string as \a qcopMessage. |
271 | */ | 273 | */ |
272 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 274 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
273 | 275 | ||
274 | /** | 276 | /** |
275 | * How long (in ms) you have to press a button for a "hold" action | 277 | * How long (in ms) you have to press a button for a "hold" action |
276 | */ | 278 | */ |
277 | uint buttonHoldTime() const; | 279 | uint buttonHoldTime() const; |
278 | 280 | ||
279 | signals: | 281 | signals: |
280 | void buttonMappingChanged(); | 282 | void buttonMappingChanged(); |
281 | 283 | ||
282 | private slots: | 284 | private slots: |
283 | void systemMessage ( const QCString &, const QByteArray & ); | 285 | void systemMessage ( const QCString &, const QByteArray & ); |
284 | 286 | ||
285 | protected: | 287 | protected: |
286 | void reloadButtonMapping(); | 288 | void reloadButtonMapping(); |
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index d68bce1..d20ea4d 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -313,65 +313,65 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
313 | killTimer ( m_power_timer ); | 313 | killTimer ( m_power_timer ); |
314 | m_power_timer = startTimer ( 500 ); | 314 | m_power_timer = startTimer ( 500 ); |
315 | } | 315 | } |
316 | else if ( m_power_timer ) { | 316 | else if ( m_power_timer ) { |
317 | killTimer ( m_power_timer ); | 317 | killTimer ( m_power_timer ); |
318 | m_power_timer = 0; | 318 | m_power_timer = 0; |
319 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 319 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
320 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 320 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
321 | } | 321 | } |
322 | newkeycode = Key_unknown; | 322 | newkeycode = Key_unknown; |
323 | break; | 323 | break; |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | if ( newkeycode != keycode ) { | 327 | if ( newkeycode != keycode ) { |
328 | if ( newkeycode != Key_unknown ) | 328 | if ( newkeycode != Key_unknown ) |
329 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 329 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
330 | return true; | 330 | return true; |
331 | } | 331 | } |
332 | else | 332 | else |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
335 | 335 | ||
336 | void iPAQ::timerEvent ( QTimerEvent * ) | 336 | void iPAQ::timerEvent ( QTimerEvent * ) |
337 | { | 337 | { |
338 | killTimer ( m_power_timer ); | 338 | killTimer ( m_power_timer ); |
339 | m_power_timer = 0; | 339 | m_power_timer = 0; |
340 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 340 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
341 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 341 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | void iPAQ::alarmSound() | 345 | void iPAQ::playAlarmSound() |
346 | { | 346 | { |
347 | #ifndef QT_NO_SOUND | 347 | #ifndef QT_NO_SOUND |
348 | static Sound snd ( "alarm" ); | 348 | static Sound snd ( "alarm" ); |
349 | int fd; | 349 | int fd; |
350 | int vol; | 350 | int vol; |
351 | bool vol_reset = false; | 351 | bool vol_reset = false; |
352 | 352 | ||
353 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 353 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
354 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 354 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
355 | Config cfg ( "qpe" ); | 355 | Config cfg ( "qpe" ); |
356 | cfg. setGroup ( "Volume" ); | 356 | cfg. setGroup ( "Volume" ); |
357 | 357 | ||
358 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 358 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
359 | if ( volalarm < 0 ) | 359 | if ( volalarm < 0 ) |
360 | volalarm = 0; | 360 | volalarm = 0; |
361 | else if ( volalarm > 100 ) | 361 | else if ( volalarm > 100 ) |
362 | volalarm = 100; | 362 | volalarm = 100; |
363 | volalarm |= ( volalarm << 8 ); | 363 | volalarm |= ( volalarm << 8 ); |
364 | 364 | ||
365 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 365 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
366 | vol_reset = true; | 366 | vol_reset = true; |
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | snd. play(); | 370 | snd. play(); |
371 | while ( !snd. isFinished()) | 371 | while ( !snd. isFinished()) |
372 | qApp->processEvents(); | 372 | qApp->processEvents(); |
373 | 373 | ||
374 | if ( fd >= 0 ) { | 374 | if ( fd >= 0 ) { |
375 | if ( vol_reset ) | 375 | if ( vol_reset ) |
376 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 376 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
377 | ::close ( fd ); | 377 | ::close ( fd ); |
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index baf7215..f512344 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h | |||
@@ -21,64 +21,64 @@ | |||
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_IPAQ | 30 | #ifndef ODEVICE_IPAQ |
31 | #define ODEVICE_IPAQ | 31 | #define ODEVICE_IPAQ |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | using namespace Opie; |
39 | 39 | ||
40 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | 40 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 41 | { |
42 | 42 | ||
43 | protected: | 43 | protected: |
44 | virtual void init(); | 44 | virtual void init(); |
45 | virtual void initButtons(); | 45 | virtual void initButtons(); |
46 | 46 | ||
47 | public: | 47 | public: |
48 | virtual bool setSoftSuspend( bool soft ); | 48 | virtual bool setSoftSuspend( bool soft ); |
49 | 49 | ||
50 | virtual bool setDisplayBrightness( int b ); | 50 | virtual bool setDisplayBrightness( int b ); |
51 | virtual int displayBrightnessResolution() const; | 51 | virtual int displayBrightnessResolution() const; |
52 | 52 | ||
53 | virtual void alarmSound(); | 53 | virtual void playAlarmSound(); |
54 | 54 | ||
55 | virtual QValueList <OLed> ledList() const; | 55 | virtual QValueList <OLed> ledList() const; |
56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
57 | virtual OLedState ledState( OLed led ) const; | 57 | virtual OLedState ledState( OLed led ) const; |
58 | virtual bool setLedState( OLed led, OLedState st ); | 58 | virtual bool setLedState( OLed led, OLedState st ); |
59 | 59 | ||
60 | virtual bool hasLightSensor() const; | 60 | virtual bool hasLightSensor() const; |
61 | virtual int readLightSensor(); | 61 | virtual int readLightSensor(); |
62 | virtual int lightSensorResolution() const; | 62 | virtual int lightSensorResolution() const; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 65 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
66 | virtual void timerEvent( QTimerEvent *te ); | 66 | virtual void timerEvent( QTimerEvent *te ); |
67 | 67 | ||
68 | int m_power_timer; | 68 | int m_power_timer; |
69 | 69 | ||
70 | OLedState m_leds [2]; | 70 | OLedState m_leds [2]; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | struct i_button { | 73 | struct i_button { |
74 | uint model; | 74 | uint model; |
75 | Qt::Key code; | 75 | Qt::Key code; |
76 | char *utext; | 76 | char *utext; |
77 | char *pix; | 77 | char *pix; |
78 | char *fpressedservice; | 78 | char *fpressedservice; |
79 | char *fpressedaction; | 79 | char *fpressedaction; |
80 | char *fheldservice; | 80 | char *fheldservice; |
81 | char *fheldaction; | 81 | char *fheldaction; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | #endif | 84 | #endif |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index a2cd419..4397b78 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -252,65 +252,65 @@ bool SIMpad::setLedState ( OLed l, OLedState st ) | |||
252 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); | 252 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); |
253 | 253 | ||
254 | /*TODO Implement this like that: | 254 | /*TODO Implement this like that: |
255 | read from cs3 | 255 | read from cs3 |
256 | && with SIMPAD_LED2_ON | 256 | && with SIMPAD_LED2_ON |
257 | write to cs3 */ | 257 | write to cs3 */ |
258 | m_leds [0] = st; | 258 | m_leds [0] = st; |
259 | return true; | 259 | return true; |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | #endif | 264 | #endif |
265 | return false; | 265 | return false; |
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | ||
269 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 269 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
270 | { | 270 | { |
271 | //TODO | 271 | //TODO |
272 | return false; | 272 | return false; |
273 | } | 273 | } |
274 | 274 | ||
275 | void SIMpad::timerEvent ( QTimerEvent * ) | 275 | void SIMpad::timerEvent ( QTimerEvent * ) |
276 | { | 276 | { |
277 | killTimer ( m_power_timer ); | 277 | killTimer ( m_power_timer ); |
278 | m_power_timer = 0; | 278 | m_power_timer = 0; |
279 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 279 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
280 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 280 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void SIMpad::alarmSound() | 284 | void SIMpad::playAlarmSound() |
285 | { | 285 | { |
286 | #ifndef QT_NO_SOUND | 286 | #ifndef QT_NO_SOUND |
287 | static Sound snd ( "alarm" ); | 287 | static Sound snd ( "alarm" ); |
288 | int fd; | 288 | int fd; |
289 | int vol; | 289 | int vol; |
290 | bool vol_reset = false; | 290 | bool vol_reset = false; |
291 | 291 | ||
292 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 292 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
293 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 293 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
294 | Config cfg ( "qpe" ); | 294 | Config cfg ( "qpe" ); |
295 | cfg. setGroup ( "Volume" ); | 295 | cfg. setGroup ( "Volume" ); |
296 | 296 | ||
297 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 297 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
298 | if ( volalarm < 0 ) | 298 | if ( volalarm < 0 ) |
299 | volalarm = 0; | 299 | volalarm = 0; |
300 | else if ( volalarm > 100 ) | 300 | else if ( volalarm > 100 ) |
301 | volalarm = 100; | 301 | volalarm = 100; |
302 | volalarm |= ( volalarm << 8 ); | 302 | volalarm |= ( volalarm << 8 ); |
303 | 303 | ||
304 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 304 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
305 | vol_reset = true; | 305 | vol_reset = true; |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | snd. play(); | 309 | snd. play(); |
310 | while ( !snd. isFinished()) | 310 | while ( !snd. isFinished()) |
311 | qApp->processEvents(); | 311 | qApp->processEvents(); |
312 | 312 | ||
313 | if ( fd >= 0 ) { | 313 | if ( fd >= 0 ) { |
314 | if ( vol_reset ) | 314 | if ( vol_reset ) |
315 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 315 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
316 | ::close ( fd ); | 316 | ::close ( fd ); |
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index 615effc..3287ee8 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h | |||
@@ -22,60 +22,60 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_SIMPAD | 30 | #ifndef ODEVICE_SIMPAD |
31 | #define ODEVICE_SIMPAD | 31 | #define ODEVICE_SIMPAD |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | using namespace Opie; |
39 | 39 | ||
40 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter | 40 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 41 | { |
42 | protected: | 42 | protected: |
43 | virtual void init(); | 43 | virtual void init(); |
44 | virtual void initButtons(); | 44 | virtual void initButtons(); |
45 | 45 | ||
46 | public: | 46 | public: |
47 | virtual bool setSoftSuspend( bool soft ); | 47 | virtual bool setSoftSuspend( bool soft ); |
48 | virtual bool suspend(); | 48 | virtual bool suspend(); |
49 | 49 | ||
50 | virtual bool setDisplayStatus( bool on ); | 50 | virtual bool setDisplayStatus( bool on ); |
51 | virtual bool setDisplayBrightness( int b ); | 51 | virtual bool setDisplayBrightness( int b ); |
52 | virtual int displayBrightnessResolution() const; | 52 | virtual int displayBrightnessResolution() const; |
53 | 53 | ||
54 | virtual void alarmSound(); | 54 | virtual void playAlarmSound(); |
55 | 55 | ||
56 | virtual QValueList <OLed> ledList() const; | 56 | virtual QValueList <OLed> ledList() const; |
57 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 57 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
58 | virtual OLedState ledState( OLed led ) const; | 58 | virtual OLedState ledState( OLed led ) const; |
59 | virtual bool setLedState( OLed led, OLedState st ); | 59 | virtual bool setLedState( OLed led, OLedState st ); |
60 | 60 | ||
61 | protected: | 61 | protected: |
62 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 62 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
63 | virtual void timerEvent( QTimerEvent *te ); | 63 | virtual void timerEvent( QTimerEvent *te ); |
64 | 64 | ||
65 | int m_power_timer; | 65 | int m_power_timer; |
66 | 66 | ||
67 | OLedState m_leds [1]; | 67 | OLedState m_leds [1]; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct s_button { | 70 | struct s_button { |
71 | uint model; | 71 | uint model; |
72 | Qt::Key code; | 72 | Qt::Key code; |
73 | char *utext; | 73 | char *utext; |
74 | char *pix; | 74 | char *pix; |
75 | char *fpressedservice; | 75 | char *fpressedservice; |
76 | char *fpressedaction; | 76 | char *fpressedaction; |
77 | char *fheldservice; | 77 | char *fheldservice; |
78 | char *fheldaction; | 78 | char *fheldaction; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #endif | 81 | #endif |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 78bc62e..8bff770 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -370,75 +370,75 @@ void Zaurus::buzzer ( int sound ) | |||
370 | volalarm = 0; | 370 | volalarm = 0; |
371 | else if ( volalarm > 100 ) | 371 | else if ( volalarm > 100 ) |
372 | volalarm = 100; | 372 | volalarm = 100; |
373 | volalarm |= ( volalarm << 8 ); | 373 | volalarm |= ( volalarm << 8 ); |
374 | 374 | ||
375 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 375 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
376 | vol_reset = true; | 376 | vol_reset = true; |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | snd. play(); | 380 | snd. play(); |
381 | while ( !snd. isFinished()) | 381 | while ( !snd. isFinished()) |
382 | qApp->processEvents(); | 382 | qApp->processEvents(); |
383 | 383 | ||
384 | if ( fd >= 0 ) { | 384 | if ( fd >= 0 ) { |
385 | if ( vol_reset ) | 385 | if ( vol_reset ) |
386 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 386 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
387 | ::close ( fd ); | 387 | ::close ( fd ); |
388 | } | 388 | } |
389 | } else { | 389 | } else { |
390 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 390 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
391 | 391 | ||
392 | if ( fd >= 0 ) { | 392 | if ( fd >= 0 ) { |
393 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 393 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
394 | ::close ( fd ); | 394 | ::close ( fd ); |
395 | } | 395 | } |
396 | 396 | ||
397 | } | 397 | } |
398 | #endif | 398 | #endif |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void Zaurus::alarmSound() | 402 | void Zaurus::playAlarmSound() |
403 | { | 403 | { |
404 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 404 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
405 | } | 405 | } |
406 | 406 | ||
407 | void Zaurus::touchSound() | 407 | void Zaurus::playTouchSound() |
408 | { | 408 | { |
409 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 409 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
410 | } | 410 | } |
411 | 411 | ||
412 | void Zaurus::keySound() | 412 | void Zaurus::playKeySound() |
413 | { | 413 | { |
414 | buzzer ( SHARP_BUZ_KEYSOUND ); | 414 | buzzer ( SHARP_BUZ_KEYSOUND ); |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | QValueList <OLed> Zaurus::ledList() const | 418 | QValueList <OLed> Zaurus::ledList() const |
419 | { | 419 | { |
420 | QValueList <OLed> vl; | 420 | QValueList <OLed> vl; |
421 | vl << Led_Mail; | 421 | vl << Led_Mail; |
422 | return vl; | 422 | return vl; |
423 | } | 423 | } |
424 | 424 | ||
425 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 425 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
426 | { | 426 | { |
427 | QValueList <OLedState> vl; | 427 | QValueList <OLedState> vl; |
428 | 428 | ||
429 | if ( l == Led_Mail ) | 429 | if ( l == Led_Mail ) |
430 | vl << Led_Off << Led_On << Led_BlinkSlow; | 430 | vl << Led_Off << Led_On << Led_BlinkSlow; |
431 | return vl; | 431 | return vl; |
432 | } | 432 | } |
433 | 433 | ||
434 | OLedState Zaurus::ledState ( OLed which ) const | 434 | OLedState Zaurus::ledState ( OLed which ) const |
435 | { | 435 | { |
436 | if ( which == Led_Mail ) | 436 | if ( which == Led_Mail ) |
437 | return m_leds [0]; | 437 | return m_leds [0]; |
438 | else | 438 | else |
439 | return Led_Off; | 439 | return Led_Off; |
440 | } | 440 | } |
441 | 441 | ||
442 | bool Zaurus::setLedState ( OLed which, OLedState st ) | 442 | bool Zaurus::setLedState ( OLed which, OLedState st ) |
443 | { | 443 | { |
444 | if (!m_embedix) // Currently not supported on non_embedix kernels | 444 | if (!m_embedix) // Currently not supported on non_embedix kernels |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index c07fe07..f5c5172 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -31,66 +31,66 @@ | |||
31 | #define ODEVICE_ZAURUS | 31 | #define ODEVICE_ZAURUS |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | #ifndef ARRAY_SIZE | 35 | #ifndef ARRAY_SIZE |
36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | // _IO and friends are only defined in kernel headers ... | 39 | // _IO and friends are only defined in kernel headers ... |
40 | 40 | ||
41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
42 | 42 | ||
43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
45 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 45 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
47 | 47 | ||
48 | using namespace Opie; | 48 | using namespace Opie; |
49 | 49 | ||
50 | class Zaurus : public ODevice | 50 | class Zaurus : public ODevice |
51 | { | 51 | { |
52 | 52 | ||
53 | protected: | 53 | protected: |
54 | virtual void init(); | 54 | virtual void init(); |
55 | virtual void initButtons(); | 55 | virtual void initButtons(); |
56 | 56 | ||
57 | public: | 57 | public: |
58 | virtual bool setSoftSuspend ( bool soft ); | 58 | virtual bool setSoftSuspend ( bool soft ); |
59 | 59 | ||
60 | virtual bool setDisplayBrightness ( int b ); | 60 | virtual bool setDisplayBrightness ( int b ); |
61 | virtual int displayBrightnessResolution() const; | 61 | virtual int displayBrightnessResolution() const; |
62 | 62 | ||
63 | virtual void alarmSound(); | 63 | virtual void playAlarmSound(); |
64 | virtual void keySound(); | 64 | virtual void playKeySound(); |
65 | virtual void touchSound(); | 65 | virtual void playTouchSound(); |
66 | 66 | ||
67 | virtual QValueList <OLed> ledList() const; | 67 | virtual QValueList <OLed> ledList() const; |
68 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 68 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
69 | virtual OLedState ledState( OLed led ) const; | 69 | virtual OLedState ledState( OLed led ) const; |
70 | virtual bool setLedState( OLed led, OLedState st ); | 70 | virtual bool setLedState( OLed led, OLedState st ); |
71 | 71 | ||
72 | virtual bool hasHingeSensor() const; | 72 | virtual bool hasHingeSensor() const; |
73 | virtual OHingeStatus readHingeSensor(); | 73 | virtual OHingeStatus readHingeSensor(); |
74 | 74 | ||
75 | virtual bool suspend(); | 75 | virtual bool suspend(); |
76 | virtual Transformation rotation() const; | 76 | virtual Transformation rotation() const; |
77 | virtual ODirection direction() const; | 77 | virtual ODirection direction() const; |
78 | 78 | ||
79 | protected: | 79 | protected: |
80 | virtual void buzzer ( int snd ); | 80 | virtual void buzzer ( int snd ); |
81 | 81 | ||
82 | OLedState m_leds [1]; | 82 | OLedState m_leds [1]; |
83 | bool m_embedix; | 83 | bool m_embedix; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct z_button { | 86 | struct z_button { |
87 | Qt::Key code; | 87 | Qt::Key code; |
88 | char *utext; | 88 | char *utext; |
89 | char *pix; | 89 | char *pix; |
90 | char *fpressedservice; | 90 | char *fpressedservice; |
91 | char *fpressedaction; | 91 | char *fpressedaction; |
92 | char *fheldservice; | 92 | char *fheldservice; |
93 | char *fheldaction; | 93 | char *fheldaction; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | #endif | 96 | #endif |