summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp2
-rw-r--r--libopie2/opiecore/device/odevice.h2
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
@@ -422,193 +422,193 @@ 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*/
434void ODevice::playTouchSound() 434void 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*/
449QValueList <OLed> ODevice::ledList() const 449QValueList <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*/
457QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 457QValueList <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*/
465OLedState ODevice::ledState ( OLed /*which*/ ) const 465OLedState 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*/
476bool ODevice::setLedState ( OLed which, OLedState st ) 476bool 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*/
486bool ODevice::hasLightSensor() const 486bool 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*/
494int ODevice::readLightSensor() 494int 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*/
502int ODevice::lightSensorResolution() const 502int 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*/
510bool ODevice::hasHingeSensor() const 510bool 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*/
518OHingeStatus ODevice::readHingeSensor() 518OHingeStatus 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*/
526const QStrList &ODevice::allowedCpuFrequencies() const 526const 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*/
537bool ODevice::setCurrentCpuFrequency(uint index) 537bool 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*/
562const QValueList <ODeviceButton> &ODevice::buttons() 562const 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*/
572uint ODevice::buttonHoldTime() const 572uint 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*/
584const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 584const 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
595void ODevice::reloadButtonMapping() 595void 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;
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
@@ -192,188 +192,188 @@ enum OHingeStatus {
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 */
199struct default_button { 199struct 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 */
219class ODevice : public QObject 219class ODevice : public QObject
220{ 220{
221 Q_OBJECT 221 Q_OBJECT
222 222
223private: 223private:
224 /* disable copy */ 224 /* disable copy */
225 ODevice ( const ODevice & ); 225 ODevice ( const ODevice & );
226 226
227protected: 227protected:
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
235public: 235public:
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
327signals: 327signals:
328 void buttonMappingChanged(); 328 void buttonMappingChanged();
329 329
330private slots: 330private slots:
331 void systemMessage ( const QCString &, const QByteArray & ); 331 void systemMessage ( const QCString &, const QByteArray & );
332 void playingStopped(); 332 void playingStopped();
333 333
334protected: 334protected:
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
344class ODeviceData { 344class 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
370extern bool isQWS(); 370extern bool isQWS();
371extern QCString makeChannel ( const char *str ); 371extern QCString makeChannel ( const char *str );
372} 372}
373} 373}
374 374
375 375
376 376
377 377
378#endif 378#endif
379 379