Diffstat (limited to 'core/applets/volumeapplet/volume.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index 942cebb..276f47f 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -18,56 +18,57 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "volume.h" | 21 | #include "volume.h" |
22 | #include "oledbox.h" | 22 | #include "oledbox.h" |
23 | 23 | ||
24 | #include <opie2/odevice.h> | 24 | #include <opie2/odevice.h> |
25 | #include <opie2/otaskbarapplet.h> | 25 | #include <opie2/otaskbarapplet.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
30 | 30 | ||
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qslider.h> | 33 | #include <qslider.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | 39 | ||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | 41 | ||
42 | using namespace Opie; | 42 | using namespace Opie::Core; |
43 | 43 | ||
44 | #define RATE_TIMER_INTERVAL 100 | 44 | #define RATE_TIMER_INTERVAL 100 |
45 | // 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 |
46 | // 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. |
47 | 47 | ||
48 | 48 | ||
49 | /* XPM */ | 49 | /* XPM */ |
50 | using namespace Opie::Ui; | ||
50 | static const char * vol_xpm[] = { | 51 | static const char * vol_xpm[] = { |
51 | "20 20 3 1", | 52 | "20 20 3 1", |
52 | " c None", | 53 | " c None", |
53 | ". c #0000FF", | 54 | ". c #0000FF", |
54 | "+ c #000000", | 55 | "+ c #000000", |
55 | " ", | 56 | " ", |
56 | " . ", | 57 | " . ", |
57 | " . . . . ", | 58 | " . . . . ", |
58 | " . . . . . . ", | 59 | " . . . . . . ", |
59 | " . . . . . . . ", | 60 | " . . . . . . . ", |
60 | " . . ..... . . ", | 61 | " . . ..... . . ", |
61 | " . ... ..... ... ", | 62 | " . ... ..... ... ", |
62 | " ........... .... ", | 63 | " ........... .... ", |
63 | " ................. ", | 64 | " ................. ", |
64 | "++++++++++++++++++++", | 65 | "++++++++++++++++++++", |
65 | " .................. ", | 66 | " .................. ", |
66 | " . ............. . ", | 67 | " . ............. . ", |
67 | " . ..... ....... ", | 68 | " . ..... ....... ", |
68 | " . ... ..... . ", | 69 | " . ... ..... . ", |
69 | " . ... ..... . ", | 70 | " . ... ..... . ", |
70 | " . ... ..... ", | 71 | " . ... ..... ", |
71 | " . . . . . ", | 72 | " . . . . . ", |
72 | " . . . ", | 73 | " . . . ", |
73 | " . . . ", | 74 | " . . . ", |
@@ -756,28 +757,25 @@ void VolumeApplet::redraw ( bool all ) | |||
756 | 757 | ||
757 | 758 | ||
758 | void VolumeApplet::paintEvent ( QPaintEvent * ) | 759 | void VolumeApplet::paintEvent ( QPaintEvent * ) |
759 | { | 760 | { |
760 | QPainter p ( this ); | 761 | QPainter p ( this ); |
761 | 762 | ||
762 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); | 763 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); |
763 | p. setPen ( darkGray ); | 764 | p. setPen ( darkGray ); |
764 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 765 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
765 | 766 | ||
766 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; | 767 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; |
767 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 768 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
768 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 769 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
769 | 770 | ||
770 | if ( m_dialog-> volMuted ( )) { | 771 | if ( m_dialog-> volMuted ( )) { |
771 | p. setPen ( red ); | 772 | p. setPen ( red ); |
772 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); | 773 | p. drawLine ( 1, 2, width() - 2, height() - 5 ); |
773 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); | 774 | p. drawLine ( 1, 3, width() - 2, height() - 4 ); |
774 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); | 775 | p. drawLine ( width() - 2, 2, 1, height() - 5 ); |
775 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); | 776 | p. drawLine ( width() - 2, 3, 1, height() - 4 ); |
776 | } | 777 | } |
777 | } | 778 | } |
778 | 779 | ||
779 | 780 | ||
780 | Q_EXPORT_INTERFACE() | 781 | EXPORT_OPIE_APPLET_v1( VolumeApplet ) |
781 | { | ||
782 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> ); | ||
783 | } | ||