author | kergoth <kergoth> | 2003-04-18 21:54:43 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-18 21:54:43 (UTC) |
commit | d0852e67c15c5a973b7bc7f7bee238a6fd00dee6 (patch) (unidiff) | |
tree | 68acc72ac204045b2492693ca668ece78e5f3a2c | |
parent | 1cdd9c974e621f6992ddc6dfccbc815baebd19ee (diff) | |
download | opie-d0852e67c15c5a973b7bc7f7bee238a6fd00dee6.zip opie-d0852e67c15c5a973b7bc7f7bee238a6fd00dee6.tar.gz opie-d0852e67c15c5a973b7bc7f7bee238a6fd00dee6.tar.bz2 |
Add rotation direction to ODevice, to ensure the default is appropriate for the hardware in question.
-rw-r--r-- | libopie/odevice.cpp | 10 | ||||
-rw-r--r-- | libopie/odevice.h | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 0e1c0dd..29c8ad2 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -22,96 +22,97 @@ | |||
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include <linux/soundcard.h> | 26 | #include <linux/soundcard.h> |
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 36 | #include <qpe/qcopenvelope_qws.h> |
37 | 37 | ||
38 | #include "odevice.h" | 38 | #include "odevice.h" |
39 | 39 | ||
40 | #include <qwindowsystem_qws.h> | 40 | #include <qwindowsystem_qws.h> |
41 | 41 | ||
42 | 42 | ||
43 | // _IO and friends are only defined in kernel headers ... | 43 | // _IO and friends are only defined in kernel headers ... |
44 | 44 | ||
45 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 45 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
46 | 46 | ||
47 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 47 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
48 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 48 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
49 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 49 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
50 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 50 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
51 | 51 | ||
52 | using namespace Opie; | 52 | using namespace Opie; |
53 | 53 | ||
54 | class ODeviceData { | 54 | class ODeviceData { |
55 | public: | 55 | public: |
56 | bool m_qwsserver : 1; | 56 | bool m_qwsserver : 1; |
57 | 57 | ||
58 | QString m_vendorstr; | 58 | QString m_vendorstr; |
59 | OVendor m_vendor; | 59 | OVendor m_vendor; |
60 | 60 | ||
61 | QString m_modelstr; | 61 | QString m_modelstr; |
62 | OModel m_model; | 62 | OModel m_model; |
63 | 63 | ||
64 | QString m_systemstr; | 64 | QString m_systemstr; |
65 | OSystem m_system; | 65 | OSystem m_system; |
66 | 66 | ||
67 | QString m_sysverstr; | 67 | QString m_sysverstr; |
68 | 68 | ||
69 | Transformation m_rotation; | 69 | Transformation m_rotation; |
70 | ODirection m_direction; | ||
70 | 71 | ||
71 | QValueList <ODeviceButton> *m_buttons; | 72 | QValueList <ODeviceButton> *m_buttons; |
72 | uint m_holdtime; | 73 | uint m_holdtime; |
73 | }; | 74 | }; |
74 | 75 | ||
75 | 76 | ||
76 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 77 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
77 | protected: | 78 | protected: |
78 | virtual void init ( ); | 79 | virtual void init ( ); |
79 | virtual void initButtons ( ); | 80 | virtual void initButtons ( ); |
80 | 81 | ||
81 | public: | 82 | public: |
82 | virtual bool setSoftSuspend ( bool soft ); | 83 | virtual bool setSoftSuspend ( bool soft ); |
83 | 84 | ||
84 | virtual bool setDisplayBrightness ( int b ); | 85 | virtual bool setDisplayBrightness ( int b ); |
85 | virtual int displayBrightnessResolution ( ) const; | 86 | virtual int displayBrightnessResolution ( ) const; |
86 | 87 | ||
87 | virtual void alarmSound ( ); | 88 | virtual void alarmSound ( ); |
88 | 89 | ||
89 | virtual QValueList <OLed> ledList ( ) const; | 90 | virtual QValueList <OLed> ledList ( ) const; |
90 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 91 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
91 | virtual OLedState ledState ( OLed led ) const; | 92 | virtual OLedState ledState ( OLed led ) const; |
92 | virtual bool setLedState ( OLed led, OLedState st ); | 93 | virtual bool setLedState ( OLed led, OLedState st ); |
93 | 94 | ||
94 | virtual bool hasLightSensor ( ) const; | 95 | virtual bool hasLightSensor ( ) const; |
95 | virtual int readLightSensor ( ); | 96 | virtual int readLightSensor ( ); |
96 | virtual int lightSensorResolution ( ) const; | 97 | virtual int lightSensorResolution ( ) const; |
97 | 98 | ||
98 | protected: | 99 | protected: |
99 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 100 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
100 | virtual void timerEvent ( QTimerEvent *te ); | 101 | virtual void timerEvent ( QTimerEvent *te ); |
101 | 102 | ||
102 | int m_power_timer; | 103 | int m_power_timer; |
103 | 104 | ||
104 | OLedState m_leds [2]; | 105 | OLedState m_leds [2]; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | class Zaurus : public ODevice { | 108 | class Zaurus : public ODevice { |
108 | protected: | 109 | protected: |
109 | virtual void init ( ); | 110 | virtual void init ( ); |
110 | virtual void initButtons ( ); | 111 | virtual void initButtons ( ); |
111 | 112 | ||
112 | public: | 113 | public: |
113 | virtual bool setSoftSuspend ( bool soft ); | 114 | virtual bool setSoftSuspend ( bool soft ); |
114 | 115 | ||
115 | virtual bool setDisplayBrightness ( int b ); | 116 | virtual bool setDisplayBrightness ( int b ); |
116 | virtual int displayBrightnessResolution ( ) const; | 117 | virtual int displayBrightnessResolution ( ) const; |
117 | 118 | ||
@@ -209,96 +210,97 @@ static QCString makeChannel ( const char *str ) | |||
209 | if ( str && !::strchr ( str, '/' )) | 210 | if ( str && !::strchr ( str, '/' )) |
210 | return QCString ( "QPE/Application/" ) + str; | 211 | return QCString ( "QPE/Application/" ) + str; |
211 | else | 212 | else |
212 | return str; | 213 | return str; |
213 | } | 214 | } |
214 | 215 | ||
215 | 216 | ||
216 | 217 | ||
217 | 218 | ||
218 | ODevice *ODevice::inst ( ) | 219 | ODevice *ODevice::inst ( ) |
219 | { | 220 | { |
220 | static ODevice *dev = 0; | 221 | static ODevice *dev = 0; |
221 | 222 | ||
222 | if ( !dev ) { | 223 | if ( !dev ) { |
223 | if ( QFile::exists ( "/proc/hal/model" )) | 224 | if ( QFile::exists ( "/proc/hal/model" )) |
224 | dev = new iPAQ ( ); | 225 | dev = new iPAQ ( ); |
225 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 226 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
226 | dev = new Zaurus ( ); | 227 | dev = new Zaurus ( ); |
227 | else | 228 | else |
228 | dev = new ODevice ( ); | 229 | dev = new ODevice ( ); |
229 | 230 | ||
230 | dev-> init ( ); | 231 | dev-> init ( ); |
231 | } | 232 | } |
232 | return dev; | 233 | return dev; |
233 | } | 234 | } |
234 | 235 | ||
235 | 236 | ||
236 | /************************************************** | 237 | /************************************************** |
237 | * | 238 | * |
238 | * common | 239 | * common |
239 | * | 240 | * |
240 | **************************************************/ | 241 | **************************************************/ |
241 | 242 | ||
242 | 243 | ||
243 | ODevice::ODevice ( ) | 244 | ODevice::ODevice ( ) |
244 | { | 245 | { |
245 | d = new ODeviceData; | 246 | d = new ODeviceData; |
246 | 247 | ||
247 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 248 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
248 | 249 | ||
249 | d-> m_modelstr = "Unknown"; | 250 | d-> m_modelstr = "Unknown"; |
250 | d-> m_model = Model_Unknown; | 251 | d-> m_model = Model_Unknown; |
251 | d-> m_vendorstr = "Unknown"; | 252 | d-> m_vendorstr = "Unknown"; |
252 | d-> m_vendor = Vendor_Unknown; | 253 | d-> m_vendor = Vendor_Unknown; |
253 | d-> m_systemstr = "Unknown"; | 254 | d-> m_systemstr = "Unknown"; |
254 | d-> m_system = System_Unknown; | 255 | d-> m_system = System_Unknown; |
255 | d-> m_sysverstr = "0.0"; | 256 | d-> m_sysverstr = "0.0"; |
256 | d-> m_rotation = Rot0; | 257 | d-> m_rotation = Rot0; |
258 | d-> m_direction = CW; | ||
257 | 259 | ||
258 | d-> m_holdtime = 1000; // 1000ms | 260 | d-> m_holdtime = 1000; // 1000ms |
259 | d-> m_buttons = 0; | 261 | d-> m_buttons = 0; |
260 | } | 262 | } |
261 | 263 | ||
262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 264 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
263 | { | 265 | { |
264 | if ( msg == "deviceButtonMappingChanged()" ) { | 266 | if ( msg == "deviceButtonMappingChanged()" ) { |
265 | reloadButtonMapping ( ); | 267 | reloadButtonMapping ( ); |
266 | } | 268 | } |
267 | } | 269 | } |
268 | 270 | ||
269 | void ODevice::init ( ) | 271 | void ODevice::init ( ) |
270 | { | 272 | { |
271 | } | 273 | } |
272 | 274 | ||
273 | /** | 275 | /** |
274 | * This method initialises the button mapping | 276 | * This method initialises the button mapping |
275 | */ | 277 | */ |
276 | void ODevice::initButtons ( ) | 278 | void ODevice::initButtons ( ) |
277 | { | 279 | { |
278 | if ( d-> m_buttons ) | 280 | if ( d-> m_buttons ) |
279 | return; | 281 | return; |
280 | 282 | ||
281 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 283 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
282 | 284 | ||
283 | // Simulation uses iPAQ 3660 device buttons | 285 | // Simulation uses iPAQ 3660 device buttons |
284 | 286 | ||
285 | qDebug ( "init Buttons" ); | 287 | qDebug ( "init Buttons" ); |
286 | d-> m_buttons = new QValueList <ODeviceButton>; | 288 | d-> m_buttons = new QValueList <ODeviceButton>; |
287 | 289 | ||
288 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 290 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
289 | i_button *ib = ipaq_buttons + i; | 291 | i_button *ib = ipaq_buttons + i; |
290 | ODeviceButton b; | 292 | ODeviceButton b; |
291 | 293 | ||
292 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 294 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
293 | b. setKeycode ( ib-> code ); | 295 | b. setKeycode ( ib-> code ); |
294 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 296 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
295 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 297 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
296 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 298 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
297 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 299 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
298 | d-> m_buttons-> append ( b ); | 300 | d-> m_buttons-> append ( b ); |
299 | } | 301 | } |
300 | } | 302 | } |
301 | reloadButtonMapping ( ); | 303 | reloadButtonMapping ( ); |
302 | 304 | ||
303 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 305 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
304 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 306 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
@@ -425,96 +427,104 @@ OVendor ODevice::vendor ( ) const | |||
425 | * @return A string representing the model | 427 | * @return A string representing the model |
426 | */ | 428 | */ |
427 | QString ODevice::modelString ( ) const | 429 | QString ODevice::modelString ( ) const |
428 | { | 430 | { |
429 | return d-> m_modelstr; | 431 | return d-> m_modelstr; |
430 | } | 432 | } |
431 | 433 | ||
432 | /** | 434 | /** |
433 | * This does return the OModel used | 435 | * This does return the OModel used |
434 | */ | 436 | */ |
435 | OModel ODevice::model ( ) const | 437 | OModel ODevice::model ( ) const |
436 | { | 438 | { |
437 | return d-> m_model; | 439 | return d-> m_model; |
438 | } | 440 | } |
439 | 441 | ||
440 | /** | 442 | /** |
441 | * This does return the systen name | 443 | * This does return the systen name |
442 | */ | 444 | */ |
443 | QString ODevice::systemString ( ) const | 445 | QString ODevice::systemString ( ) const |
444 | { | 446 | { |
445 | return d-> m_systemstr; | 447 | return d-> m_systemstr; |
446 | } | 448 | } |
447 | 449 | ||
448 | /** | 450 | /** |
449 | * Return System as OSystem value | 451 | * Return System as OSystem value |
450 | */ | 452 | */ |
451 | OSystem ODevice::system ( ) const | 453 | OSystem ODevice::system ( ) const |
452 | { | 454 | { |
453 | return d-> m_system; | 455 | return d-> m_system; |
454 | } | 456 | } |
455 | 457 | ||
456 | /** | 458 | /** |
457 | * @return the version string of the base system | 459 | * @return the version string of the base system |
458 | */ | 460 | */ |
459 | QString ODevice::systemVersionString ( ) const | 461 | QString ODevice::systemVersionString ( ) const |
460 | { | 462 | { |
461 | return d-> m_sysverstr; | 463 | return d-> m_sysverstr; |
462 | } | 464 | } |
463 | 465 | ||
464 | /** | 466 | /** |
465 | * @return the current Transformation | 467 | * @return the current Transformation |
466 | */ | 468 | */ |
467 | Transformation ODevice::rotation ( ) const | 469 | Transformation ODevice::rotation ( ) const |
468 | { | 470 | { |
469 | return d-> m_rotation; | 471 | return d-> m_rotation; |
470 | } | 472 | } |
471 | 473 | ||
472 | /** | 474 | /** |
475 | * @return the current rotation direction | ||
476 | */ | ||
477 | ODirection ODevice::direction ( ) const | ||
478 | { | ||
479 | return d-> m_direction; | ||
480 | } | ||
481 | |||
482 | /** | ||
473 | * This plays an alarmSound | 483 | * This plays an alarmSound |
474 | */ | 484 | */ |
475 | void ODevice::alarmSound ( ) | 485 | void ODevice::alarmSound ( ) |
476 | { | 486 | { |
477 | #ifndef QT_NO_SOUND | 487 | #ifndef QT_NO_SOUND |
478 | static Sound snd ( "alarm" ); | 488 | static Sound snd ( "alarm" ); |
479 | 489 | ||
480 | if ( snd. isFinished ( )) | 490 | if ( snd. isFinished ( )) |
481 | snd. play ( ); | 491 | snd. play ( ); |
482 | #endif | 492 | #endif |
483 | } | 493 | } |
484 | 494 | ||
485 | /** | 495 | /** |
486 | * This plays a key sound | 496 | * This plays a key sound |
487 | */ | 497 | */ |
488 | void ODevice::keySound ( ) | 498 | void ODevice::keySound ( ) |
489 | { | 499 | { |
490 | #ifndef QT_NO_SOUND | 500 | #ifndef QT_NO_SOUND |
491 | static Sound snd ( "keysound" ); | 501 | static Sound snd ( "keysound" ); |
492 | 502 | ||
493 | if ( snd. isFinished ( )) | 503 | if ( snd. isFinished ( )) |
494 | snd. play ( ); | 504 | snd. play ( ); |
495 | #endif | 505 | #endif |
496 | } | 506 | } |
497 | 507 | ||
498 | /** | 508 | /** |
499 | * This plays a touch sound | 509 | * This plays a touch sound |
500 | */ | 510 | */ |
501 | void ODevice::touchSound ( ) | 511 | void ODevice::touchSound ( ) |
502 | { | 512 | { |
503 | 513 | ||
504 | #ifndef QT_NO_SOUND | 514 | #ifndef QT_NO_SOUND |
505 | static Sound snd ( "touchsound" ); | 515 | static Sound snd ( "touchsound" ); |
506 | 516 | ||
507 | if ( snd. isFinished ( )) | 517 | if ( snd. isFinished ( )) |
508 | snd. play ( ); | 518 | snd. play ( ); |
509 | #endif | 519 | #endif |
510 | } | 520 | } |
511 | 521 | ||
512 | /** | 522 | /** |
513 | * This method will return a list of leds | 523 | * This method will return a list of leds |
514 | * available on this device | 524 | * available on this device |
515 | * @return a list of LEDs. | 525 | * @return a list of LEDs. |
516 | */ | 526 | */ |
517 | QValueList <OLed> ODevice::ledList ( ) const | 527 | QValueList <OLed> ODevice::ledList ( ) const |
518 | { | 528 | { |
519 | return QValueList <OLed> ( ); | 529 | return QValueList <OLed> ( ); |
520 | } | 530 | } |
diff --git a/libopie/odevice.h b/libopie/odevice.h index 45a790b..0c55ea0 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -58,143 +58,150 @@ enum OModel { | |||
58 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), | 58 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * The vendor of the device | 62 | * The vendor of the device |
63 | */ | 63 | */ |
64 | enum OVendor { | 64 | enum OVendor { |
65 | Vendor_Unknown, | 65 | Vendor_Unknown, |
66 | 66 | ||
67 | Vendor_HP, | 67 | Vendor_HP, |
68 | Vendor_Sharp | 68 | Vendor_Sharp |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * The System used | 72 | * The System used |
73 | */ | 73 | */ |
74 | enum OSystem { | 74 | enum OSystem { |
75 | System_Unknown, | 75 | System_Unknown, |
76 | 76 | ||
77 | System_Familiar, | 77 | System_Familiar, |
78 | System_Zaurus, | 78 | System_Zaurus, |
79 | System_OpenZaurus | 79 | System_OpenZaurus |
80 | }; | 80 | }; |
81 | 81 | ||
82 | enum OLedState { | 82 | enum OLedState { |
83 | Led_Off, | 83 | Led_Off, |
84 | Led_On, | 84 | Led_On, |
85 | Led_BlinkSlow, | 85 | Led_BlinkSlow, |
86 | Led_BlinkFast | 86 | Led_BlinkFast |
87 | }; | 87 | }; |
88 | 88 | ||
89 | enum OLed { | 89 | enum OLed { |
90 | Led_Mail, | 90 | Led_Mail, |
91 | Led_Power, | 91 | Led_Power, |
92 | Led_BlueTooth | 92 | Led_BlueTooth |
93 | }; | 93 | }; |
94 | 94 | ||
95 | enum OHardKey { | 95 | enum OHardKey { |
96 | HardKey_Datebook = Qt::Key_F9, | 96 | HardKey_Datebook = Qt::Key_F9, |
97 | HardKey_Contacts = Qt::Key_F10, | 97 | HardKey_Contacts = Qt::Key_F10, |
98 | HardKey_Menu = Qt::Key_F11, | 98 | HardKey_Menu = Qt::Key_F11, |
99 | HardKey_Home = Qt::Key_F12, | 99 | HardKey_Home = Qt::Key_F12, |
100 | HardKey_Mail = Qt::Key_F13, | 100 | HardKey_Mail = Qt::Key_F13, |
101 | HardKey_Record = Qt::Key_F24, | 101 | HardKey_Record = Qt::Key_F24, |
102 | HardKey_Suspend = Qt::Key_F34, | 102 | HardKey_Suspend = Qt::Key_F34, |
103 | HardKey_Backlight = Qt::Key_F35, | 103 | HardKey_Backlight = Qt::Key_F35, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | enum ODirection { | ||
107 | CW = 0, | ||
108 | CCW = 1, | ||
109 | Flip = 2, | ||
110 | }; | ||
111 | |||
106 | /** | 112 | /** |
107 | * A singleton which gives informations about device specefic option | 113 | * A singleton which gives informations about device specefic option |
108 | * like the Hardware used, LEDs, the Base Distribution and | 114 | * like the Hardware used, LEDs, the Base Distribution and |
109 | * hardware key mappings. | 115 | * hardware key mappings. |
110 | * | 116 | * |
111 | * | 117 | * |
112 | * @short A small class for device specefic options | 118 | * @short A small class for device specefic options |
113 | * @see QObject | 119 | * @see QObject |
114 | * @author Robert Griebl | 120 | * @author Robert Griebl |
115 | * @version 1.0 | 121 | * @version 1.0 |
116 | */ | 122 | */ |
117 | class ODevice : public QObject { | 123 | class ODevice : public QObject { |
118 | Q_OBJECT | 124 | Q_OBJECT |
119 | 125 | ||
120 | private: | 126 | private: |
121 | /* disable copy */ | 127 | /* disable copy */ |
122 | ODevice ( const ODevice & ); | 128 | ODevice ( const ODevice & ); |
123 | 129 | ||
124 | protected: | 130 | protected: |
125 | ODevice ( ); | 131 | ODevice ( ); |
126 | virtual void init ( ); | 132 | virtual void init ( ); |
127 | virtual void initButtons ( ); | 133 | virtual void initButtons ( ); |
128 | 134 | ||
129 | ODeviceData *d; | 135 | ODeviceData *d; |
130 | 136 | ||
131 | public: | 137 | public: |
132 | // sandman do we want to allow destructions? -zecke? | 138 | // sandman do we want to allow destructions? -zecke? |
133 | virtual ~ODevice ( ); | 139 | virtual ~ODevice ( ); |
134 | 140 | ||
135 | 141 | ||
136 | static ODevice *inst ( ); | 142 | static ODevice *inst ( ); |
137 | 143 | ||
138 | // information | 144 | // information |
139 | 145 | ||
140 | QString modelString ( ) const; | 146 | QString modelString ( ) const; |
141 | OModel model ( ) const; | 147 | OModel model ( ) const; |
142 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 148 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
143 | 149 | ||
144 | QString vendorString ( ) const; | 150 | QString vendorString ( ) const; |
145 | OVendor vendor ( ) const; | 151 | OVendor vendor ( ) const; |
146 | 152 | ||
147 | QString systemString ( ) const; | 153 | QString systemString ( ) const; |
148 | OSystem system ( ) const; | 154 | OSystem system ( ) const; |
149 | 155 | ||
150 | QString systemVersionString ( ) const; | 156 | QString systemVersionString ( ) const; |
151 | 157 | ||
152 | Transformation rotation ( ) const; | 158 | Transformation rotation ( ) const; |
159 | ODirection direction ( ) const; | ||
153 | 160 | ||
154 | // system | 161 | // system |
155 | 162 | ||
156 | virtual bool setSoftSuspend ( bool on ); | 163 | virtual bool setSoftSuspend ( bool on ); |
157 | virtual bool suspend ( ); | 164 | virtual bool suspend ( ); |
158 | 165 | ||
159 | virtual bool setDisplayStatus ( bool on ); | 166 | virtual bool setDisplayStatus ( bool on ); |
160 | virtual bool setDisplayBrightness ( int brightness ); | 167 | virtual bool setDisplayBrightness ( int brightness ); |
161 | virtual int displayBrightnessResolution ( ) const; | 168 | virtual int displayBrightnessResolution ( ) const; |
162 | 169 | ||
163 | // input / output | 170 | // input / output |
164 | //FIXME playAlarmSound and al might be better -zecke | 171 | //FIXME playAlarmSound and al might be better -zecke |
165 | virtual void alarmSound ( ); | 172 | virtual void alarmSound ( ); |
166 | virtual void keySound ( ); | 173 | virtual void keySound ( ); |
167 | virtual void touchSound ( ); | 174 | virtual void touchSound ( ); |
168 | 175 | ||
169 | virtual QValueList <OLed> ledList ( ) const; | 176 | virtual QValueList <OLed> ledList ( ) const; |
170 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 177 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
171 | virtual OLedState ledState ( OLed led ) const; | 178 | virtual OLedState ledState ( OLed led ) const; |
172 | virtual bool setLedState ( OLed led, OLedState st ); | 179 | virtual bool setLedState ( OLed led, OLedState st ); |
173 | 180 | ||
174 | virtual bool hasLightSensor ( ) const; | 181 | virtual bool hasLightSensor ( ) const; |
175 | virtual int readLightSensor ( ); | 182 | virtual int readLightSensor ( ); |
176 | virtual int lightSensorResolution ( ) const; | 183 | virtual int lightSensorResolution ( ) const; |
177 | 184 | ||
178 | /** | 185 | /** |
179 | * Returns the available buttons on this device. The number and location | 186 | * Returns the available buttons on this device. The number and location |
180 | * of buttons will vary depending on the device. Button numbers will be assigned | 187 | * of buttons will vary depending on the device. Button numbers will be assigned |
181 | * by the device manufacturer and will be from most preferred button to least preffered | 188 | * by the device manufacturer and will be from most preferred button to least preffered |
182 | * button. Note that this list only contains "user mappable" buttons. | 189 | * button. Note that this list only contains "user mappable" buttons. |
183 | */ | 190 | */ |
184 | const QValueList<ODeviceButton> &buttons ( ); | 191 | const QValueList<ODeviceButton> &buttons ( ); |
185 | 192 | ||
186 | /** | 193 | /** |
187 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 194 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
188 | * returns 0L | 195 | * returns 0L |
189 | */ | 196 | */ |
190 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 197 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
191 | 198 | ||
192 | /** | 199 | /** |
193 | * Reassigns the pressed action for \a button. To return to the factory | 200 | * Reassigns the pressed action for \a button. To return to the factory |
194 | * default pass an empty string as \a qcopMessage. | 201 | * default pass an empty string as \a qcopMessage. |
195 | */ | 202 | */ |
196 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 203 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
197 | 204 | ||
198 | /** | 205 | /** |
199 | * Reassigns the held action for \a button. To return to the factory | 206 | * Reassigns the held action for \a button. To return to the factory |
200 | * default pass an empty string as \a qcopMessage. | 207 | * default pass an empty string as \a qcopMessage. |