author | zecke <zecke> | 2004-09-06 10:57:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-06 10:57:48 (UTC) |
commit | 8bf99aaa1b31e770b21b7bf50407a650a8f5d646 (patch) (unidiff) | |
tree | 4aadf040fb94085f54080c2b2b112ab5ff236b24 /libopie2 | |
parent | 97a40bb7f35a8323dd99712bf014387add283177 (diff) | |
download | opie-8bf99aaa1b31e770b21b7bf50407a650a8f5d646.zip opie-8bf99aaa1b31e770b21b7bf50407a650a8f5d646.tar.gz opie-8bf99aaa1b31e770b21b7bf50407a650a8f5d646.tar.bz2 |
GCC 2.95 compile fix for switch/case statement
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 127fee9..64fa199 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -230,204 +230,207 @@ void Zaurus::initButtons() | |||
230 | b. setUserText ( QObject::tr ( "Button", zb->utext )); | 230 | b. setUserText ( QObject::tr ( "Button", zb->utext )); |
231 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); | 231 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); |
232 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), | 232 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), |
233 | zb->fpressedaction )); | 233 | zb->fpressedaction )); |
234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), | 234 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), |
235 | zb->fheldaction )); | 235 | zb->fheldaction )); |
236 | 236 | ||
237 | d->m_buttons->append ( b ); | 237 | d->m_buttons->append ( b ); |
238 | } | 238 | } |
239 | 239 | ||
240 | reloadButtonMapping(); | 240 | reloadButtonMapping(); |
241 | 241 | ||
242 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 242 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
243 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), | 243 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), |
244 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 244 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
245 | } | 245 | } |
246 | 246 | ||
247 | #include <unistd.h> | 247 | #include <unistd.h> |
248 | #include <fcntl.h> | 248 | #include <fcntl.h> |
249 | #include <sys/ioctl.h> | 249 | #include <sys/ioctl.h> |
250 | 250 | ||
251 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 251 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
252 | 252 | ||
253 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 253 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
254 | 254 | ||
255 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 255 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
256 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 256 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
257 | 257 | ||
258 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 258 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
259 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 259 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
260 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 260 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
261 | 261 | ||
262 | /* --- for SHARP_BUZZER device --- */ | 262 | /* --- for SHARP_BUZZER device --- */ |
263 | 263 | ||
264 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 264 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
265 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 265 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
266 | 266 | ||
267 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 267 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
268 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 268 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
269 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 269 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
270 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 270 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
271 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 271 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
272 | 272 | ||
273 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 273 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
274 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 274 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
275 | 275 | ||
276 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 276 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
277 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 277 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
278 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 278 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
279 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 279 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
280 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 280 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
281 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 281 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
282 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 282 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
283 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 283 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
284 | 284 | ||
285 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 285 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
286 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 286 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
287 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 287 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
288 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 288 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
289 | // | 289 | // |
290 | 290 | ||
291 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 291 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
292 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 292 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
293 | 293 | ||
294 | #define SHARP_IOCTL_GET_ROTATION 0x413c | 294 | #define SHARP_IOCTL_GET_ROTATION 0x413c |
295 | 295 | ||
296 | typedef struct sharp_led_status { | 296 | typedef struct sharp_led_status { |
297 | int which; /* select which LED status is wanted. */ | 297 | int which; /* select which LED status is wanted. */ |
298 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 298 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
299 | } sharp_led_status; | 299 | } sharp_led_status; |
300 | 300 | ||
301 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 301 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
302 | 302 | ||
303 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 303 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
304 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 304 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
305 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 305 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
306 | 306 | ||
307 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 307 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
308 | 308 | ||
309 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 309 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
310 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 310 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
311 | #define APM_EVT_POWER_BUTTON (1 << 0) | 311 | #define APM_EVT_POWER_BUTTON (1 << 0) |
312 | 312 | ||
313 | #define FL_IOCTL_STEP_CONTRAST 100 | 313 | #define FL_IOCTL_STEP_CONTRAST 100 |
314 | 314 | ||
315 | 315 | ||
316 | void Zaurus::buzzer ( int sound ) | 316 | void Zaurus::buzzer ( int sound ) |
317 | { | 317 | { |
318 | #ifndef QT_NO_SOUND | 318 | #ifndef QT_NO_SOUND |
319 | Sound *snd = 0; | 319 | Sound *snd = 0; |
320 | 320 | ||
321 | // Not all devices have real sound | 321 | // Not all devices have real sound |
322 | if ( d->m_model == Model_Zaurus_SLC7x0 | 322 | if ( d->m_model == Model_Zaurus_SLC7x0 |
323 | || d->m_model == Model_Zaurus_SLB600 ){ | 323 | || d->m_model == Model_Zaurus_SLB600 ){ |
324 | 324 | ||
325 | switch ( sound ){ | 325 | switch ( sound ){ |
326 | case SHARP_BUZ_TOUCHSOUND: | 326 | case SHARP_BUZ_TOUCHSOUND: { |
327 | static Sound touch_sound("touchsound"); | 327 | static Sound touch_sound("touchsound"); |
328 | snd = &touch_sound; | 328 | snd = &touch_sound; |
329 | } | ||
329 | break; | 330 | break; |
330 | case SHARP_BUZ_KEYSOUND: | 331 | case SHARP_BUZ_KEYSOUND: { |
331 | static Sound key_sound( "keysound" ); | 332 | static Sound key_sound( "keysound" ); |
332 | snd = &key_sound; | 333 | snd = &key_sound; |
334 | } | ||
333 | break; | 335 | break; |
334 | case SHARP_BUZ_SCHEDULE_ALARM: | 336 | case SHARP_BUZ_SCHEDULE_ALARM: |
335 | default: | 337 | default: { |
336 | static Sound alarm_sound("alarm"); | 338 | static Sound alarm_sound("alarm"); |
337 | snd = &alarm_sound; | 339 | snd = &alarm_sound; |
340 | } | ||
338 | break; | 341 | break; |
339 | } | 342 | } |
340 | } | 343 | } |
341 | 344 | ||
342 | // If a soundname is defined, we expect that this device has | 345 | // If a soundname is defined, we expect that this device has |
343 | // sound capabilities.. Otherwise we expect to have the buzzer | 346 | // sound capabilities.. Otherwise we expect to have the buzzer |
344 | // device.. | 347 | // device.. |
345 | if ( snd ){ | 348 | if ( snd ){ |
346 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 349 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
347 | snd-> play(); | 350 | snd-> play(); |
348 | } else { | 351 | } else { |
349 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 352 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
350 | 353 | ||
351 | if ( fd >= 0 ) { | 354 | if ( fd >= 0 ) { |
352 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 355 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
353 | ::close ( fd ); | 356 | ::close ( fd ); |
354 | } | 357 | } |
355 | 358 | ||
356 | } | 359 | } |
357 | #endif | 360 | #endif |
358 | } | 361 | } |
359 | 362 | ||
360 | 363 | ||
361 | void Zaurus::playAlarmSound() | 364 | void Zaurus::playAlarmSound() |
362 | { | 365 | { |
363 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 366 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
364 | } | 367 | } |
365 | 368 | ||
366 | void Zaurus::playTouchSound() | 369 | void Zaurus::playTouchSound() |
367 | { | 370 | { |
368 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 371 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
369 | } | 372 | } |
370 | 373 | ||
371 | void Zaurus::playKeySound() | 374 | void Zaurus::playKeySound() |
372 | { | 375 | { |
373 | buzzer ( SHARP_BUZ_KEYSOUND ); | 376 | buzzer ( SHARP_BUZ_KEYSOUND ); |
374 | } | 377 | } |
375 | 378 | ||
376 | 379 | ||
377 | QValueList <OLed> Zaurus::ledList() const | 380 | QValueList <OLed> Zaurus::ledList() const |
378 | { | 381 | { |
379 | QValueList <OLed> vl; | 382 | QValueList <OLed> vl; |
380 | vl << Led_Mail; | 383 | vl << Led_Mail; |
381 | return vl; | 384 | return vl; |
382 | } | 385 | } |
383 | 386 | ||
384 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 387 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
385 | { | 388 | { |
386 | QValueList <OLedState> vl; | 389 | QValueList <OLedState> vl; |
387 | 390 | ||
388 | if ( l == Led_Mail ) | 391 | if ( l == Led_Mail ) |
389 | vl << Led_Off << Led_On << Led_BlinkSlow; | 392 | vl << Led_Off << Led_On << Led_BlinkSlow; |
390 | return vl; | 393 | return vl; |
391 | } | 394 | } |
392 | 395 | ||
393 | OLedState Zaurus::ledState ( OLed which ) const | 396 | OLedState Zaurus::ledState ( OLed which ) const |
394 | { | 397 | { |
395 | if ( which == Led_Mail ) | 398 | if ( which == Led_Mail ) |
396 | return m_leds [0]; | 399 | return m_leds [0]; |
397 | else | 400 | else |
398 | return Led_Off; | 401 | return Led_Off; |
399 | } | 402 | } |
400 | 403 | ||
401 | bool Zaurus::setLedState ( OLed which, OLedState st ) | 404 | bool Zaurus::setLedState ( OLed which, OLedState st ) |
402 | { | 405 | { |
403 | if (!m_embedix) // Currently not supported on non_embedix kernels | 406 | if (!m_embedix) // Currently not supported on non_embedix kernels |
404 | return false; | 407 | return false; |
405 | 408 | ||
406 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 409 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
407 | 410 | ||
408 | if ( which == Led_Mail ) { | 411 | if ( which == Led_Mail ) { |
409 | if ( fd >= 0 ) { | 412 | if ( fd >= 0 ) { |
410 | struct sharp_led_status leds; | 413 | struct sharp_led_status leds; |
411 | ::memset ( &leds, 0, sizeof( leds )); | 414 | ::memset ( &leds, 0, sizeof( leds )); |
412 | leds. which = SHARP_LED_MAIL_EXISTS; | 415 | leds. which = SHARP_LED_MAIL_EXISTS; |
413 | bool ok = true; | 416 | bool ok = true; |
414 | 417 | ||
415 | switch ( st ) { | 418 | switch ( st ) { |
416 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 419 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
417 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 420 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
418 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 421 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
419 | default : ok = false; | 422 | default : ok = false; |
420 | } | 423 | } |
421 | 424 | ||
422 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 425 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
423 | m_leds [0] = st; | 426 | m_leds [0] = st; |
424 | return true; | 427 | return true; |
425 | } | 428 | } |
426 | } | 429 | } |
427 | } | 430 | } |
428 | return false; | 431 | return false; |
429 | } | 432 | } |
430 | 433 | ||
431 | bool Zaurus::setSoftSuspend ( bool soft ) | 434 | bool Zaurus::setSoftSuspend ( bool soft ) |
432 | { | 435 | { |
433 | if (!m_embedix) { | 436 | if (!m_embedix) { |