-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 906bb77..b129be3 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -666,118 +666,118 @@ void VolumeControl::alarmMoved ( int percent ) | |||
666 | 666 | ||
667 | 667 | ||
668 | void VolumeControl::bassMoved ( int percent ) | 668 | void VolumeControl::bassMoved ( int percent ) |
669 | { | 669 | { |
670 | m_bass_percent = 100 - percent; | 670 | m_bass_percent = 100 - percent; |
671 | 671 | ||
672 | // clamp bass percent to be between 0 and 100 | 672 | // clamp bass percent to be between 0 and 100 |
673 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); | 673 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); |
674 | 674 | ||
675 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); | 675 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); |
676 | } | 676 | } |
677 | 677 | ||
678 | 678 | ||
679 | 679 | ||
680 | void VolumeControl::trebleMoved ( int percent ) | 680 | void VolumeControl::trebleMoved ( int percent ) |
681 | { | 681 | { |
682 | m_treble_percent = 100 - percent; | 682 | m_treble_percent = 100 - percent; |
683 | 683 | ||
684 | // clamp treble percent to be between 0 and 100 | 684 | // clamp treble percent to be between 0 and 100 |
685 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); | 685 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); |
686 | 686 | ||
687 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); | 687 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); |
688 | } | 688 | } |
689 | 689 | ||
690 | 690 | ||
691 | 691 | ||
692 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | 692 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) |
693 | { | 693 | { |
694 | Config cfg ( "qpe" ); | 694 | Config cfg ( "qpe" ); |
695 | cfg. setGroup ( "Volume" ); | 695 | cfg. setGroup ( "Volume" ); |
696 | cfg. writeEntry ( entry, val ); | 696 | cfg. writeEntry ( entry, val ); |
697 | // cfg. write ( ); | 697 | // cfg. write ( ); |
698 | 698 | ||
699 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 699 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
700 | switch ( upd ) { | 700 | switch ( upd ) { |
701 | case UPD_Vol: { | 701 | case UPD_Vol: { |
702 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; | 702 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; |
703 | break; | 703 | break; |
704 | } | 704 | } |
705 | case UPD_Mic: { | 705 | case UPD_Mic: { |
706 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; | 706 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; |
707 | break; | 707 | break; |
708 | } | 708 | } |
709 | case UPD_Bass: { | 709 | case UPD_Bass: { |
710 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | 710 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; |
711 | break; | 711 | break; |
712 | } | 712 | } |
713 | case UPD_Treble: { | 713 | case UPD_Treble: { |
714 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | 714 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; |
715 | break; | 715 | break; |
716 | } | 716 | } |
717 | 717 | ||
718 | case UPD_None: | 718 | case UPD_None: |
719 | break; | 719 | break; |
720 | } | 720 | } |
721 | #endif | 721 | #endif |
722 | } | 722 | } |
723 | 723 | ||
724 | //=========================================================================== | 724 | //=========================================================================== |
725 | 725 | ||
726 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 726 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
727 | : QWidget( parent, name ) | 727 | : QWidget( parent, name ) |
728 | { | 728 | { |
729 | setFixedWidth ( AppLnk::smallIconSize() ); | 729 | setFixedWidth ( AppLnk::smallIconSize() ); |
730 | setFixedHeight ( AppLnk::smallIconSize() ); | 730 | setFixedHeight ( AppLnk::smallIconSize()+4 ); |
731 | 731 | ||
732 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); | 732 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); |
733 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); | 733 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
734 | 734 | ||
735 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); | 735 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); |
736 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); | 736 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); |
737 | } | 737 | } |
738 | 738 | ||
739 | VolumeApplet::~VolumeApplet() | 739 | VolumeApplet::~VolumeApplet() |
740 | { | 740 | { |
741 | delete m_pixmap; | 741 | delete m_pixmap; |
742 | } | 742 | } |
743 | 743 | ||
744 | 744 | ||
745 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 745 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
746 | { | 746 | { |
747 | if ( m_dialog-> isVisible ( )) | 747 | if ( m_dialog-> isVisible ( )) |
748 | m_dialog-> hide ( ); | 748 | m_dialog-> hide ( ); |
749 | else | 749 | else |
750 | m_dialog-> show ( true ); | 750 | m_dialog-> show ( true ); |
751 | } | 751 | } |
752 | 752 | ||
753 | void VolumeApplet::redraw ( bool all ) | 753 | void VolumeApplet::redraw ( bool all ) |
754 | { | 754 | { |
755 | if ( all ) | 755 | if ( all ) |
756 | repaint ( true ); | 756 | repaint ( true ); |
757 | else | 757 | else |
758 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); | 758 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); |
759 | } | 759 | } |
760 | 760 | ||
761 | 761 | ||
762 | void VolumeApplet::paintEvent ( QPaintEvent * ) | 762 | void VolumeApplet::paintEvent ( QPaintEvent * ) |
763 | { | 763 | { |
764 | QPainter p ( this ); | 764 | QPainter p ( this ); |
765 | 765 | ||
766 | p. drawPixmap ( 0, 1, *m_pixmap ); | 766 | p. drawPixmap ( 0, 1, *m_pixmap ); |
767 | p. setPen ( darkGray ); | 767 | p. setPen ( darkGray ); |
768 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 768 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
769 | 769 | ||
770 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; | 770 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; |
771 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 771 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
772 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 772 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
773 | 773 | ||
774 | if ( m_dialog-> volMuted ( )) { | 774 | if ( m_dialog-> volMuted ( )) { |
775 | p. setPen ( red ); | 775 | p. setPen ( red ); |
776 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); | 776 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); |
777 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); | 777 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); |
778 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); | 778 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); |
779 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); | 779 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); |
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | 783 | ||