Diffstat (limited to 'noncore/multimedia/opieplayer2/volumecontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/volumecontrol.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp index a795f3b..271b84e 100644 --- a/noncore/multimedia/opieplayer2/volumecontrol.cpp +++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp | |||
@@ -1,61 +1,60 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include "qpe/qcopenvelope_qws.h" | 4 | #include "qpe/qcopenvelope_qws.h" |
5 | #include <qmessagebox.h> | 5 | #include <qmessagebox.h> |
6 | 6 | ||
7 | #include "volumecontrol.h" | 7 | #include "volumecontrol.h" |
8 | 8 | ||
9 | int VolumeControl::getVolume() { | 9 | int VolumeControl::volume() { |
10 | int volumePerc; | ||
11 | Config cfg( "qpe" ); | 10 | Config cfg( "qpe" ); |
12 | cfg. setGroup( "Volume" ); | 11 | cfg. setGroup( "Volume" ); |
13 | volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); | 12 | m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); |
14 | m_volumePerc = volumePerc; | 13 | |
15 | return volumePerc; | 14 | return m_volumePerc; |
16 | } | 15 | } |
17 | 16 | ||
18 | 17 | ||
19 | void VolumeControl::setVolume( int volumePerc ) { | 18 | void VolumeControl::setVolume( int volumePerc ) { |
20 | Config cfg("qpe"); | 19 | Config cfg("qpe"); |
21 | cfg.setGroup("Volume"); | 20 | cfg.setGroup("Volume"); |
22 | 21 | ||
23 | if ( volumePerc > 100 ) { | 22 | if ( volumePerc > 100 ) { |
24 | volumePerc = 100; | 23 | volumePerc = 100; |
25 | } | 24 | } |
26 | if ( volumePerc < 0 ) { | 25 | if ( volumePerc < 0 ) { |
27 | volumePerc = 0; | 26 | volumePerc = 0; |
28 | } | 27 | } |
29 | 28 | ||
30 | m_volumePerc = volumePerc; | 29 | m_volumePerc = volumePerc; |
31 | cfg.writeEntry("VolumePercent", volumePerc ); | 30 | cfg.writeEntry("VolumePercent", volumePerc ); |
32 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 31 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
33 | // QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc; | 32 | // QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc; |
34 | } | 33 | } |
35 | 34 | ||
36 | 35 | ||
37 | void VolumeControl::incVol( int ammount ) { | 36 | void VolumeControl::incVol( int ammount ) { |
38 | int oldVol = getVolume(); | 37 | int oldVol = volume(); |
39 | setVolume( oldVol + ammount); | 38 | setVolume( oldVol + ammount); |
40 | } | 39 | } |
41 | 40 | ||
42 | void VolumeControl::decVol( int ammount ) { | 41 | void VolumeControl::decVol( int ammount ) { |
43 | int oldVol = getVolume(); | 42 | int oldVol = volume(); |
44 | setVolume( oldVol - ammount); | 43 | setVolume( oldVol - ammount); |
45 | } | 44 | } |
46 | 45 | ||
47 | 46 | ||
48 | VolumeControl::VolumeControl( ) { | 47 | VolumeControl::VolumeControl( ) { |
49 | getVolume(); | 48 | volume(); |
50 | } | 49 | } |
51 | 50 | ||
52 | VolumeControl::~VolumeControl() { | 51 | VolumeControl::~VolumeControl() { |
53 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 52 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
54 | } | 53 | } |
55 | 54 | ||
56 | void VolumeControl::setMute(bool on) { | 55 | void VolumeControl::setMute(bool on) { |
57 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on; | 56 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on; |
58 | } | 57 | } |
59 | 58 | ||
60 | 59 | ||
61 | 60 | ||