Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index e9b163a..1742100 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,53 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | |
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | ||
4 | =. | 5 | =. |
5 | .=l. | 6 | .=l. |
6 | .>+-= | 7 | Â Â Â Â Â Â .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
13 | .%`+i> _;_. | 14 | Â Â .%`+i> Â Â Â _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
20 | ++= -. .` .: details. | 21 | ++= Â -. Â Â .` Â Â .: details. |
21 | : = ...= . :.=- | 22 | : Â Â = Â ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 24 | Â -_. . . Â )=. Â = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
28 | */ | 29 | */ |
29 | 30 | ||
30 | #include "odevice_zaurus.h" | 31 | #include "odevice_zaurus.h" |
31 | 32 | ||
32 | /* QT */ | 33 | /* QT */ |
33 | #include <qapplication.h> | 34 | #include <qapplication.h> |
34 | #include <qfile.h> | 35 | #include <qfile.h> |
35 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
37 | 38 | ||
38 | /* OPIE */ | 39 | /* OPIE */ |
39 | #include <opie2/oinputsystem.h> | 40 | #include <opie2/oinputsystem.h> |
41 | #include <opie2/oresource.h> | ||
42 | |||
40 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
41 | #include <qpe/resource.h> | ||
42 | #include <qpe/sound.h> | 44 | #include <qpe/sound.h> |
43 | #include <qpe/qcopenvelope_qws.h> | 45 | #include <qpe/qcopenvelope_qws.h> |
44 | 46 | ||
45 | /* STD */ | 47 | /* STD */ |
46 | #include <fcntl.h> | 48 | #include <fcntl.h> |
47 | #include <math.h> | 49 | #include <math.h> |
48 | #include <stdlib.h> | 50 | #include <stdlib.h> |
49 | #include <signal.h> | 51 | #include <signal.h> |
50 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> |
51 | #include <sys/time.h> | 53 | #include <sys/time.h> |
52 | #include <unistd.h> | 54 | #include <unistd.h> |
53 | #ifndef QT_NO_SOUND | 55 | #ifndef QT_NO_SOUND |
@@ -227,45 +229,45 @@ void Zaurus::init(const QString& cpu_info) | |||
227 | void Zaurus::initButtons() | 229 | void Zaurus::initButtons() |
228 | { | 230 | { |
229 | if ( d->m_buttons ) | 231 | if ( d->m_buttons ) |
230 | return; | 232 | return; |
231 | 233 | ||
232 | 234 | ||
233 | d->m_buttons = new QValueList <ODeviceButton>; | 235 | d->m_buttons = new QValueList <ODeviceButton>; |
234 | 236 | ||
235 | struct z_button * pz_buttons; | 237 | struct z_button * pz_buttons; |
236 | int buttoncount; | 238 | int buttoncount; |
237 | switch ( d->m_model ) { | 239 | switch ( d->m_model ) { |
238 | case Model_Zaurus_SLC3000: // fallthrough | 240 | case Model_Zaurus_SLC3000: // fallthrough |
239 | case Model_Zaurus_SLC1000: // fallthrough | 241 | case Model_Zaurus_SLC1000: // fallthrough |
240 | case Model_Zaurus_SLC7x0: | 242 | case Model_Zaurus_SLC7x0: |
241 | if ( isQWS( ) ) { | 243 | if ( isQWS( ) ) { |
242 | addPreHandler(this); // hinge-sensor-handler | 244 | addPreHandler(this); // hinge-sensor-handler |
243 | } | 245 | } |
244 | pz_buttons = z_buttons_c700; | 246 | pz_buttons = z_buttons_c700; |
245 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 247 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
246 | break; | 248 | break; |
247 | default: | 249 | default: |
248 | pz_buttons = z_buttons; | 250 | pz_buttons = z_buttons; |
249 | buttoncount = ARRAY_SIZE(z_buttons); | 251 | buttoncount = ARRAY_SIZE(z_buttons); |
250 | break; | 252 | break; |
251 | } | 253 | } |
252 | 254 | ||
253 | for ( int i = 0; i < buttoncount; i++ ) { | 255 | for ( int i = 0; i < buttoncount; i++ ) { |
254 | struct z_button *zb = pz_buttons + i; | 256 | struct z_button *zb = pz_buttons + i; |
255 | ODeviceButton b; | 257 | ODeviceButton b; |
256 | 258 | ||
257 | b.setKeycode( zb->code ); | 259 | b.setKeycode( zb->code ); |
258 | b.setUserText( QObject::tr( "Button", zb->utext )); | 260 | b.setUserText( QObject::tr( "Button", zb->utext )); |
259 | b.setPixmap( Resource::loadPixmap( zb->pix )); | 261 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
260 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 262 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
261 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 263 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
262 | d->m_buttons->append( b ); | 264 | d->m_buttons->append( b ); |
263 | } | 265 | } |
264 | 266 | ||
265 | reloadButtonMapping(); | 267 | reloadButtonMapping(); |
266 | } | 268 | } |
267 | 269 | ||
268 | 270 | ||
269 | 271 | ||
270 | typedef struct sharp_led_status { | 272 | typedef struct sharp_led_status { |
271 | int which; /* select which LED status is wanted. */ | 273 | int which; /* select which LED status is wanted. */ |
@@ -480,25 +482,25 @@ bool Zaurus::setDisplayStatus( bool on ) | |||
480 | } | 482 | } |
481 | } | 483 | } |
482 | return res; | 484 | return res; |
483 | } | 485 | } |
484 | 486 | ||
485 | Transformation Zaurus::rotation() const | 487 | Transformation Zaurus::rotation() const |
486 | { | 488 | { |
487 | qDebug( "Zaurus::rotation()" ); | 489 | qDebug( "Zaurus::rotation()" ); |
488 | Transformation rot; | 490 | Transformation rot; |
489 | 491 | ||
490 | switch ( d->m_model ) { | 492 | switch ( d->m_model ) { |
491 | case Model_Zaurus_SLC3000: // fallthrough | 493 | case Model_Zaurus_SLC3000: // fallthrough |
492 | case Model_Zaurus_SLC1000: // fallthrough | 494 | case Model_Zaurus_SLC1000: // fallthrough |
493 | case Model_Zaurus_SLC7x0: | 495 | case Model_Zaurus_SLC7x0: |
494 | { | 496 | { |
495 | OHingeStatus hs = readHingeSensor(); | 497 | OHingeStatus hs = readHingeSensor(); |
496 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 498 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
497 | 499 | ||
498 | if ( m_embedix ) | 500 | if ( m_embedix ) |
499 | { | 501 | { |
500 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 502 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
501 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 503 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
502 | else rot = Rot270; | 504 | else rot = Rot270; |
503 | } | 505 | } |
504 | else | 506 | else |
@@ -518,25 +520,25 @@ Transformation Zaurus::rotation() const | |||
518 | rot = d->m_rotation; | 520 | rot = d->m_rotation; |
519 | break; | 521 | break; |
520 | } | 522 | } |
521 | 523 | ||
522 | return rot; | 524 | return rot; |
523 | } | 525 | } |
524 | ODirection Zaurus::direction() const | 526 | ODirection Zaurus::direction() const |
525 | { | 527 | { |
526 | ODirection dir; | 528 | ODirection dir; |
527 | 529 | ||
528 | switch ( d->m_model ) { | 530 | switch ( d->m_model ) { |
529 | case Model_Zaurus_SLC3000: // fallthrough | 531 | case Model_Zaurus_SLC3000: // fallthrough |
530 | case Model_Zaurus_SLC1000: // fallthrough | 532 | case Model_Zaurus_SLC1000: // fallthrough |
531 | case Model_Zaurus_SLC7x0: { | 533 | case Model_Zaurus_SLC7x0: { |
532 | OHingeStatus hs = readHingeSensor(); | 534 | OHingeStatus hs = readHingeSensor(); |
533 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 535 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
534 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 536 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
535 | else dir = CW; | 537 | else dir = CW; |
536 | } | 538 | } |
537 | break; | 539 | break; |
538 | case Model_Zaurus_SL6000: | 540 | case Model_Zaurus_SL6000: |
539 | case Model_Zaurus_SLA300: | 541 | case Model_Zaurus_SLA300: |
540 | case Model_Zaurus_SLB600: | 542 | case Model_Zaurus_SLB600: |
541 | case Model_Zaurus_SL5500: | 543 | case Model_Zaurus_SL5500: |
542 | case Model_Zaurus_SL5000: | 544 | case Model_Zaurus_SL5000: |