Diffstat (limited to 'libopie2/opiecore/device/odevice_jornada.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 3acba03..7dbde48 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -1,55 +1,57 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | Copyright (C) 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_jornada.h" | 31 | #include "odevice_jornada.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 <qpe/config.h> | 40 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | ||
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | #include <opie2/oresource.h> | ||
45 | |||
44 | /* STD */ | 46 | /* STD */ |
45 | #include <fcntl.h> | 47 | #include <fcntl.h> |
46 | #include <math.h> | 48 | #include <math.h> |
47 | #include <stdlib.h> | 49 | #include <stdlib.h> |
48 | #include <signal.h> | 50 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 51 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 52 | #include <sys/time.h> |
51 | #include <unistd.h> | 53 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 54 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 55 | #include <linux/soundcard.h> |
54 | #endif | 56 | #endif |
55 | 57 | ||
@@ -103,59 +105,59 @@ struct j_button jornada56x_buttons [] = { | |||
103 | "buttonsettings", "raise()" }, | 105 | "buttonsettings", "raise()" }, |
104 | { Model_Jornada_56x, | 106 | { Model_Jornada_56x, |
105 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), | 107 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), |
106 | "devicebuttons/jornada56x_record", | 108 | "devicebuttons/jornada56x_record", |
107 | "QPE/VMemo", "toggleRecord()", | 109 | "QPE/VMemo", "toggleRecord()", |
108 | "sound", "raise()" }, | 110 | "sound", "raise()" }, |
109 | }; | 111 | }; |
110 | 112 | ||
111 | void Jornada::init(const QString& cpu_info) | 113 | void Jornada::init(const QString& cpu_info) |
112 | { | 114 | { |
113 | d->m_vendorstr = "HP"; | 115 | d->m_vendorstr = "HP"; |
114 | d->m_vendor = Vendor_HP; | 116 | d->m_vendor = Vendor_HP; |
115 | 117 | ||
116 | QString model; | 118 | QString model; |
117 | int loc = cpu_info.find( ":" ); | 119 | int loc = cpu_info.find( ":" ); |
118 | if ( loc != -1 ) | 120 | if ( loc != -1 ) |
119 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 121 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
120 | else | 122 | else |
121 | model = cpu_info; | 123 | model = cpu_info; |
122 | 124 | ||
123 | if ( model == "HP Jornada 56x" ) { | 125 | if ( model == "HP Jornada 56x" ) { |
124 | d->m_modelstr = "Jornada 56x"; | 126 | d->m_modelstr = "Jornada 56x"; |
125 | d->m_model = Model_Jornada_56x; | 127 | d->m_model = Model_Jornada_56x; |
126 | } else if ( model == "HP Jornada 720" ) { | 128 | } else if ( model == "HP Jornada 720" ) { |
127 | d->m_modelstr = "Jornada 720"; | 129 | d->m_modelstr = "Jornada 720"; |
128 | d->m_model = Model_Jornada_720; | 130 | d->m_model = Model_Jornada_720; |
129 | } | 131 | } |
130 | 132 | ||
131 | d->m_rotation = Rot0; //all Jornadas need this rotation | 133 | d->m_rotation = Rot0; //all Jornadas need this rotation |
132 | //Distribution detecting code is now in base class | 134 | //Distribution detecting code is now in base class |
133 | } | 135 | } |
134 | 136 | ||
135 | void Jornada::initButtons() | 137 | void Jornada::initButtons() |
136 | { | 138 | { |
137 | if ( d->m_buttons ) | 139 | if ( d->m_buttons ) |
138 | return; | 140 | return; |
139 | 141 | ||
140 | d->m_buttons = new QValueList <ODeviceButton>; | 142 | d->m_buttons = new QValueList <ODeviceButton>; |
141 | 143 | ||
142 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { | 144 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { |
143 | j_button *ib = jornada56x_buttons + i; | 145 | j_button *ib = jornada56x_buttons + i; |
144 | ODeviceButton b; | 146 | ODeviceButton b; |
145 | 147 | ||
146 | if (( ib->model & d->m_model ) == d->m_model ) { | 148 | if (( ib->model & d->m_model ) == d->m_model ) { |
147 | b. setKeycode ( ib->code ); | 149 | b. setKeycode ( ib->code ); |
148 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 150 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
149 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 151 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); |
150 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 152 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
151 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 153 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
152 | 154 | ||
153 | d->m_buttons->append ( b ); | 155 | d->m_buttons->append ( b ); |
154 | } | 156 | } |
155 | } | 157 | } |
156 | reloadButtonMapping(); | 158 | reloadButtonMapping(); |
157 | } | 159 | } |
158 | 160 | ||
159 | int Jornada::displayBrightnessResolution() const | 161 | int Jornada::displayBrightnessResolution() const |
160 | { | 162 | { |
161 | if ( d->m_model == Model_Jornada_56x ) | 163 | if ( d->m_model == Model_Jornada_56x ) |
@@ -188,26 +190,26 @@ bool Jornada::setDisplayBrightness( int bright ) | |||
188 | } | 190 | } |
189 | 191 | ||
190 | // No Global::shellQuote as we gurantee it to be sane | 192 | // No Global::shellQuote as we gurantee it to be sane |
191 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 193 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
192 | 194 | ||
193 | return res; | 195 | return res; |
194 | } | 196 | } |
195 | 197 | ||
196 | 198 | ||
197 | bool Jornada::setDisplayStatus ( bool on ) | 199 | bool Jornada::setDisplayStatus ( bool on ) |
198 | { | 200 | { |
199 | bool res = false; | 201 | bool res = false; |
200 | 202 | ||
201 | QString cmdline; | 203 | QString cmdline; |
202 | 204 | ||
203 | if ( d->m_model == Model_Jornada_56x ) { | 205 | if ( d->m_model == Model_Jornada_56x ) { |
204 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 206 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
205 | } else if ( d->m_model == Model_Jornada_720 ) { | 207 | } else if ( d->m_model == Model_Jornada_720 ) { |
206 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/e1356fb/power").arg( on ? "0" : "4" ); | 208 | cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/e1356fb/power").arg( on ? "0" : "4" ); |
207 | } | 209 | } |
208 | 210 | ||
209 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 211 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
210 | 212 | ||
211 | return res; | 213 | return res; |
212 | } | 214 | } |
213 | 215 | ||