summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
authorkergoth <kergoth>2003-04-18 21:54:43 (UTC)
committer kergoth <kergoth>2003-04-18 21:54:43 (UTC)
commitd0852e67c15c5a973b7bc7f7bee238a6fd00dee6 (patch) (unidiff)
tree68acc72ac204045b2492693ca668ece78e5f3a2c /libopie/odevice.cpp
parent1cdd9c974e621f6992ddc6dfccbc815baebd19ee (diff)
downloadopie-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.
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp10
1 files changed, 10 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
@@ -46,48 +46,49 @@
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
52using namespace Opie; 52using namespace Opie;
53 53
54class ODeviceData { 54class ODeviceData {
55public: 55public:
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
76class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 77class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
77protected: 78protected:
78 virtual void init ( ); 79 virtual void init ( );
79 virtual void initButtons ( ); 80 virtual void initButtons ( );
80 81
81public: 82public:
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
@@ -233,48 +234,49 @@ ODevice *ODevice::inst ( )
233} 234}
234 235
235 236
236/************************************************** 237/**************************************************
237 * 238 *
238 * common 239 * common
239 * 240 *
240 **************************************************/ 241 **************************************************/
241 242
242 243
243ODevice::ODevice ( ) 244ODevice::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
262void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 264void 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
269void ODevice::init ( ) 271void 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 */
276void ODevice::initButtons ( ) 278void ODevice::initButtons ( )
277{ 279{
278 if ( d-> m_buttons ) 280 if ( d-> m_buttons )
279 return; 281 return;
280 282
@@ -449,48 +451,56 @@ QString ODevice::systemString ( ) const
449 * Return System as OSystem value 451 * Return System as OSystem value
450 */ 452 */
451OSystem ODevice::system ( ) const 453OSystem 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 */
459QString ODevice::systemVersionString ( ) const 461QString 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 */
467Transformation ODevice::rotation ( ) const 469Transformation 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 */
477ODirection ODevice::direction ( ) const
478{
479 return d-> m_direction;
480}
481
482/**
473 * This plays an alarmSound 483 * This plays an alarmSound
474 */ 484 */
475void ODevice::alarmSound ( ) 485void 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 */
488void ODevice::keySound ( ) 498void 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}