author | sandman <sandman> | 2002-10-31 02:06:44 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-31 02:06:44 (UTC) |
commit | ddd5f680b3dbd5e169d43f5216fbf24b04e4cb33 (patch) (unidiff) | |
tree | 4c2f1dbf746db2d9d38223f3a63f39eb3efd2c33 | |
parent | 5a08fd92ac139820e1a1202d0b4b67190f24ccdb (diff) | |
download | opie-ddd5f680b3dbd5e169d43f5216fbf24b04e4cb33.zip opie-ddd5f680b3dbd5e169d43f5216fbf24b04e4cb33.tar.gz opie-ddd5f680b3dbd5e169d43f5216fbf24b04e4cb33.tar.bz2 |
I have finally found the "launcher-settings sometimes crashes Opie bug"
it's the volume applet popup, that has no parent widget (that should
really be no problem, but it works perfectly if you give it a parent)
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index aec346b..06eec58 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -488,147 +488,147 @@ void VolumeControl::screenTapToggled ( bool b ) | |||
488 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); | 488 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); |
489 | } | 489 | } |
490 | 490 | ||
491 | void VolumeControl::keyClickToggled ( bool b ) | 491 | void VolumeControl::keyClickToggled ( bool b ) |
492 | { | 492 | { |
493 | m_snd_key = b; | 493 | m_snd_key = b; |
494 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); | 494 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void VolumeControl::alarmSoundToggled ( bool b ) | 497 | void VolumeControl::alarmSoundToggled ( bool b ) |
498 | { | 498 | { |
499 | m_snd_alarm = b; | 499 | m_snd_alarm = b; |
500 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 500 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
501 | } | 501 | } |
502 | 502 | ||
503 | void VolumeControl::volMuteToggled ( bool b ) | 503 | void VolumeControl::volMuteToggled ( bool b ) |
504 | { | 504 | { |
505 | m_vol_muted = !b; | 505 | m_vol_muted = !b; |
506 | 506 | ||
507 | m_icon-> redraw ( true ); | 507 | m_icon-> redraw ( true ); |
508 | 508 | ||
509 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); | 509 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); |
510 | } | 510 | } |
511 | 511 | ||
512 | void VolumeControl::micMuteToggled ( bool b ) | 512 | void VolumeControl::micMuteToggled ( bool b ) |
513 | { | 513 | { |
514 | m_mic_muted = !b; | 514 | m_mic_muted = !b; |
515 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 515 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
516 | } | 516 | } |
517 | 517 | ||
518 | 518 | ||
519 | void VolumeControl::volMoved ( int percent ) | 519 | void VolumeControl::volMoved ( int percent ) |
520 | { | 520 | { |
521 | m_vol_percent = 100 - percent; | 521 | m_vol_percent = 100 - percent; |
522 | 522 | ||
523 | // clamp volume percent to be between 0 and 100 | 523 | // clamp volume percent to be between 0 and 100 |
524 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); | 524 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); |
525 | // repaint just the little volume rectangle | 525 | // repaint just the little volume rectangle |
526 | m_icon-> redraw ( false ); | 526 | m_icon-> redraw ( false ); |
527 | 527 | ||
528 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); | 528 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void VolumeControl::micMoved ( int percent ) | 531 | void VolumeControl::micMoved ( int percent ) |
532 | { | 532 | { |
533 | m_mic_percent = 100 - percent; | 533 | m_mic_percent = 100 - percent; |
534 | 534 | ||
535 | // clamp volume percent to be between 0 and 100 | 535 | // clamp volume percent to be between 0 and 100 |
536 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); | 536 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); |
537 | 537 | ||
538 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); | 538 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); |
539 | } | 539 | } |
540 | 540 | ||
541 | void VolumeControl::alarmMoved ( int percent ) | 541 | void VolumeControl::alarmMoved ( int percent ) |
542 | { | 542 | { |
543 | m_alarm_percent = 100 - percent; | 543 | m_alarm_percent = 100 - percent; |
544 | 544 | ||
545 | // clamp volume percent to be between 0 and 100 | 545 | // clamp volume percent to be between 0 and 100 |
546 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); | 546 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); |
547 | 547 | ||
548 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 548 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
549 | } | 549 | } |
550 | 550 | ||
551 | 551 | ||
552 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | 552 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) |
553 | { | 553 | { |
554 | Config cfg ( "qpe" ); | 554 | Config cfg ( "qpe" ); |
555 | cfg. setGroup ( "Volume" ); | 555 | cfg. setGroup ( "Volume" ); |
556 | cfg. writeEntry ( entry, val ); | 556 | cfg. writeEntry ( entry, val ); |
557 | // cfg. write ( ); | 557 | // cfg. write ( ); |
558 | 558 | ||
559 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 559 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
560 | switch ( upd ) { | 560 | switch ( upd ) { |
561 | case UPD_Vol: { | 561 | case UPD_Vol: { |
562 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; | 562 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; |
563 | break; | 563 | break; |
564 | } | 564 | } |
565 | case UPD_Mic: { | 565 | case UPD_Mic: { |
566 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; | 566 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; |
567 | break; | 567 | break; |
568 | } | 568 | } |
569 | case UPD_None: | 569 | case UPD_None: |
570 | break; | 570 | break; |
571 | } | 571 | } |
572 | #endif | 572 | #endif |
573 | } | 573 | } |
574 | 574 | ||
575 | //=========================================================================== | 575 | //=========================================================================== |
576 | 576 | ||
577 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 577 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
578 | : QWidget( parent, name ) | 578 | : QWidget( parent, name ) |
579 | { | 579 | { |
580 | setFixedHeight ( 18 ); | 580 | setFixedHeight ( 18 ); |
581 | setFixedWidth ( 14 ); | 581 | setFixedWidth ( 14 ); |
582 | 582 | ||
583 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); | 583 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); |
584 | m_dialog = new VolumeControl ( this ); | 584 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
585 | 585 | ||
586 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); | 586 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); |
587 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); | 587 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); |
588 | } | 588 | } |
589 | 589 | ||
590 | VolumeApplet::~VolumeApplet() | 590 | VolumeApplet::~VolumeApplet() |
591 | { | 591 | { |
592 | delete m_pixmap; | 592 | delete m_pixmap; |
593 | } | 593 | } |
594 | 594 | ||
595 | 595 | ||
596 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 596 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
597 | { | 597 | { |
598 | if ( m_dialog-> isVisible ( )) | 598 | if ( m_dialog-> isVisible ( )) |
599 | m_dialog-> hide ( ); | 599 | m_dialog-> hide ( ); |
600 | else | 600 | else |
601 | m_dialog-> show ( true ); | 601 | m_dialog-> show ( true ); |
602 | } | 602 | } |
603 | 603 | ||
604 | void VolumeApplet::redraw ( bool all ) | 604 | void VolumeApplet::redraw ( bool all ) |
605 | { | 605 | { |
606 | if ( all ) | 606 | if ( all ) |
607 | repaint ( true ); | 607 | repaint ( true ); |
608 | else | 608 | else |
609 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); | 609 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); |
610 | } | 610 | } |
611 | 611 | ||
612 | 612 | ||
613 | void VolumeApplet::paintEvent ( QPaintEvent * ) | 613 | void VolumeApplet::paintEvent ( QPaintEvent * ) |
614 | { | 614 | { |
615 | QPainter p ( this ); | 615 | QPainter p ( this ); |
616 | 616 | ||
617 | p. drawPixmap ( 0, 1, *m_pixmap ); | 617 | p. drawPixmap ( 0, 1, *m_pixmap ); |
618 | p. setPen ( darkGray ); | 618 | p. setPen ( darkGray ); |
619 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 619 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
620 | 620 | ||
621 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; | 621 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; |
622 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 622 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
623 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 623 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
624 | 624 | ||
625 | if ( m_dialog-> volMuted ( )) { | 625 | if ( m_dialog-> volMuted ( )) { |
626 | p. setPen ( red ); | 626 | p. setPen ( red ); |
627 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); | 627 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); |
628 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); | 628 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); |
629 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); | 629 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); |
630 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); | 630 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); |
631 | } | 631 | } |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||