Diffstat (limited to 'core/applets/volumeapplet/volume.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index c736437..8fd88f6 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -9,48 +9,44 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <stdio.h> | ||
22 | |||
23 | #include "volume.h" | 21 | #include "volume.h" |
22 | #include "oledbox.h" | ||
24 | 23 | ||
24 | #include <opie2/odevice.h> | ||
25 | #include <opie2/otaskbarapplet.h> | ||
25 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
26 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
27 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | ||
29 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
30 | #endif | ||
31 | 30 | ||
32 | #include <qpainter.h> | 31 | #include <qpainter.h> |
33 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
34 | #include <qslider.h> | 33 | #include <qslider.h> |
35 | #include <qlayout.h> | 34 | #include <qlayout.h> |
36 | #include <qvbox.h> | 35 | #include <qvbox.h> |
37 | #include <qlabel.h> | 36 | #include <qlabel.h> |
38 | |||
39 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
40 | #include <qtimer.h> | 38 | #include <qtimer.h> |
41 | 39 | ||
42 | #include <opie/odevice.h> | 40 | #include <stdio.h> |
43 | |||
44 | #include "oledbox.h" | ||
45 | 41 | ||
46 | using namespace Opie; | 42 | using namespace Opie; |
47 | 43 | ||
48 | #define RATE_TIMER_INTERVAL 100 | 44 | #define RATE_TIMER_INTERVAL 100 |
49 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time | 45 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time |
50 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. | 46 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. |
51 | 47 | ||
52 | 48 | ||
53 | /* XPM */ | 49 | /* XPM */ |
54 | static const char * vol_xpm[] = { | 50 | static const char * vol_xpm[] = { |
55 | "20 20 3 1", | 51 | "20 20 3 1", |
56 | " c None", | 52 | " c None", |
@@ -728,24 +724,28 @@ VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | |||
728 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); | 724 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); |
729 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); | 725 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
730 | 726 | ||
731 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); | 727 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); |
732 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); | 728 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); |
733 | } | 729 | } |
734 | 730 | ||
735 | VolumeApplet::~VolumeApplet() | 731 | VolumeApplet::~VolumeApplet() |
736 | { | 732 | { |
737 | delete m_pixmap; | 733 | delete m_pixmap; |
738 | } | 734 | } |
739 | 735 | ||
736 | int VolumeApplet::position() | ||
737 | { | ||
738 | return 6; | ||
739 | } | ||
740 | 740 | ||
741 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 741 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
742 | { | 742 | { |
743 | if ( m_dialog-> isVisible ( )) | 743 | if ( m_dialog-> isVisible ( )) |
744 | m_dialog-> hide ( ); | 744 | m_dialog-> hide ( ); |
745 | else | 745 | else |
746 | m_dialog-> show ( true ); | 746 | m_dialog-> show ( true ); |
747 | } | 747 | } |
748 | 748 | ||
749 | void VolumeApplet::redraw ( bool all ) | 749 | void VolumeApplet::redraw ( bool all ) |
750 | { | 750 | { |
751 | if ( all ) | 751 | if ( all ) |
@@ -768,12 +768,16 @@ void VolumeApplet::paintEvent ( QPaintEvent * ) | |||
768 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 768 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
769 | 769 | ||
770 | if ( m_dialog-> volMuted ( )) { | 770 | if ( m_dialog-> volMuted ( )) { |
771 | p. setPen ( red ); | 771 | p. setPen ( red ); |
772 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); | 772 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); |
773 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); | 773 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); |
774 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); | 774 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); |
775 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); | 775 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); |
776 | } | 776 | } |
777 | } | 777 | } |
778 | 778 | ||
779 | 779 | ||
780 | Q_EXPORT_INTERFACE() | ||
781 | { | ||
782 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> ); | ||
783 | } | ||