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