Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 8f5be8b..e4233eb 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,534 +1,536 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> | 3 | =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | 30 | ||
31 | #include "odevice_beagle.h" | 31 | #include "odevice_beagle.h" |
32 | #include "odevice_ipaq.h" | 32 | #include "odevice_ipaq.h" |
33 | #include "odevice_mypal.h" | 33 | #include "odevice_mypal.h" |
34 | #include "odevice_jornada.h" | 34 | #include "odevice_jornada.h" |
35 | #include "odevice_ramses.h" | 35 | #include "odevice_ramses.h" |
36 | #include "odevice_simpad.h" | 36 | #include "odevice_simpad.h" |
37 | #include "odevice_yopy.h" | 37 | #include "odevice_yopy.h" |
38 | #include "odevice_zaurus.h" | 38 | #include "odevice_zaurus.h" |
39 | #include "odevice_genuineintel.h" | 39 | #include "odevice_genuineintel.h" |
40 | #include "odevice_htc.h" | 40 | #include "odevice_htc.h" |
41 | #include "odevice_motorola_ezx.h" | 41 | #include "odevice_motorola_ezx.h" |
42 | #include "odevice_palm.h" | ||
42 | 43 | ||
43 | /* QT */ | 44 | /* QT */ |
44 | #include <qapplication.h> | 45 | #include <qapplication.h> |
45 | #include <qfile.h> | 46 | #include <qfile.h> |
46 | #include <qtextstream.h> | 47 | #include <qtextstream.h> |
47 | #include <qwindowsystem_qws.h> | 48 | #include <qwindowsystem_qws.h> |
48 | 49 | ||
49 | /* OPIE */ | 50 | /* OPIE */ |
50 | #include <qpe/config.h> | 51 | #include <qpe/config.h> |
51 | #include <qpe/sound.h> | 52 | #include <qpe/sound.h> |
52 | #include <qpe/qcopenvelope_qws.h> | 53 | #include <qpe/qcopenvelope_qws.h> |
53 | #include <qpe/sound.h> | 54 | #include <qpe/sound.h> |
54 | 55 | ||
55 | #include <opie2/okeyfilter.h> | 56 | #include <opie2/okeyfilter.h> |
56 | #include <opie2/oresource.h> | 57 | #include <opie2/oresource.h> |
57 | 58 | ||
58 | /* STD */ | 59 | /* STD */ |
59 | #include <fcntl.h> | 60 | #include <fcntl.h> |
60 | #include <math.h> | 61 | #include <math.h> |
61 | #include <stdlib.h> | 62 | #include <stdlib.h> |
62 | #include <signal.h> | 63 | #include <signal.h> |
63 | #include <sys/ioctl.h> | 64 | #include <sys/ioctl.h> |
64 | #include <sys/time.h> | 65 | #include <sys/time.h> |
65 | #include <unistd.h> | 66 | #include <unistd.h> |
66 | #ifndef QT_NO_SOUND | 67 | #ifndef QT_NO_SOUND |
67 | #include <linux/soundcard.h> | 68 | #include <linux/soundcard.h> |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | namespace Opie { | 71 | namespace Opie { |
71 | namespace Core { | 72 | namespace Core { |
72 | 73 | ||
73 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 74 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
74 | 75 | ||
75 | 76 | ||
76 | /* STATIC and common implementation */ | 77 | /* STATIC and common implementation */ |
77 | /* EXPORT */ ODistribution distributions[] = { | 78 | /* EXPORT */ ODistribution distributions[] = { |
78 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 79 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
79 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, | 80 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, |
80 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 81 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
81 | { System_Unknown, "Linux", "/etc/issue" }, | 82 | { System_Unknown, "Linux", "/etc/issue" }, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | 85 | ||
85 | /* EXPORT */ bool isQWS(){ | 86 | /* EXPORT */ bool isQWS(){ |
86 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 87 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
87 | } | 88 | } |
88 | 89 | ||
89 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 90 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
90 | if ( str && !::strchr ( str, '/' )) | 91 | if ( str && !::strchr ( str, '/' )) |
91 | return QCString ( "QPE/Application/" ) + str; | 92 | return QCString ( "QPE/Application/" ) + str; |
92 | else | 93 | else |
93 | return str; | 94 | return str; |
94 | } | 95 | } |
95 | 96 | ||
96 | 97 | ||
97 | 98 | ||
98 | /* Now the default implementation of ODevice */ | 99 | /* Now the default implementation of ODevice */ |
99 | 100 | ||
100 | struct default_button default_buttons [] = { | 101 | struct default_button default_buttons [] = { |
101 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 102 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
102 | "devicebuttons/z_calendar", | 103 | "devicebuttons/z_calendar", |
103 | "datebook", "nextView()", | 104 | "datebook", "nextView()", |
104 | "today", "raise()" }, | 105 | "today", "raise()" }, |
105 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 106 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
106 | "devicebuttons/z_contact", | 107 | "devicebuttons/z_contact", |
107 | "addressbook", "raise()", | 108 | "addressbook", "raise()", |
108 | "addressbook", "beamBusinessCard()" }, | 109 | "addressbook", "beamBusinessCard()" }, |
109 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 110 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
110 | "devicebuttons/z_home", | 111 | "devicebuttons/z_home", |
111 | "QPE/Launcher", "home()", | 112 | "QPE/Launcher", "home()", |
112 | "buttonsettings", "raise()" }, | 113 | "buttonsettings", "raise()" }, |
113 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 114 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
114 | "devicebuttons/z_menu", | 115 | "devicebuttons/z_menu", |
115 | "QPE/TaskBar", "toggleMenu()", | 116 | "QPE/TaskBar", "toggleMenu()", |
116 | "QPE/TaskBar", "toggleStartMenu()" }, | 117 | "QPE/TaskBar", "toggleStartMenu()" }, |
117 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 118 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
118 | "devicebuttons/z_mail", | 119 | "devicebuttons/z_mail", |
119 | "opiemail", "raise()", | 120 | "opiemail", "raise()", |
120 | "opiemail", "newMail()" }, | 121 | "opiemail", "newMail()" }, |
121 | }; | 122 | }; |
122 | 123 | ||
123 | ODevice *ODevice::inst() | 124 | ODevice *ODevice::inst() |
124 | { | 125 | { |
125 | static ODevice *dev = 0; | 126 | static ODevice *dev = 0; |
126 | QString cpu_info; | 127 | QString cpu_info; |
127 | 128 | ||
128 | if ( !dev ) | 129 | if ( !dev ) |
129 | { | 130 | { |
130 | QFile f( PATH_PROC_CPUINFO ); | 131 | QFile f( PATH_PROC_CPUINFO ); |
131 | if ( f.open( IO_ReadOnly ) ) | 132 | if ( f.open( IO_ReadOnly ) ) |
132 | { | 133 | { |
133 | QTextStream s( &f ); | 134 | QTextStream s( &f ); |
134 | while ( !s.atEnd() ) | 135 | while ( !s.atEnd() ) |
135 | { | 136 | { |
136 | QString line; | 137 | QString line; |
137 | line = s.readLine(); | 138 | line = s.readLine(); |
138 | if ( line.startsWith( "Hardware" ) ) | 139 | if ( line.startsWith( "Hardware" ) ) |
139 | { | 140 | { |
140 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 141 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
141 | cpu_info = line; | 142 | cpu_info = line; |
142 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 143 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
143 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 144 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
144 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); | 145 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); |
145 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 146 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
146 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 147 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
147 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 148 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
148 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 149 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
149 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); | 150 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); |
150 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); | 151 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); |
152 | else if ( line.contains( "Palm", false ) ) dev = new Internal::Palm(); | ||
151 | 153 | ||
152 | else qWarning( "ODevice() - unknown hardware - using default." ); | 154 | else qWarning( "ODevice() - unknown hardware - using default." ); |
153 | break; | 155 | break; |
154 | } else if ( line.startsWith( "vendor_id" ) ) { | 156 | } else if ( line.startsWith( "vendor_id" ) ) { |
155 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 157 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
156 | cpu_info = line; | 158 | cpu_info = line; |
157 | if( line.contains( "genuineintel", false ) ) { | 159 | if( line.contains( "genuineintel", false ) ) { |
158 | dev = new Internal::GenuineIntel(); | 160 | dev = new Internal::GenuineIntel(); |
159 | break; | 161 | break; |
160 | } | 162 | } |
161 | } | 163 | } |
162 | } | 164 | } |
163 | } | 165 | } |
164 | else | 166 | else |
165 | { | 167 | { |
166 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 168 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
167 | } | 169 | } |
168 | if ( !dev ) dev = new ODevice(); | 170 | if ( !dev ) dev = new ODevice(); |
169 | dev->init(cpu_info); | 171 | dev->init(cpu_info); |
170 | } | 172 | } |
171 | return dev; | 173 | return dev; |
172 | } | 174 | } |
173 | 175 | ||
174 | ODevice::ODevice() | 176 | ODevice::ODevice() |
175 | { | 177 | { |
176 | d = new ODeviceData; | 178 | d = new ODeviceData; |
177 | 179 | ||
178 | d->m_modelstr = "Unknown"; | 180 | d->m_modelstr = "Unknown"; |
179 | d->m_model = Model_Unknown; | 181 | d->m_model = Model_Unknown; |
180 | d->m_vendorstr = "Unknown"; | 182 | d->m_vendorstr = "Unknown"; |
181 | d->m_vendor = Vendor_Unknown; | 183 | d->m_vendor = Vendor_Unknown; |
182 | d->m_systemstr = "Unknown"; | 184 | d->m_systemstr = "Unknown"; |
183 | d->m_system = System_Unknown; | 185 | d->m_system = System_Unknown; |
184 | d->m_sysverstr = "0.0"; | 186 | d->m_sysverstr = "0.0"; |
185 | d->m_rotation = Rot0; | 187 | d->m_rotation = Rot0; |
186 | d->m_direction = CW; | 188 | d->m_direction = CW; |
187 | d->m_qteDriver = "Transformed"; | 189 | d->m_qteDriver = "Transformed"; |
188 | 190 | ||
189 | d->m_holdtime = 1000; // 1000ms | 191 | d->m_holdtime = 1000; // 1000ms |
190 | d->m_buttons = 0; | 192 | d->m_buttons = 0; |
191 | d->m_cpu_frequencies = new QStrList; | 193 | d->m_cpu_frequencies = new QStrList; |
192 | 194 | ||
193 | 195 | ||
194 | /* mixer */ | 196 | /* mixer */ |
195 | d->m_sound = d->m_vol = d->m_mixer = -1; | 197 | d->m_sound = d->m_vol = d->m_mixer = -1; |
196 | 198 | ||
197 | /* System QCopChannel created */ | 199 | /* System QCopChannel created */ |
198 | d->m_initializedButtonQcop = false; | 200 | d->m_initializedButtonQcop = false; |
199 | 201 | ||
200 | // New distribution detection code first checks for legacy distributions, | 202 | // New distribution detection code first checks for legacy distributions, |
201 | // identified by /etc/familiar-version or /etc/oz_version. | 203 | // identified by /etc/familiar-version or /etc/oz_version. |
202 | // Then check for OpenEmbedded and lastly, read /etc/issue | 204 | // Then check for OpenEmbedded and lastly, read /etc/issue |
203 | 205 | ||
204 | for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) | 206 | for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) |
205 | { | 207 | { |
206 | if ( QFile::exists( distributions[i].sysvfile ) ) | 208 | if ( QFile::exists( distributions[i].sysvfile ) ) |
207 | { | 209 | { |
208 | d->m_systemstr = distributions[i].sysstr; | 210 | d->m_systemstr = distributions[i].sysstr; |
209 | d->m_system = distributions[i].system; | 211 | d->m_system = distributions[i].system; |
210 | d->m_sysverstr = "<Unknown>"; | 212 | d->m_sysverstr = "<Unknown>"; |
211 | QFile f( distributions[i].sysvfile ); | 213 | QFile f( distributions[i].sysvfile ); |
212 | if ( f.open( IO_ReadOnly ) ) | 214 | if ( f.open( IO_ReadOnly ) ) |
213 | { | 215 | { |
214 | QTextStream ts( &f ); | 216 | QTextStream ts( &f ); |
215 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); | 217 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); |
216 | } | 218 | } |
217 | break; | 219 | break; |
218 | } | 220 | } |
219 | } | 221 | } |
220 | } | 222 | } |
221 | 223 | ||
222 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 224 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
223 | { | 225 | { |
224 | if ( msg == "deviceButtonMappingChanged()" ) { | 226 | if ( msg == "deviceButtonMappingChanged()" ) { |
225 | reloadButtonMapping(); | 227 | reloadButtonMapping(); |
226 | } | 228 | } |
227 | } | 229 | } |
228 | 230 | ||
229 | void ODevice::init(const QString&) | 231 | void ODevice::init(const QString&) |
230 | { | 232 | { |
231 | } | 233 | } |
232 | 234 | ||
233 | /** | 235 | /** |
234 | * This method initialises the button mapping | 236 | * This method initialises the button mapping |
235 | */ | 237 | */ |
236 | void ODevice::initButtons() | 238 | void ODevice::initButtons() |
237 | { | 239 | { |
238 | if ( d->m_buttons ) | 240 | if ( d->m_buttons ) |
239 | return; | 241 | return; |
240 | 242 | ||
241 | qDebug ( "init Buttons" ); | 243 | qDebug ( "init Buttons" ); |
242 | d->m_buttons = new QValueList <ODeviceButton>; | 244 | d->m_buttons = new QValueList <ODeviceButton>; |
243 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 245 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
244 | default_button *db = default_buttons + i; | 246 | default_button *db = default_buttons + i; |
245 | ODeviceButton b; | 247 | ODeviceButton b; |
246 | b. setKeycode ( db->code ); | 248 | b. setKeycode ( db->code ); |
247 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 249 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
248 | b. setPixmap ( OResource::loadPixmap ( db->pix )); | 250 | b. setPixmap ( OResource::loadPixmap ( db->pix )); |
249 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 251 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
250 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 252 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
251 | d->m_buttons->append ( b ); | 253 | d->m_buttons->append ( b ); |
252 | } | 254 | } |
253 | 255 | ||
254 | reloadButtonMapping(); | 256 | reloadButtonMapping(); |
255 | } | 257 | } |
256 | 258 | ||
257 | ODevice::~ODevice() | 259 | ODevice::~ODevice() |
258 | { | 260 | { |
259 | // we leak m_devicebuttons and m_cpu_frequency | 261 | // we leak m_devicebuttons and m_cpu_frequency |
260 | // but it's a singleton and it is not so importantant | 262 | // but it's a singleton and it is not so importantant |
261 | // -zecke | 263 | // -zecke |
262 | delete d; | 264 | delete d; |
263 | } | 265 | } |
264 | 266 | ||
265 | /** | 267 | /** |
266 | * This method will try to suspend the device | 268 | * This method will try to suspend the device |
267 | * It only works if the user is the QWS Server and the apm application | 269 | * It only works if the user is the QWS Server and the apm application |
268 | * is installed. | 270 | * is installed. |
269 | * It tries to suspend and then waits some time cause some distributions | 271 | * It tries to suspend and then waits some time cause some distributions |
270 | * do have asynchronus apm implementations. | 272 | * do have asynchronus apm implementations. |
271 | * This method will either fail and return false or it'll suspend the | 273 | * This method will either fail and return false or it'll suspend the |
272 | * device and return once the device got woken up | 274 | * device and return once the device got woken up |
273 | * | 275 | * |
274 | * @return if the device got suspended | 276 | * @return if the device got suspended |
275 | */ | 277 | */ |
276 | bool ODevice::suspend() | 278 | bool ODevice::suspend() |
277 | { | 279 | { |
278 | return false; // default implementation == unknown device or qvfb | 280 | return false; // default implementation == unknown device or qvfb |
279 | } | 281 | } |
280 | 282 | ||
281 | /** | 283 | /** |
282 | * This sets the display on or off | 284 | * This sets the display on or off |
283 | */ | 285 | */ |
284 | bool ODevice::setDisplayStatus( bool on ) | 286 | bool ODevice::setDisplayStatus( bool on ) |
285 | { | 287 | { |
286 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); | 288 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); |
287 | return false; // don't do anything for unknown models | 289 | return false; // don't do anything for unknown models |
288 | } | 290 | } |
289 | 291 | ||
290 | /** | 292 | /** |
291 | * This sets the display brightness | 293 | * This sets the display brightness |
292 | * | 294 | * |
293 | * @param b The brightness to be set on a scale from 0 to 255 | 295 | * @param b The brightness to be set on a scale from 0 to 255 |
294 | * @return success or failure | 296 | * @return success or failure |
295 | */ | 297 | */ |
296 | bool ODevice::setDisplayBrightness( int b ) | 298 | bool ODevice::setDisplayBrightness( int b ) |
297 | { | 299 | { |
298 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); | 300 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); |
299 | return false; | 301 | return false; |
300 | } | 302 | } |
301 | 303 | ||
302 | /** | 304 | /** |
303 | * | 305 | * |
304 | * @returns the number of steppings on the brightness slider | 306 | * @returns the number of steppings on the brightness slider |
305 | * in the Light-'n-Power settings. Values smaller than zero and bigger | 307 | * in the Light-'n-Power settings. Values smaller than zero and bigger |
306 | * than 255 do not make sense. | 308 | * than 255 do not make sense. |
307 | * | 309 | * |
308 | * \sa QSlider::setLineStep | 310 | * \sa QSlider::setLineStep |
309 | * \sa QSlider::setPageStep | 311 | * \sa QSlider::setPageStep |
310 | */ | 312 | */ |
311 | int ODevice::displayBrightnessResolution() const | 313 | int ODevice::displayBrightnessResolution() const |
312 | { | 314 | { |
313 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 315 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
314 | return 16; | 316 | return 16; |
315 | } | 317 | } |
316 | 318 | ||
317 | /** | 319 | /** |
318 | * This sets the display contrast | 320 | * This sets the display contrast |
319 | * @param p The contrast to be set on a scale from 0 to 255 | 321 | * @param p The contrast to be set on a scale from 0 to 255 |
320 | * @returns success or failure | 322 | * @returns success or failure |
321 | */ | 323 | */ |
322 | bool ODevice::setDisplayContrast( int p ) | 324 | bool ODevice::setDisplayContrast( int p ) |
323 | { | 325 | { |
324 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); | 326 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); |
325 | return false; | 327 | return false; |
326 | } | 328 | } |
327 | 329 | ||
328 | /** | 330 | /** |
329 | * @returns the maximum value for the contrast settings slider | 331 | * @returns the maximum value for the contrast settings slider |
330 | * or 0 if the device doesn't support setting of a contrast | 332 | * or 0 if the device doesn't support setting of a contrast |
331 | */ | 333 | */ |
332 | int ODevice::displayContrastResolution() const | 334 | int ODevice::displayContrastResolution() const |
333 | { | 335 | { |
334 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 336 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
335 | return 0; | 337 | return 0; |
336 | } | 338 | } |
337 | 339 | ||
338 | /** | 340 | /** |
339 | * This returns the vendor as string | 341 | * This returns the vendor as string |
340 | * @return Vendor as QString | 342 | * @return Vendor as QString |
341 | */ | 343 | */ |
342 | QString ODevice::vendorString() const | 344 | QString ODevice::vendorString() const |
343 | { | 345 | { |
344 | return d->m_vendorstr; | 346 | return d->m_vendorstr; |
345 | } | 347 | } |
346 | 348 | ||
347 | /** | 349 | /** |
348 | * This returns the vendor as one of the values of OVendor | 350 | * This returns the vendor as one of the values of OVendor |
349 | * @return OVendor | 351 | * @return OVendor |
350 | */ | 352 | */ |
351 | OVendor ODevice::vendor() const | 353 | OVendor ODevice::vendor() const |
352 | { | 354 | { |
353 | return d->m_vendor; | 355 | return d->m_vendor; |
354 | } | 356 | } |
355 | 357 | ||
356 | /** | 358 | /** |
357 | * This returns the model as a string | 359 | * This returns the model as a string |
358 | * @return A string representing the model | 360 | * @return A string representing the model |
359 | */ | 361 | */ |
360 | QString ODevice::modelString() const | 362 | QString ODevice::modelString() const |
361 | { | 363 | { |
362 | return d->m_modelstr; | 364 | return d->m_modelstr; |
363 | } | 365 | } |
364 | 366 | ||
365 | /** | 367 | /** |
366 | * This does return the OModel used | 368 | * This does return the OModel used |
367 | */ | 369 | */ |
368 | OModel ODevice::model() const | 370 | OModel ODevice::model() const |
369 | { | 371 | { |
370 | return d->m_model; | 372 | return d->m_model; |
371 | } | 373 | } |
372 | 374 | ||
373 | /** | 375 | /** |
374 | * This does return the systen name | 376 | * This does return the systen name |
375 | */ | 377 | */ |
376 | QString ODevice::systemString() const | 378 | QString ODevice::systemString() const |
377 | { | 379 | { |
378 | return d->m_systemstr; | 380 | return d->m_systemstr; |
379 | } | 381 | } |
380 | 382 | ||
381 | /** | 383 | /** |
382 | * Return System as OSystem value | 384 | * Return System as OSystem value |
383 | */ | 385 | */ |
384 | OSystem ODevice::system() const | 386 | OSystem ODevice::system() const |
385 | { | 387 | { |
386 | return d->m_system; | 388 | return d->m_system; |
387 | } | 389 | } |
388 | 390 | ||
389 | /** | 391 | /** |
390 | * @return the version string of the base system | 392 | * @return the version string of the base system |
391 | */ | 393 | */ |
392 | QString ODevice::systemVersionString() const | 394 | QString ODevice::systemVersionString() const |
393 | { | 395 | { |
394 | return d->m_sysverstr; | 396 | return d->m_sysverstr; |
395 | } | 397 | } |
396 | 398 | ||
397 | /** | 399 | /** |
398 | * @return the current Transformation | 400 | * @return the current Transformation |
399 | */ | 401 | */ |
400 | Transformation ODevice::rotation() const | 402 | Transformation ODevice::rotation() const |
401 | { | 403 | { |
402 | return d->m_rotation; | 404 | return d->m_rotation; |
403 | } | 405 | } |
404 | 406 | ||
405 | /** | 407 | /** |
406 | * @return the current rotation direction | 408 | * @return the current rotation direction |
407 | */ | 409 | */ |
408 | ODirection ODevice::direction() const | 410 | ODirection ODevice::direction() const |
409 | { | 411 | { |
410 | return d->m_direction; | 412 | return d->m_direction; |
411 | } | 413 | } |
412 | 414 | ||
413 | QString ODevice::qteDriver() const | 415 | QString ODevice::qteDriver() const |
414 | { | 416 | { |
415 | return d->m_qteDriver; | 417 | return d->m_qteDriver; |
416 | } | 418 | } |
417 | 419 | ||
418 | /** | 420 | /** |
419 | * This plays an alarm sound | 421 | * This plays an alarm sound |
420 | */ | 422 | */ |
421 | void ODevice::playAlarmSound() | 423 | void ODevice::playAlarmSound() |
422 | { | 424 | { |
423 | #ifndef QT_NO_SOUND | 425 | #ifndef QT_NO_SOUND |
424 | static Sound snd ( "alarm" ); | 426 | static Sound snd ( "alarm" ); |
425 | 427 | ||
426 | if ( snd. isFinished()) | 428 | if ( snd. isFinished()) |
427 | snd. play(); | 429 | snd. play(); |
428 | #endif | 430 | #endif |
429 | } | 431 | } |
430 | 432 | ||
431 | /** | 433 | /** |
432 | * This plays a key sound | 434 | * This plays a key sound |
433 | */ | 435 | */ |
434 | void ODevice::playKeySound() | 436 | void ODevice::playKeySound() |
435 | { | 437 | { |
436 | #ifndef QT_NO_SOUND | 438 | #ifndef QT_NO_SOUND |
437 | static Sound snd ( "keysound" ); | 439 | static Sound snd ( "keysound" ); |
438 | 440 | ||
439 | if ( snd. isFinished()) | 441 | if ( snd. isFinished()) |
440 | snd. play(); | 442 | snd. play(); |
441 | #endif | 443 | #endif |
442 | } | 444 | } |
443 | 445 | ||
444 | /** | 446 | /** |
445 | * This plays a touch sound | 447 | * This plays a touch sound |
446 | */ | 448 | */ |
447 | void ODevice::playTouchSound() | 449 | void ODevice::playTouchSound() |
448 | { | 450 | { |
449 | #ifndef QT_NO_SOUND | 451 | #ifndef QT_NO_SOUND |
450 | static Sound snd ( "touchsound" ); | 452 | static Sound snd ( "touchsound" ); |
451 | 453 | ||
452 | if ( snd. isFinished()) | 454 | if ( snd. isFinished()) |
453 | snd. play(); | 455 | snd. play(); |
454 | #endif | 456 | #endif |
455 | } | 457 | } |
456 | 458 | ||
457 | /** | 459 | /** |
458 | * This method will return a list of leds | 460 | * This method will return a list of leds |
459 | * available on this device | 461 | * available on this device |
460 | * @return a list of LEDs. | 462 | * @return a list of LEDs. |
461 | */ | 463 | */ |
462 | QValueList <OLed> ODevice::ledList() const | 464 | QValueList <OLed> ODevice::ledList() const |
463 | { | 465 | { |
464 | return QValueList <OLed>(); | 466 | return QValueList <OLed>(); |
465 | } | 467 | } |
466 | 468 | ||
467 | /** | 469 | /** |
468 | * This does return the state of the LEDs | 470 | * This does return the state of the LEDs |
469 | */ | 471 | */ |
470 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 472 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
471 | { | 473 | { |
472 | return QValueList <OLedState>(); | 474 | return QValueList <OLedState>(); |
473 | } | 475 | } |
474 | 476 | ||
475 | /** | 477 | /** |
476 | * @return the state for a given OLed | 478 | * @return the state for a given OLed |
477 | */ | 479 | */ |
478 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 480 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
479 | { | 481 | { |
480 | return Led_Off; | 482 | return Led_Off; |
481 | } | 483 | } |
482 | 484 | ||
483 | /** | 485 | /** |
484 | * Set the state for a LED | 486 | * Set the state for a LED |
485 | * @param which Which OLed to use | 487 | * @param which Which OLed to use |
486 | * @param st The state to set | 488 | * @param st The state to set |
487 | * @return success or failure | 489 | * @return success or failure |
488 | */ | 490 | */ |
489 | bool ODevice::setLedState ( OLed which, OLedState st ) | 491 | bool ODevice::setLedState ( OLed which, OLedState st ) |
490 | { | 492 | { |
491 | Q_UNUSED( which ) | 493 | Q_UNUSED( which ) |
492 | Q_UNUSED( st ) | 494 | Q_UNUSED( st ) |
493 | return false; | 495 | return false; |
494 | } | 496 | } |
495 | 497 | ||
496 | /** | 498 | /** |
497 | * @return if the device has a light sensor | 499 | * @return if the device has a light sensor |
498 | */ | 500 | */ |
499 | bool ODevice::hasLightSensor() const | 501 | bool ODevice::hasLightSensor() const |
500 | { | 502 | { |
501 | return false; | 503 | return false; |
502 | } | 504 | } |
503 | 505 | ||
504 | /** | 506 | /** |
505 | * @return a value from the light sensor | 507 | * @return a value from the light sensor |
506 | */ | 508 | */ |
507 | int ODevice::readLightSensor() | 509 | int ODevice::readLightSensor() |
508 | { | 510 | { |
509 | return -1; | 511 | return -1; |
510 | } | 512 | } |
511 | 513 | ||
512 | /** | 514 | /** |
513 | * @return the light sensor resolution | 515 | * @return the light sensor resolution |
514 | */ | 516 | */ |
515 | int ODevice::lightSensorResolution() const | 517 | int ODevice::lightSensorResolution() const |
516 | { | 518 | { |
517 | return 0; | 519 | return 0; |
518 | } | 520 | } |
519 | 521 | ||
520 | /** | 522 | /** |
521 | * @return if the device has a hinge sensor | 523 | * @return if the device has a hinge sensor |
522 | */ | 524 | */ |
523 | bool ODevice::hasHingeSensor() const | 525 | bool ODevice::hasHingeSensor() const |
524 | { | 526 | { |
525 | return false; | 527 | return false; |
526 | } | 528 | } |
527 | 529 | ||
528 | /** | 530 | /** |
529 | * @return a value from the hinge sensor | 531 | * @return a value from the hinge sensor |
530 | */ | 532 | */ |
531 | OHingeStatus ODevice::readHingeSensor()const | 533 | OHingeStatus ODevice::readHingeSensor()const |
532 | { | 534 | { |
533 | return CASE_UNKNOWN; | 535 | return CASE_UNKNOWN; |
534 | } | 536 | } |