author | alwin <alwin> | 2005-03-12 14:16:28 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-12 14:16:28 (UTC) |
commit | ced8831cd48879e33fa11d45035cc7ff94180897 (patch) (unidiff) | |
tree | eba728c5df05e98e8c381baeea7e13bc1600b15d | |
parent | aa7039012cc79c02304e36db16e6f5ff82e19867 (diff) | |
download | opie-ced8831cd48879e33fa11d45035cc7ff94180897.zip opie-ced8831cd48879e33fa11d45035cc7ff94180897.tar.gz opie-ced8831cd48879e33fa11d45035cc7ff94180897.tar.bz2 |
this error will get my personal "error of the month":
due different declarations of "readHingeSensors" (const vs. non-const)
rotate-applet always got the default-implementation -> CASE_UNKNOWN.
(device vs. device_zaurus). Setting it to "const" (which makes sense)
let rotateapplet set light of or suspend or whatever user defined when
case is closed.
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index ed705a6..cf2061b 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -134,676 +134,676 @@ ODevice *ODevice::inst() | |||
134 | line = s.readLine(); | 134 | line = s.readLine(); |
135 | if ( line.startsWith( "Hardware" ) ) | 135 | if ( line.startsWith( "Hardware" ) ) |
136 | { | 136 | { |
137 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 137 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
138 | cpu_info = line; | 138 | cpu_info = line; |
139 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 139 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
140 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 140 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
141 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 141 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
142 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 142 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
143 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 143 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
144 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 144 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
145 | else qWarning( "ODevice() - unknown hardware - using default." ); | 145 | else qWarning( "ODevice() - unknown hardware - using default." ); |
146 | break; | 146 | break; |
147 | } else if ( line.startsWith( "vendor_id" ) ) { | 147 | } else if ( line.startsWith( "vendor_id" ) ) { |
148 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 148 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
149 | cpu_info = line; | 149 | cpu_info = line; |
150 | if( line.contains( "genuineintel", false ) ) { | 150 | if( line.contains( "genuineintel", false ) ) { |
151 | dev = new Internal::GenuineIntel(); | 151 | dev = new Internal::GenuineIntel(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 159 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
160 | } | 160 | } |
161 | if ( !dev ) dev = new ODevice(); | 161 | if ( !dev ) dev = new ODevice(); |
162 | dev->init(cpu_info); | 162 | dev->init(cpu_info); |
163 | } | 163 | } |
164 | return dev; | 164 | return dev; |
165 | } | 165 | } |
166 | 166 | ||
167 | ODevice::ODevice() | 167 | ODevice::ODevice() |
168 | { | 168 | { |
169 | d = new ODeviceData; | 169 | d = new ODeviceData; |
170 | 170 | ||
171 | d->m_modelstr = "Unknown"; | 171 | d->m_modelstr = "Unknown"; |
172 | d->m_model = Model_Unknown; | 172 | d->m_model = Model_Unknown; |
173 | d->m_vendorstr = "Unknown"; | 173 | d->m_vendorstr = "Unknown"; |
174 | d->m_vendor = Vendor_Unknown; | 174 | d->m_vendor = Vendor_Unknown; |
175 | d->m_systemstr = "Unknown"; | 175 | d->m_systemstr = "Unknown"; |
176 | d->m_system = System_Unknown; | 176 | d->m_system = System_Unknown; |
177 | d->m_sysverstr = "0.0"; | 177 | d->m_sysverstr = "0.0"; |
178 | d->m_rotation = Rot0; | 178 | d->m_rotation = Rot0; |
179 | d->m_direction = CW; | 179 | d->m_direction = CW; |
180 | 180 | ||
181 | d->m_holdtime = 1000; // 1000ms | 181 | d->m_holdtime = 1000; // 1000ms |
182 | d->m_buttons = 0; | 182 | d->m_buttons = 0; |
183 | d->m_cpu_frequencies = new QStrList; | 183 | d->m_cpu_frequencies = new QStrList; |
184 | 184 | ||
185 | 185 | ||
186 | /* mixer */ | 186 | /* mixer */ |
187 | d->m_sound = d->m_vol = d->m_mixer = -1; | 187 | d->m_sound = d->m_vol = d->m_mixer = -1; |
188 | 188 | ||
189 | /* System QCopChannel created */ | 189 | /* System QCopChannel created */ |
190 | d->m_initializedButtonQcop = false; | 190 | d->m_initializedButtonQcop = false; |
191 | 191 | ||
192 | // New distribution detection code first checks for legacy distributions, | 192 | // New distribution detection code first checks for legacy distributions, |
193 | // identified by /etc/familiar-version or /etc/oz_version. | 193 | // identified by /etc/familiar-version or /etc/oz_version. |
194 | // Then check for OpenEmbedded and lastly, read /etc/issue | 194 | // Then check for OpenEmbedded and lastly, read /etc/issue |
195 | 195 | ||
196 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | 196 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) |
197 | { | 197 | { |
198 | if ( QFile::exists( distributions[i].sysvfile ) ) | 198 | if ( QFile::exists( distributions[i].sysvfile ) ) |
199 | { | 199 | { |
200 | d->m_systemstr = distributions[i].sysstr; | 200 | d->m_systemstr = distributions[i].sysstr; |
201 | d->m_system = distributions[i].system; | 201 | d->m_system = distributions[i].system; |
202 | d->m_sysverstr = "<Unknown>"; | 202 | d->m_sysverstr = "<Unknown>"; |
203 | QFile f( distributions[i].sysvfile ); | 203 | QFile f( distributions[i].sysvfile ); |
204 | if ( f.open( IO_ReadOnly ) ) | 204 | if ( f.open( IO_ReadOnly ) ) |
205 | { | 205 | { |
206 | QTextStream ts( &f ); | 206 | QTextStream ts( &f ); |
207 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); | 207 | d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); |
208 | } | 208 | } |
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
215 | { | 215 | { |
216 | if ( msg == "deviceButtonMappingChanged()" ) { | 216 | if ( msg == "deviceButtonMappingChanged()" ) { |
217 | reloadButtonMapping(); | 217 | reloadButtonMapping(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | void ODevice::init(const QString&) | 221 | void ODevice::init(const QString&) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * This method initialises the button mapping | 226 | * This method initialises the button mapping |
227 | */ | 227 | */ |
228 | void ODevice::initButtons() | 228 | void ODevice::initButtons() |
229 | { | 229 | { |
230 | if ( d->m_buttons ) | 230 | if ( d->m_buttons ) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | qDebug ( "init Buttons" ); | 233 | qDebug ( "init Buttons" ); |
234 | d->m_buttons = new QValueList <ODeviceButton>; | 234 | d->m_buttons = new QValueList <ODeviceButton>; |
235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
236 | default_button *db = default_buttons + i; | 236 | default_button *db = default_buttons + i; |
237 | ODeviceButton b; | 237 | ODeviceButton b; |
238 | b. setKeycode ( db->code ); | 238 | b. setKeycode ( db->code ); |
239 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 239 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
243 | d->m_buttons->append ( b ); | 243 | d->m_buttons->append ( b ); |
244 | } | 244 | } |
245 | 245 | ||
246 | reloadButtonMapping(); | 246 | reloadButtonMapping(); |
247 | } | 247 | } |
248 | 248 | ||
249 | ODevice::~ODevice() | 249 | ODevice::~ODevice() |
250 | { | 250 | { |
251 | // we leak m_devicebuttons and m_cpu_frequency | 251 | // we leak m_devicebuttons and m_cpu_frequency |
252 | // but it's a singleton and it is not so importantant | 252 | // but it's a singleton and it is not so importantant |
253 | // -zecke | 253 | // -zecke |
254 | delete d; | 254 | delete d; |
255 | } | 255 | } |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * This method will try to suspend the device | 258 | * This method will try to suspend the device |
259 | * It only works if the user is the QWS Server and the apm application | 259 | * It only works if the user is the QWS Server and the apm application |
260 | * is installed. | 260 | * is installed. |
261 | * It tries to suspend and then waits some time cause some distributions | 261 | * It tries to suspend and then waits some time cause some distributions |
262 | * do have asynchronus apm implementations. | 262 | * do have asynchronus apm implementations. |
263 | * This method will either fail and return false or it'll suspend the | 263 | * This method will either fail and return false or it'll suspend the |
264 | * device and return once the device got woken up | 264 | * device and return once the device got woken up |
265 | * | 265 | * |
266 | * @return if the device got suspended | 266 | * @return if the device got suspended |
267 | */ | 267 | */ |
268 | bool ODevice::suspend() | 268 | bool ODevice::suspend() |
269 | { | 269 | { |
270 | return false; // default implementation == unknown device or qvfb | 270 | return false; // default implementation == unknown device or qvfb |
271 | } | 271 | } |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * This sets the display on or off | 274 | * This sets the display on or off |
275 | */ | 275 | */ |
276 | bool ODevice::setDisplayStatus( bool on ) | 276 | bool ODevice::setDisplayStatus( bool on ) |
277 | { | 277 | { |
278 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); | 278 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); |
279 | return false; // don't do anything for unknown models | 279 | return false; // don't do anything for unknown models |
280 | } | 280 | } |
281 | 281 | ||
282 | /** | 282 | /** |
283 | * This sets the display brightness | 283 | * This sets the display brightness |
284 | * | 284 | * |
285 | * @param b The brightness to be set on a scale from 0 to 255 | 285 | * @param b The brightness to be set on a scale from 0 to 255 |
286 | * @return success or failure | 286 | * @return success or failure |
287 | */ | 287 | */ |
288 | bool ODevice::setDisplayBrightness( int b ) | 288 | bool ODevice::setDisplayBrightness( int b ) |
289 | { | 289 | { |
290 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); | 290 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); |
291 | return false; | 291 | return false; |
292 | } | 292 | } |
293 | 293 | ||
294 | /** | 294 | /** |
295 | * | 295 | * |
296 | * @returns the number of steppings on the brightness slider | 296 | * @returns the number of steppings on the brightness slider |
297 | * in the Light-'n-Power settings. Values smaller than zero and bigger | 297 | * in the Light-'n-Power settings. Values smaller than zero and bigger |
298 | * than 255 do not make sense. | 298 | * than 255 do not make sense. |
299 | * | 299 | * |
300 | * \sa QSlider::setLineStep | 300 | * \sa QSlider::setLineStep |
301 | * \sa QSlider::setPageStep | 301 | * \sa QSlider::setPageStep |
302 | */ | 302 | */ |
303 | int ODevice::displayBrightnessResolution() const | 303 | int ODevice::displayBrightnessResolution() const |
304 | { | 304 | { |
305 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 305 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
306 | return 16; | 306 | return 16; |
307 | } | 307 | } |
308 | 308 | ||
309 | /** | 309 | /** |
310 | * This sets the display contrast | 310 | * This sets the display contrast |
311 | * @param p The contrast to be set on a scale from 0 to 255 | 311 | * @param p The contrast to be set on a scale from 0 to 255 |
312 | * @returns success or failure | 312 | * @returns success or failure |
313 | */ | 313 | */ |
314 | bool ODevice::setDisplayContrast( int p ) | 314 | bool ODevice::setDisplayContrast( int p ) |
315 | { | 315 | { |
316 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); | 316 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); |
317 | return false; | 317 | return false; |
318 | } | 318 | } |
319 | 319 | ||
320 | /** | 320 | /** |
321 | * @returns the maximum value for the contrast settings slider | 321 | * @returns the maximum value for the contrast settings slider |
322 | * or 0 if the device doesn't support setting of a contrast | 322 | * or 0 if the device doesn't support setting of a contrast |
323 | */ | 323 | */ |
324 | int ODevice::displayContrastResolution() const | 324 | int ODevice::displayContrastResolution() const |
325 | { | 325 | { |
326 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 326 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * This returns the vendor as string | 331 | * This returns the vendor as string |
332 | * @return Vendor as QString | 332 | * @return Vendor as QString |
333 | */ | 333 | */ |
334 | QString ODevice::vendorString() const | 334 | QString ODevice::vendorString() const |
335 | { | 335 | { |
336 | return d->m_vendorstr; | 336 | return d->m_vendorstr; |
337 | } | 337 | } |
338 | 338 | ||
339 | /** | 339 | /** |
340 | * This returns the vendor as one of the values of OVendor | 340 | * This returns the vendor as one of the values of OVendor |
341 | * @return OVendor | 341 | * @return OVendor |
342 | */ | 342 | */ |
343 | OVendor ODevice::vendor() const | 343 | OVendor ODevice::vendor() const |
344 | { | 344 | { |
345 | return d->m_vendor; | 345 | return d->m_vendor; |
346 | } | 346 | } |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * This returns the model as a string | 349 | * This returns the model as a string |
350 | * @return A string representing the model | 350 | * @return A string representing the model |
351 | */ | 351 | */ |
352 | QString ODevice::modelString() const | 352 | QString ODevice::modelString() const |
353 | { | 353 | { |
354 | return d->m_modelstr; | 354 | return d->m_modelstr; |
355 | } | 355 | } |
356 | 356 | ||
357 | /** | 357 | /** |
358 | * This does return the OModel used | 358 | * This does return the OModel used |
359 | */ | 359 | */ |
360 | OModel ODevice::model() const | 360 | OModel ODevice::model() const |
361 | { | 361 | { |
362 | return d->m_model; | 362 | return d->m_model; |
363 | } | 363 | } |
364 | 364 | ||
365 | /** | 365 | /** |
366 | * This does return the systen name | 366 | * This does return the systen name |
367 | */ | 367 | */ |
368 | QString ODevice::systemString() const | 368 | QString ODevice::systemString() const |
369 | { | 369 | { |
370 | return d->m_systemstr; | 370 | return d->m_systemstr; |
371 | } | 371 | } |
372 | 372 | ||
373 | /** | 373 | /** |
374 | * Return System as OSystem value | 374 | * Return System as OSystem value |
375 | */ | 375 | */ |
376 | OSystem ODevice::system() const | 376 | OSystem ODevice::system() const |
377 | { | 377 | { |
378 | return d->m_system; | 378 | return d->m_system; |
379 | } | 379 | } |
380 | 380 | ||
381 | /** | 381 | /** |
382 | * @return the version string of the base system | 382 | * @return the version string of the base system |
383 | */ | 383 | */ |
384 | QString ODevice::systemVersionString() const | 384 | QString ODevice::systemVersionString() const |
385 | { | 385 | { |
386 | return d->m_sysverstr; | 386 | return d->m_sysverstr; |
387 | } | 387 | } |
388 | 388 | ||
389 | /** | 389 | /** |
390 | * @return the current Transformation | 390 | * @return the current Transformation |
391 | */ | 391 | */ |
392 | Transformation ODevice::rotation() const | 392 | Transformation ODevice::rotation() const |
393 | { | 393 | { |
394 | return d->m_rotation; | 394 | return d->m_rotation; |
395 | } | 395 | } |
396 | 396 | ||
397 | /** | 397 | /** |
398 | * @return the current rotation direction | 398 | * @return the current rotation direction |
399 | */ | 399 | */ |
400 | ODirection ODevice::direction() const | 400 | ODirection ODevice::direction() const |
401 | { | 401 | { |
402 | return d->m_direction; | 402 | return d->m_direction; |
403 | } | 403 | } |
404 | 404 | ||
405 | /** | 405 | /** |
406 | * This plays an alarm sound | 406 | * This plays an alarm sound |
407 | */ | 407 | */ |
408 | void ODevice::playAlarmSound() | 408 | void ODevice::playAlarmSound() |
409 | { | 409 | { |
410 | #ifndef QT_NO_SOUND | 410 | #ifndef QT_NO_SOUND |
411 | static Sound snd ( "alarm" ); | 411 | static Sound snd ( "alarm" ); |
412 | 412 | ||
413 | if ( snd. isFinished()) | 413 | if ( snd. isFinished()) |
414 | snd. play(); | 414 | snd. play(); |
415 | #endif | 415 | #endif |
416 | } | 416 | } |
417 | 417 | ||
418 | /** | 418 | /** |
419 | * This plays a key sound | 419 | * This plays a key sound |
420 | */ | 420 | */ |
421 | void ODevice::playKeySound() | 421 | void ODevice::playKeySound() |
422 | { | 422 | { |
423 | #ifndef QT_NO_SOUND | 423 | #ifndef QT_NO_SOUND |
424 | static Sound snd ( "keysound" ); | 424 | static Sound snd ( "keysound" ); |
425 | 425 | ||
426 | if ( snd. isFinished()) | 426 | if ( snd. isFinished()) |
427 | snd. play(); | 427 | snd. play(); |
428 | #endif | 428 | #endif |
429 | } | 429 | } |
430 | 430 | ||
431 | /** | 431 | /** |
432 | * This plays a touch sound | 432 | * This plays a touch sound |
433 | */ | 433 | */ |
434 | void ODevice::playTouchSound() | 434 | void ODevice::playTouchSound() |
435 | { | 435 | { |
436 | #ifndef QT_NO_SOUND | 436 | #ifndef QT_NO_SOUND |
437 | static Sound snd ( "touchsound" ); | 437 | static Sound snd ( "touchsound" ); |
438 | 438 | ||
439 | if ( snd. isFinished()) | 439 | if ( snd. isFinished()) |
440 | snd. play(); | 440 | snd. play(); |
441 | #endif | 441 | #endif |
442 | } | 442 | } |
443 | 443 | ||
444 | /** | 444 | /** |
445 | * This method will return a list of leds | 445 | * This method will return a list of leds |
446 | * available on this device | 446 | * available on this device |
447 | * @return a list of LEDs. | 447 | * @return a list of LEDs. |
448 | */ | 448 | */ |
449 | QValueList <OLed> ODevice::ledList() const | 449 | QValueList <OLed> ODevice::ledList() const |
450 | { | 450 | { |
451 | return QValueList <OLed>(); | 451 | return QValueList <OLed>(); |
452 | } | 452 | } |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * This does return the state of the LEDs | 455 | * This does return the state of the LEDs |
456 | */ | 456 | */ |
457 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 457 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
458 | { | 458 | { |
459 | return QValueList <OLedState>(); | 459 | return QValueList <OLedState>(); |
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * @return the state for a given OLed | 463 | * @return the state for a given OLed |
464 | */ | 464 | */ |
465 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 465 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
466 | { | 466 | { |
467 | return Led_Off; | 467 | return Led_Off; |
468 | } | 468 | } |
469 | 469 | ||
470 | /** | 470 | /** |
471 | * Set the state for a LED | 471 | * Set the state for a LED |
472 | * @param which Which OLed to use | 472 | * @param which Which OLed to use |
473 | * @param st The state to set | 473 | * @param st The state to set |
474 | * @return success or failure | 474 | * @return success or failure |
475 | */ | 475 | */ |
476 | bool ODevice::setLedState ( OLed which, OLedState st ) | 476 | bool ODevice::setLedState ( OLed which, OLedState st ) |
477 | { | 477 | { |
478 | Q_UNUSED( which ) | 478 | Q_UNUSED( which ) |
479 | Q_UNUSED( st ) | 479 | Q_UNUSED( st ) |
480 | return false; | 480 | return false; |
481 | } | 481 | } |
482 | 482 | ||
483 | /** | 483 | /** |
484 | * @return if the device has a light sensor | 484 | * @return if the device has a light sensor |
485 | */ | 485 | */ |
486 | bool ODevice::hasLightSensor() const | 486 | bool ODevice::hasLightSensor() const |
487 | { | 487 | { |
488 | return false; | 488 | return false; |
489 | } | 489 | } |
490 | 490 | ||
491 | /** | 491 | /** |
492 | * @return a value from the light sensor | 492 | * @return a value from the light sensor |
493 | */ | 493 | */ |
494 | int ODevice::readLightSensor() | 494 | int ODevice::readLightSensor() |
495 | { | 495 | { |
496 | return -1; | 496 | return -1; |
497 | } | 497 | } |
498 | 498 | ||
499 | /** | 499 | /** |
500 | * @return the light sensor resolution | 500 | * @return the light sensor resolution |
501 | */ | 501 | */ |
502 | int ODevice::lightSensorResolution() const | 502 | int ODevice::lightSensorResolution() const |
503 | { | 503 | { |
504 | return 0; | 504 | return 0; |
505 | } | 505 | } |
506 | 506 | ||
507 | /** | 507 | /** |
508 | * @return if the device has a hinge sensor | 508 | * @return if the device has a hinge sensor |
509 | */ | 509 | */ |
510 | bool ODevice::hasHingeSensor() const | 510 | bool ODevice::hasHingeSensor() const |
511 | { | 511 | { |
512 | return false; | 512 | return false; |
513 | } | 513 | } |
514 | 514 | ||
515 | /** | 515 | /** |
516 | * @return a value from the hinge sensor | 516 | * @return a value from the hinge sensor |
517 | */ | 517 | */ |
518 | OHingeStatus ODevice::readHingeSensor() | 518 | OHingeStatus ODevice::readHingeSensor()const |
519 | { | 519 | { |
520 | return CASE_UNKNOWN; | 520 | return CASE_UNKNOWN; |
521 | } | 521 | } |
522 | 522 | ||
523 | /** | 523 | /** |
524 | * @return a list with CPU frequencies supported by the hardware | 524 | * @return a list with CPU frequencies supported by the hardware |
525 | */ | 525 | */ |
526 | const QStrList &ODevice::allowedCpuFrequencies() const | 526 | const QStrList &ODevice::allowedCpuFrequencies() const |
527 | { | 527 | { |
528 | return *d->m_cpu_frequencies; | 528 | return *d->m_cpu_frequencies; |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | /** | 532 | /** |
533 | * Set desired CPU frequency | 533 | * Set desired CPU frequency |
534 | * | 534 | * |
535 | * @param index index into d->m_cpu_frequencies of the frequency to be set | 535 | * @param index index into d->m_cpu_frequencies of the frequency to be set |
536 | */ | 536 | */ |
537 | bool ODevice::setCurrentCpuFrequency(uint index) | 537 | bool ODevice::setCurrentCpuFrequency(uint index) |
538 | { | 538 | { |
539 | if (index >= d->m_cpu_frequencies->count()) | 539 | if (index >= d->m_cpu_frequencies->count()) |
540 | return false; | 540 | return false; |
541 | 541 | ||
542 | char *freq = d->m_cpu_frequencies->at(index); | 542 | char *freq = d->m_cpu_frequencies->at(index); |
543 | qWarning("set freq to %s", freq); | 543 | qWarning("set freq to %s", freq); |
544 | 544 | ||
545 | int fd; | 545 | int fd; |
546 | 546 | ||
547 | if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { | 547 | if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { |
548 | char writeCommand[50]; | 548 | char writeCommand[50]; |
549 | const int count = sprintf(writeCommand, "%s\n", freq); | 549 | const int count = sprintf(writeCommand, "%s\n", freq); |
550 | int res = (::write(fd, writeCommand, count) != -1); | 550 | int res = (::write(fd, writeCommand, count) != -1); |
551 | ::close(fd); | 551 | ::close(fd); |
552 | return res; | 552 | return res; |
553 | } | 553 | } |
554 | 554 | ||
555 | return false; | 555 | return false; |
556 | } | 556 | } |
557 | 557 | ||
558 | 558 | ||
559 | /** | 559 | /** |
560 | * @return a list of hardware buttons | 560 | * @return a list of hardware buttons |
561 | */ | 561 | */ |
562 | const QValueList <ODeviceButton> &ODevice::buttons() | 562 | const QValueList <ODeviceButton> &ODevice::buttons() |
563 | { | 563 | { |
564 | initButtons(); | 564 | initButtons(); |
565 | 565 | ||
566 | return *d->m_buttons; | 566 | return *d->m_buttons; |
567 | } | 567 | } |
568 | 568 | ||
569 | /** | 569 | /** |
570 | * @return The amount of time that would count as a hold | 570 | * @return The amount of time that would count as a hold |
571 | */ | 571 | */ |
572 | uint ODevice::buttonHoldTime() const | 572 | uint ODevice::buttonHoldTime() const |
573 | { | 573 | { |
574 | return d->m_holdtime; | 574 | return d->m_holdtime; |
575 | } | 575 | } |
576 | 576 | ||
577 | /** | 577 | /** |
578 | * This method return a ODeviceButton for a key code | 578 | * This method return a ODeviceButton for a key code |
579 | * or 0 if no special hardware button is available for the device | 579 | * or 0 if no special hardware button is available for the device |
580 | * | 580 | * |
581 | * @return The devicebutton or 0l | 581 | * @return The devicebutton or 0l |
582 | * @see ODeviceButton | 582 | * @see ODeviceButton |
583 | */ | 583 | */ |
584 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) | 584 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) |
585 | { | 585 | { |
586 | initButtons(); | 586 | initButtons(); |
587 | 587 | ||
588 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { | 588 | for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { |
589 | if ( (*it).keycode() == code ) | 589 | if ( (*it).keycode() == code ) |
590 | return &(*it); | 590 | return &(*it); |
591 | } | 591 | } |
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
594 | 594 | ||
595 | void ODevice::reloadButtonMapping() | 595 | void ODevice::reloadButtonMapping() |
596 | { | 596 | { |
597 | if(!d->m_buttons) | 597 | if(!d->m_buttons) |
598 | initButtons(); | 598 | initButtons(); |
599 | 599 | ||
600 | if(!d->m_initializedButtonQcop) { | 600 | if(!d->m_initializedButtonQcop) { |
601 | QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); | 601 | QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); |
602 | connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), | 602 | connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), |
603 | this,SLOT(systemMessage(const QCString&,const QByteArray&))); | 603 | this,SLOT(systemMessage(const QCString&,const QByteArray&))); |
604 | d->m_initializedButtonQcop = true; | 604 | d->m_initializedButtonQcop = true; |
605 | } | 605 | } |
606 | 606 | ||
607 | Config cfg ( "ButtonSettings" ); | 607 | Config cfg ( "ButtonSettings" ); |
608 | 608 | ||
609 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { | 609 | for ( uint i = 0; i < d->m_buttons->count(); i++ ) { |
610 | ODeviceButton &b = ( *d->m_buttons ) [i]; | 610 | ODeviceButton &b = ( *d->m_buttons ) [i]; |
611 | QString group = "Button" + QString::number ( i ); | 611 | QString group = "Button" + QString::number ( i ); |
612 | 612 | ||
613 | QCString pch, hch; | 613 | QCString pch, hch; |
614 | QCString pm, hm; | 614 | QCString pm, hm; |
615 | QByteArray pdata, hdata; | 615 | QByteArray pdata, hdata; |
616 | 616 | ||
617 | if ( cfg. hasGroup ( group )) { | 617 | if ( cfg. hasGroup ( group )) { |
618 | cfg. setGroup ( group ); | 618 | cfg. setGroup ( group ); |
619 | pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); | 619 | pch = cfg. readEntry ( "PressedActionChannel" ). latin1(); |
620 | pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); | 620 | pm = cfg. readEntry ( "PressedActionMessage" ). latin1(); |
621 | // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); | 621 | // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); |
622 | 622 | ||
623 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); | 623 | hch = cfg. readEntry ( "HeldActionChannel" ). latin1(); |
624 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); | 624 | hm = cfg. readEntry ( "HeldActionMessage" ). latin1(); |
625 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); | 625 | // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); |
626 | } | 626 | } |
627 | 627 | ||
628 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); | 628 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); |
629 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); | 629 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); |
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
633 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | 633 | void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) |
634 | { | 634 | { |
635 | initButtons(); | 635 | initButtons(); |
636 | 636 | ||
637 | QString mb_chan; | 637 | QString mb_chan; |
638 | 638 | ||
639 | if ( button >= (int) d->m_buttons->count()) | 639 | if ( button >= (int) d->m_buttons->count()) |
640 | return; | 640 | return; |
641 | 641 | ||
642 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 642 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
643 | b. setPressedAction ( action ); | 643 | b. setPressedAction ( action ); |
644 | 644 | ||
645 | mb_chan=b. pressedAction(). channel(); | 645 | mb_chan=b. pressedAction(). channel(); |
646 | 646 | ||
647 | Config buttonFile ( "ButtonSettings" ); | 647 | Config buttonFile ( "ButtonSettings" ); |
648 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 648 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
649 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); | 649 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); |
650 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); | 650 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); |
651 | 651 | ||
652 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); | 652 | // buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); |
653 | 653 | ||
654 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 654 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
655 | } | 655 | } |
656 | 656 | ||
657 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 657 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) |
658 | { | 658 | { |
659 | initButtons(); | 659 | initButtons(); |
660 | 660 | ||
661 | if ( button >= (int) d->m_buttons->count()) | 661 | if ( button >= (int) d->m_buttons->count()) |
662 | return; | 662 | return; |
663 | 663 | ||
664 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 664 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
665 | b. setHeldAction ( action ); | 665 | b. setHeldAction ( action ); |
666 | 666 | ||
667 | Config buttonFile ( "ButtonSettings" ); | 667 | Config buttonFile ( "ButtonSettings" ); |
668 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 668 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
669 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); | 669 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); |
670 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 670 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
671 | 671 | ||
672 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 672 | // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
673 | 673 | ||
674 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 674 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
675 | } | 675 | } |
676 | 676 | ||
677 | /** | 677 | /** |
678 | * @internal | 678 | * @internal |
679 | */ | 679 | */ |
680 | void ODevice::virtual_hook(int, void* ){ | 680 | void ODevice::virtual_hook(int, void* ){ |
681 | 681 | ||
682 | } | 682 | } |
683 | 683 | ||
684 | /** | 684 | /** |
685 | * \brief Send a QCOP Message before suspending | 685 | * \brief Send a QCOP Message before suspending |
686 | * | 686 | * |
687 | * Sends a QCOP message to channel QPE/System | 687 | * Sends a QCOP message to channel QPE/System |
688 | * with the message "aboutToSuspend()" if this | 688 | * with the message "aboutToSuspend()" if this |
689 | * is the windowing server. | 689 | * is the windowing server. |
690 | * | 690 | * |
691 | * Call this in your custom \sa suspend() Method | 691 | * Call this in your custom \sa suspend() Method |
692 | * before going to suspend. | 692 | * before going to suspend. |
693 | * | 693 | * |
694 | */ | 694 | */ |
695 | void ODevice::sendSuspendmsg() | 695 | void ODevice::sendSuspendmsg() |
696 | { | 696 | { |
697 | if ( isQWS() ) | 697 | if ( isQWS() ) |
698 | return; | 698 | return; |
699 | 699 | ||
700 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 700 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
701 | } | 701 | } |
702 | 702 | ||
703 | /** | 703 | /** |
704 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters | 704 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters |
705 | * | 705 | * |
706 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard | 706 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard |
707 | * Filters. This function is the only way to prepend a KeyFilter. | 707 | * Filters. This function is the only way to prepend a KeyFilter. |
708 | * | 708 | * |
709 | * @param aFilter The KeyFilter to be prepended to the list of filters | 709 | * @param aFilter The KeyFilter to be prepended to the list of filters |
710 | * | 710 | * |
711 | * @see Opie::Core::OKeyFilter | 711 | * @see Opie::Core::OKeyFilter |
712 | * @see Opie::Core::OKeyFilter::inst() | 712 | * @see Opie::Core::OKeyFilter::inst() |
713 | */ | 713 | */ |
714 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | 714 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) |
715 | { | 715 | { |
716 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); | 716 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); |
717 | } | 717 | } |
718 | 718 | ||
719 | /** | 719 | /** |
720 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list | 720 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list |
721 | * | 721 | * |
722 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List | 722 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List |
723 | * of Keyfilters. Call this when you delete the KeyFilter! | 723 | * of Keyfilters. Call this when you delete the KeyFilter! |
724 | * | 724 | * |
725 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter | 725 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter |
726 | * @see Opie::Core::ODevice::addPreHandler | 726 | * @see Opie::Core::ODevice::addPreHandler |
727 | */ | 727 | */ |
728 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | 728 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) |
729 | { | 729 | { |
730 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); | 730 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); |
731 | } | 731 | } |
732 | 732 | ||
733 | 733 | ||
734 | /** | 734 | /** |
735 | * @internal | 735 | * @internal |
736 | * | 736 | * |
737 | * @see changeMixerForAlarm | 737 | * @see changeMixerForAlarm |
738 | */ | 738 | */ |
739 | void ODevice::playingStopped() { | 739 | void ODevice::playingStopped() { |
740 | if ( sender() ) | 740 | if ( sender() ) |
741 | const_cast<QObject*>(sender())->disconnect( this ); | 741 | const_cast<QObject*>(sender())->disconnect( this ); |
742 | 742 | ||
743 | #ifndef QT_NO_SOUND | 743 | #ifndef QT_NO_SOUND |
744 | if ( d->m_sound >= 0 ) { | 744 | if ( d->m_sound >= 0 ) { |
745 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); | 745 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); |
746 | ::close ( d->m_sound ); | 746 | ::close ( d->m_sound ); |
747 | } | 747 | } |
748 | #endif | 748 | #endif |
749 | } | 749 | } |
750 | 750 | ||
751 | 751 | ||
752 | /** | 752 | /** |
753 | * \brief Change the Volume for the Alarm and set it back after playing is finished | 753 | * \brief Change the Volume for the Alarm and set it back after playing is finished |
754 | * | 754 | * |
755 | * If you play an Alarm Sound you might want to change the Mixer to | 755 | * If you play an Alarm Sound you might want to change the Mixer to |
756 | * full volume and ignore the user setting. After it \sa Sound::isFinished | 756 | * full volume and ignore the user setting. After it \sa Sound::isFinished |
757 | * you would turn the volume back to the user preference. | 757 | * you would turn the volume back to the user preference. |
758 | * The problem is that we used to enter the event loop while waiting | 758 | * The problem is that we used to enter the event loop while waiting |
759 | * for the sound to be finished triggering all kind of reentrance | 759 | * for the sound to be finished triggering all kind of reentrance |
760 | * problems what a library shouldn't introduce. | 760 | * problems what a library shouldn't introduce. |
761 | * Instead of manually waiting for the sound to be finished use | 761 | * Instead of manually waiting for the sound to be finished use |
762 | * this Method and it will automatically restore the Mixer to | 762 | * this Method and it will automatically restore the Mixer to |
763 | * the user configuration after the sound finished playing. | 763 | * the user configuration after the sound finished playing. |
764 | * | 764 | * |
765 | * Note: The onwership of \param snd is not transfered and playing | 765 | * Note: The onwership of \param snd is not transfered and playing |
766 | * is not started in this method. If 'snd' gets deleted before | 766 | * is not started in this method. If 'snd' gets deleted before |
767 | * playing is finished the volume doesn't get set back to | 767 | * playing is finished the volume doesn't get set back to |
768 | * the user preference! | 768 | * the user preference! |
769 | * | 769 | * |
770 | * \code | 770 | * \code |
771 | * static Sound snd("alarm"); | 771 | * static Sound snd("alarm"); |
772 | * if(!snd.isFinished()) | 772 | * if(!snd.isFinished()) |
773 | * return; | 773 | * return; |
774 | * | 774 | * |
775 | * changeMixerForAlarm( my_channel, "/dev/mixer", &snd ); | 775 | * changeMixerForAlarm( my_channel, "/dev/mixer", &snd ); |
776 | * snd.play() | 776 | * snd.play() |
777 | * \endcode | 777 | * \endcode |
778 | * | 778 | * |
779 | * | 779 | * |
780 | * | 780 | * |
781 | * @param mixer The mixer number/channel to use | 781 | * @param mixer The mixer number/channel to use |
782 | * @param file The file name. If you convert from QString use QFile::encodeName | 782 | * @param file The file name. If you convert from QString use QFile::encodeName |
783 | * @param snd The sound to wait for finishing | 783 | * @param snd The sound to wait for finishing |
784 | * | 784 | * |
785 | */ | 785 | */ |
786 | void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { | 786 | void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { |
787 | #ifndef QT_NO_SOUND | 787 | #ifndef QT_NO_SOUND |
788 | if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { | 788 | if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { |
789 | if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { | 789 | if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { |
790 | Config cfg ( "qpe" ); | 790 | Config cfg ( "qpe" ); |
791 | cfg. setGroup ( "Volume" ); | 791 | cfg. setGroup ( "Volume" ); |
792 | 792 | ||
793 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 793 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
794 | if ( volalarm < 0 ) | 794 | if ( volalarm < 0 ) |
795 | volalarm = 0; | 795 | volalarm = 0; |
796 | else if ( volalarm > 100 ) | 796 | else if ( volalarm > 100 ) |
797 | volalarm = 100; | 797 | volalarm = 100; |
798 | volalarm |= ( volalarm << 8 ); | 798 | volalarm |= ( volalarm << 8 ); |
799 | 799 | ||
800 | if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) | 800 | if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) |
801 | register_qpe_sound_finished(snd, this, SLOT(playingStopped())); | 801 | register_qpe_sound_finished(snd, this, SLOT(playingStopped())); |
802 | } | 802 | } |
803 | d->m_mixer = mixer; | 803 | d->m_mixer = mixer; |
804 | } | 804 | } |
805 | #endif | 805 | #endif |
806 | } | 806 | } |
807 | 807 | ||
808 | } | 808 | } |
809 | } | 809 | } |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index c434216..e7cd82a 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,379 +1,379 @@ | |||
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 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xff000000, | 59 | Model_Series_Mask = 0xff000000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 24 ), | 61 | Model_iPAQ = ( 1 << 24 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
71 | 71 | ||
72 | Model_Jornada = ( 6 << 24 ), | 72 | Model_Jornada = ( 6 << 24 ), |
73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
74 | Model_Jornada_720 = ( Model_Jornada | 0x000002 ), | 74 | Model_Jornada_720 = ( Model_Jornada | 0x000002 ), |
75 | 75 | ||
76 | Model_Zaurus = ( 2 << 24 ), | 76 | Model_Zaurus = ( 2 << 24 ), |
77 | 77 | ||
78 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 78 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
79 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 79 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
80 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 80 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
81 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 81 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
82 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 82 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
83 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), | 83 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), |
84 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), | 84 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), |
85 | 85 | ||
86 | Model_SIMpad = ( 3 << 24 ), | 86 | Model_SIMpad = ( 3 << 24 ), |
87 | 87 | ||
88 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 88 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
89 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 89 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
90 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 90 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
91 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 91 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
92 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 92 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
93 | 93 | ||
94 | Model_Ramses = ( 4 << 24 ), | 94 | Model_Ramses = ( 4 << 24 ), |
95 | 95 | ||
96 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 96 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
97 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 97 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
98 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), | 98 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), |
99 | 99 | ||
100 | Model_Yopy = ( 5 << 24 ), | 100 | Model_Yopy = ( 5 << 24 ), |
101 | 101 | ||
102 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 102 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
103 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 103 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
104 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 104 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
105 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 105 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
106 | 106 | ||
107 | Model_Beagle = ( 6 << 24 ), | 107 | Model_Beagle = ( 6 << 24 ), |
108 | 108 | ||
109 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), | 109 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), |
110 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), | 110 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), |
111 | 111 | ||
112 | Model_GenuineIntel = ( 7 << 24 ) | 112 | Model_GenuineIntel = ( 7 << 24 ) |
113 | 113 | ||
114 | }; | 114 | }; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * The vendor of the device | 117 | * The vendor of the device |
118 | */ | 118 | */ |
119 | enum OVendor { | 119 | enum OVendor { |
120 | Vendor_Unknown, | 120 | Vendor_Unknown, |
121 | 121 | ||
122 | Vendor_HP, | 122 | Vendor_HP, |
123 | Vendor_Sharp, | 123 | Vendor_Sharp, |
124 | Vendor_SIEMENS, | 124 | Vendor_SIEMENS, |
125 | Vendor_MundN, | 125 | Vendor_MundN, |
126 | Vendor_GMate, | 126 | Vendor_GMate, |
127 | Vendor_MasterIA, | 127 | Vendor_MasterIA, |
128 | Vendor_GenuineIntel | 128 | Vendor_GenuineIntel |
129 | }; | 129 | }; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * The System used | 132 | * The System used |
133 | */ | 133 | */ |
134 | enum OSystem { | 134 | enum OSystem { |
135 | System_Unknown, | 135 | System_Unknown, |
136 | 136 | ||
137 | System_Familiar, | 137 | System_Familiar, |
138 | System_Zaurus, | 138 | System_Zaurus, |
139 | System_OpenZaurus, | 139 | System_OpenZaurus, |
140 | System_Linupy, | 140 | System_Linupy, |
141 | System_OpenEmbedded, | 141 | System_OpenEmbedded, |
142 | System_PC | 142 | System_PC |
143 | }; | 143 | }; |
144 | 144 | ||
145 | typedef struct { | 145 | typedef struct { |
146 | OSystem system; | 146 | OSystem system; |
147 | char* sysstr; | 147 | char* sysstr; |
148 | char* sysvfile; | 148 | char* sysvfile; |
149 | } ODistribution; | 149 | } ODistribution; |
150 | 150 | ||
151 | extern ODistribution distributions[]; | 151 | extern ODistribution distributions[]; |
152 | 152 | ||
153 | 153 | ||
154 | enum OLedState { | 154 | enum OLedState { |
155 | Led_Off, | 155 | Led_Off, |
156 | Led_On, | 156 | Led_On, |
157 | Led_BlinkSlow, | 157 | Led_BlinkSlow, |
158 | Led_BlinkFast | 158 | Led_BlinkFast |
159 | }; | 159 | }; |
160 | 160 | ||
161 | enum OLed { | 161 | enum OLed { |
162 | Led_Mail, | 162 | Led_Mail, |
163 | Led_Power, | 163 | Led_Power, |
164 | Led_BlueTooth | 164 | Led_BlueTooth |
165 | }; | 165 | }; |
166 | 166 | ||
167 | enum OHardKey { | 167 | enum OHardKey { |
168 | HardKey_Datebook = Qt::Key_F9, | 168 | HardKey_Datebook = Qt::Key_F9, |
169 | HardKey_Contacts = Qt::Key_F10, | 169 | HardKey_Contacts = Qt::Key_F10, |
170 | HardKey_Menu = Qt::Key_F11, | 170 | HardKey_Menu = Qt::Key_F11, |
171 | HardKey_Home = Qt::Key_F12, | 171 | HardKey_Home = Qt::Key_F12, |
172 | HardKey_Mail = Qt::Key_F13, | 172 | HardKey_Mail = Qt::Key_F13, |
173 | HardKey_Record = Qt::Key_F24, | 173 | HardKey_Record = Qt::Key_F24, |
174 | HardKey_Suspend = Qt::Key_F34, | 174 | HardKey_Suspend = Qt::Key_F34, |
175 | HardKey_Backlight = Qt::Key_F35, | 175 | HardKey_Backlight = Qt::Key_F35, |
176 | HardKey_Action = Qt::Key_F10, | 176 | HardKey_Action = Qt::Key_F10, |
177 | HardKey_OK = Qt::Key_F11, | 177 | HardKey_OK = Qt::Key_F11, |
178 | HardKey_End = Qt::Key_F12, | 178 | HardKey_End = Qt::Key_F12, |
179 | }; | 179 | }; |
180 | 180 | ||
181 | enum ODirection { | 181 | enum ODirection { |
182 | CW = 0, | 182 | CW = 0, |
183 | CCW = 1, | 183 | CCW = 1, |
184 | Flip = 2, | 184 | Flip = 2, |
185 | }; | 185 | }; |
186 | 186 | ||
187 | enum OHingeStatus { | 187 | enum OHingeStatus { |
188 | CASE_CLOSED = 3, | 188 | CASE_CLOSED = 3, |
189 | CASE_PORTRAIT = 2, | 189 | CASE_PORTRAIT = 2, |
190 | CASE_LANDSCAPE = 0, | 190 | CASE_LANDSCAPE = 0, |
191 | CASE_UNKNOWN = 1, | 191 | CASE_UNKNOWN = 1, |
192 | }; | 192 | }; |
193 | 193 | ||
194 | /* default button for qvfb or such | 194 | /* default button for qvfb or such |
195 | * see odevice.cpp for details. | 195 | * see odevice.cpp for details. |
196 | * hint: manage a user defined button for qvfb? | 196 | * hint: manage a user defined button for qvfb? |
197 | * alwin | 197 | * alwin |
198 | */ | 198 | */ |
199 | struct default_button { | 199 | struct default_button { |
200 | Qt::Key code; | 200 | Qt::Key code; |
201 | char *utext; | 201 | char *utext; |
202 | char *pix; | 202 | char *pix; |
203 | char *fpressedservice; | 203 | char *fpressedservice; |
204 | char *fpressedaction; | 204 | char *fpressedaction; |
205 | char *fheldservice; | 205 | char *fheldservice; |
206 | char *fheldaction; | 206 | char *fheldaction; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * A singleton which gives informations about device specefic option | 210 | * A singleton which gives informations about device specefic option |
211 | * like the Hardware used, LEDs, the Base Distribution and | 211 | * like the Hardware used, LEDs, the Base Distribution and |
212 | * hardware key mappings. | 212 | * hardware key mappings. |
213 | * | 213 | * |
214 | * @short A small class for device specefic options | 214 | * @short A small class for device specefic options |
215 | * @see QObject | 215 | * @see QObject |
216 | * @author Robert Griebl | 216 | * @author Robert Griebl |
217 | * @version 1.0 | 217 | * @version 1.0 |
218 | */ | 218 | */ |
219 | class ODevice : public QObject | 219 | class ODevice : public QObject |
220 | { | 220 | { |
221 | Q_OBJECT | 221 | Q_OBJECT |
222 | 222 | ||
223 | private: | 223 | private: |
224 | /* disable copy */ | 224 | /* disable copy */ |
225 | ODevice ( const ODevice & ); | 225 | ODevice ( const ODevice & ); |
226 | 226 | ||
227 | protected: | 227 | protected: |
228 | ODevice(); | 228 | ODevice(); |
229 | virtual void init(const QString&); | 229 | virtual void init(const QString&); |
230 | virtual void initButtons(); | 230 | virtual void initButtons(); |
231 | static void sendSuspendmsg(); | 231 | static void sendSuspendmsg(); |
232 | 232 | ||
233 | ODeviceData *d; | 233 | ODeviceData *d; |
234 | 234 | ||
235 | public: | 235 | public: |
236 | // sandman do we want to allow destructions? -zecke? | 236 | // sandman do we want to allow destructions? -zecke? |
237 | virtual ~ODevice(); | 237 | virtual ~ODevice(); |
238 | 238 | ||
239 | static ODevice *inst(); | 239 | static ODevice *inst(); |
240 | 240 | ||
241 | // information | 241 | // information |
242 | 242 | ||
243 | QString modelString() const; | 243 | QString modelString() const; |
244 | OModel model() const; | 244 | OModel model() const; |
245 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 245 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
246 | 246 | ||
247 | QString vendorString() const; | 247 | QString vendorString() const; |
248 | OVendor vendor() const; | 248 | OVendor vendor() const; |
249 | 249 | ||
250 | QString systemString() const; | 250 | QString systemString() const; |
251 | OSystem system() const; | 251 | OSystem system() const; |
252 | 252 | ||
253 | QString systemVersionString() const; | 253 | QString systemVersionString() const; |
254 | 254 | ||
255 | virtual Transformation rotation() const; | 255 | virtual Transformation rotation() const; |
256 | virtual ODirection direction() const; | 256 | virtual ODirection direction() const; |
257 | 257 | ||
258 | // system | 258 | // system |
259 | virtual bool suspend(); | 259 | virtual bool suspend(); |
260 | 260 | ||
261 | virtual bool setDisplayStatus ( bool on ); | 261 | virtual bool setDisplayStatus ( bool on ); |
262 | virtual bool setDisplayBrightness ( int brightness ); | 262 | virtual bool setDisplayBrightness ( int brightness ); |
263 | virtual int displayBrightnessResolution() const; | 263 | virtual int displayBrightnessResolution() const; |
264 | virtual bool setDisplayContrast ( int contrast ); | 264 | virtual bool setDisplayContrast ( int contrast ); |
265 | virtual int displayContrastResolution() const; | 265 | virtual int displayContrastResolution() const; |
266 | 266 | ||
267 | // don't add new virtual methods, use this: | 267 | // don't add new virtual methods, use this: |
268 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 268 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
269 | // and in your subclass do overwrite | 269 | // and in your subclass do overwrite |
270 | // protected virtual int virtual_hook(int, void *) | 270 | // protected virtual int virtual_hook(int, void *) |
271 | // which is defined below | 271 | // which is defined below |
272 | 272 | ||
273 | // input / output | 273 | // input / output |
274 | virtual void playAlarmSound(); | 274 | virtual void playAlarmSound(); |
275 | virtual void playKeySound(); | 275 | virtual void playKeySound(); |
276 | virtual void playTouchSound(); | 276 | virtual void playTouchSound(); |
277 | 277 | ||
278 | virtual QValueList <OLed> ledList() const; | 278 | virtual QValueList <OLed> ledList() const; |
279 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 279 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
280 | virtual OLedState ledState ( OLed led ) const; | 280 | virtual OLedState ledState ( OLed led ) const; |
281 | virtual bool setLedState ( OLed led, OLedState st ); | 281 | virtual bool setLedState ( OLed led, OLedState st ); |
282 | 282 | ||
283 | virtual bool hasLightSensor() const; | 283 | virtual bool hasLightSensor() const; |
284 | virtual int readLightSensor(); | 284 | virtual int readLightSensor(); |
285 | virtual int lightSensorResolution() const; | 285 | virtual int lightSensorResolution() const; |
286 | 286 | ||
287 | virtual bool hasHingeSensor() const; | 287 | virtual bool hasHingeSensor() const; |
288 | virtual OHingeStatus readHingeSensor(); | 288 | virtual OHingeStatus readHingeSensor()const; |
289 | 289 | ||
290 | const QStrList &allowedCpuFrequencies() const; | 290 | const QStrList &allowedCpuFrequencies() const; |
291 | bool setCurrentCpuFrequency(uint index); | 291 | bool setCurrentCpuFrequency(uint index); |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * Returns the available buttons on this device. The number and location | 294 | * Returns the available buttons on this device. The number and location |
295 | * of buttons will vary depending on the device. Button numbers will be assigned | 295 | * of buttons will vary depending on the device. Button numbers will be assigned |
296 | * by the device manufacturer and will be from most preferred button to least preffered | 296 | * by the device manufacturer and will be from most preferred button to least preffered |
297 | * button. Note that this list only contains "user mappable" buttons. | 297 | * button. Note that this list only contains "user mappable" buttons. |
298 | * | 298 | * |
299 | * @todo Make method const and take care of calling initButtons or make that const too | 299 | * @todo Make method const and take care of calling initButtons or make that const too |
300 | * | 300 | * |
301 | */ | 301 | */ |
302 | const QValueList<ODeviceButton> &buttons(); | 302 | const QValueList<ODeviceButton> &buttons(); |
303 | 303 | ||
304 | /** | 304 | /** |
305 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 305 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
306 | * returns 0L | 306 | * returns 0L |
307 | */ | 307 | */ |
308 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 308 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Reassigns the pressed action for \a button. To return to the factory | 311 | * Reassigns the pressed action for \a button. To return to the factory |
312 | * default pass an empty string as \a qcopMessage. | 312 | * default pass an empty string as \a qcopMessage. |
313 | */ | 313 | */ |
314 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 314 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * Reassigns the held action for \a button. To return to the factory | 317 | * Reassigns the held action for \a button. To return to the factory |
318 | * default pass an empty string as \a qcopMessage. | 318 | * default pass an empty string as \a qcopMessage. |
319 | */ | 319 | */ |
320 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 320 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
321 | 321 | ||
322 | /** | 322 | /** |
323 | * How long (in ms) you have to press a button for a "hold" action | 323 | * How long (in ms) you have to press a button for a "hold" action |
324 | */ | 324 | */ |
325 | uint buttonHoldTime() const; | 325 | uint buttonHoldTime() const; |
326 | 326 | ||
327 | signals: | 327 | signals: |
328 | void buttonMappingChanged(); | 328 | void buttonMappingChanged(); |
329 | 329 | ||
330 | private slots: | 330 | private slots: |
331 | void systemMessage ( const QCString &, const QByteArray & ); | 331 | void systemMessage ( const QCString &, const QByteArray & ); |
332 | void playingStopped(); | 332 | void playingStopped(); |
333 | 333 | ||
334 | protected: | 334 | protected: |
335 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | 335 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); |
336 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | 336 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); |
337 | void reloadButtonMapping(); | 337 | void reloadButtonMapping(); |
338 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); | 338 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); |
339 | 339 | ||
340 | /* ugly virtual hook */ | 340 | /* ugly virtual hook */ |
341 | virtual void virtual_hook( int id, void* data ); | 341 | virtual void virtual_hook( int id, void* data ); |
342 | }; | 342 | }; |
343 | 343 | ||
344 | class ODeviceData { | 344 | class ODeviceData { |
345 | 345 | ||
346 | public: | 346 | public: |
347 | QString m_vendorstr; | 347 | QString m_vendorstr; |
348 | OVendor m_vendor; | 348 | OVendor m_vendor; |
349 | 349 | ||
350 | QString m_modelstr; | 350 | QString m_modelstr; |
351 | OModel m_model; | 351 | OModel m_model; |
352 | 352 | ||
353 | QString m_systemstr; | 353 | QString m_systemstr; |
354 | OSystem m_system; | 354 | OSystem m_system; |
355 | 355 | ||
356 | QString m_sysverstr; | 356 | QString m_sysverstr; |
357 | 357 | ||
358 | Transformation m_rotation; | 358 | Transformation m_rotation; |
359 | ODirection m_direction; | 359 | ODirection m_direction; |
360 | 360 | ||
361 | QValueList <ODeviceButton> *m_buttons; | 361 | QValueList <ODeviceButton> *m_buttons; |
362 | uint m_holdtime; | 362 | uint m_holdtime; |
363 | QStrList *m_cpu_frequencies; | 363 | QStrList *m_cpu_frequencies; |
364 | bool m_initializedButtonQcop : 1; | 364 | bool m_initializedButtonQcop : 1; |
365 | 365 | ||
366 | /* values for changeMixerForAlarm */ | 366 | /* values for changeMixerForAlarm */ |
367 | int m_sound, m_vol, m_mixer; | 367 | int m_sound, m_vol, m_mixer; |
368 | }; | 368 | }; |
369 | 369 | ||
370 | extern bool isQWS(); | 370 | extern bool isQWS(); |
371 | extern QCString makeChannel ( const char *str ); | 371 | extern QCString makeChannel ( const char *str ); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | 376 | ||
377 | 377 | ||
378 | #endif | 378 | #endif |
379 | 379 | ||