author | llornkcor <llornkcor> | 2002-08-16 12:22:46 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-16 12:22:46 (UTC) |
commit | 5144bf5607a246441f5b37dd0bbb9564017ce017 (patch) (unidiff) | |
tree | c6f29d27a14426562f7cfa622230cce5879bd3df | |
parent | 2ce537c4275c5071a85efae8e9862b5fd9ceb6ae (diff) | |
download | opie-5144bf5607a246441f5b37dd0bbb9564017ce017.zip opie-5144bf5607a246441f5b37dd0bbb9564017ce017.tar.gz opie-5144bf5607a246441f5b37dd0bbb9564017ce017.tar.bz2 |
added mute and changed qcop from volumeChange to setVolume
-rw-r--r-- | noncore/multimedia/opieplayer2/volumecontrol.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/volumecontrol.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp index b8ec0df..219f63e 100644 --- a/noncore/multimedia/opieplayer2/volumecontrol.cpp +++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp | |||
@@ -1,59 +1,62 @@ | |||
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::getVolume() { |
10 | int volumePerc; | 10 | int volumePerc; |
11 | Config cfg( "qpe" ); | 11 | Config cfg( "qpe" ); |
12 | cfg. setGroup( "Volume" ); | 12 | cfg. setGroup( "Volume" ); |
13 | volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); | 13 | volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); |
14 | m_volumePerc = volumePerc; | 14 | m_volumePerc = volumePerc; |
15 | return volumePerc; | 15 | return volumePerc; |
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | void VolumeControl::setVolume( int volumePerc ) { | 19 | void VolumeControl::setVolume( int volumePerc ) { |
20 | Config cfg("qpe"); | 20 | Config cfg("qpe"); |
21 | cfg.setGroup("Volume"); | 21 | cfg.setGroup("Volume"); |
22 | 22 | ||
23 | if ( volumePerc > 100 ) { | 23 | if ( volumePerc > 100 ) { |
24 | volumePerc = 100; | 24 | volumePerc = 100; |
25 | } | 25 | } |
26 | if ( volumePerc < 0 ) { | 26 | if ( volumePerc < 0 ) { |
27 | volumePerc = 0; | 27 | volumePerc = 0; |
28 | } | 28 | } |
29 | 29 | ||
30 | m_volumePerc = volumePerc; | 30 | m_volumePerc = volumePerc; |
31 | cfg.writeEntry("VolumePercent", volumePerc ); | 31 | cfg.writeEntry("VolumePercent", volumePerc ); |
32 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 32 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
33 | QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc; | ||
33 | } | 34 | } |
34 | 35 | ||
35 | 36 | ||
36 | void VolumeControl::incVol( int ammount ) { | 37 | void VolumeControl::incVol( int ammount ) { |
37 | int oldVol = getVolume(); | 38 | int oldVol = getVolume(); |
38 | setVolume( oldVol + ammount); | 39 | setVolume( oldVol + ammount); |
39 | } | 40 | } |
40 | 41 | ||
41 | void VolumeControl::decVol( int ammount ) { | 42 | void VolumeControl::decVol( int ammount ) { |
42 | int oldVol = getVolume(); | 43 | int oldVol = getVolume(); |
43 | setVolume( oldVol - ammount); | 44 | setVolume( oldVol - ammount); |
44 | } | 45 | } |
45 | 46 | ||
46 | 47 | ||
47 | VolumeControl::VolumeControl( ) { | 48 | VolumeControl::VolumeControl( ) { |
48 | getVolume(); | 49 | getVolume(); |
49 | } | 50 | } |
50 | 51 | ||
51 | VolumeControl::~VolumeControl() { | 52 | VolumeControl::~VolumeControl() { |
52 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | 53 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; |
53 | } | 54 | } |
54 | 55 | ||
55 | 56 | void VolumeControl::setMute(bool on) { | |
57 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on; | ||
58 | } | ||
56 | 59 | ||
57 | 60 | ||
58 | 61 | ||
59 | 62 | ||
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.h b/noncore/multimedia/opieplayer2/volumecontrol.h index 37be398..d0d34a2 100644 --- a/noncore/multimedia/opieplayer2/volumecontrol.h +++ b/noncore/multimedia/opieplayer2/volumecontrol.h | |||
@@ -6,42 +6,43 @@ | |||
6 | 6 | ||
7 | #ifndef VOLUMECONTROL_H | 7 | #ifndef VOLUMECONTROL_H |
8 | #define VOLUMECONTROL_H | 8 | #define VOLUMECONTROL_H |
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | #include <qobject.h> | 12 | #include <qobject.h> |
13 | 13 | ||
14 | class VolumeControl : public QObject { | 14 | class VolumeControl : public QObject { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | VolumeControl(); | 17 | VolumeControl(); |
18 | ~VolumeControl(); | 18 | ~VolumeControl(); |
19 | 19 | ||
20 | // increase by "ammount" | 20 | // increase by "ammount" |
21 | void incVol( int ammount ); | 21 | void incVol( int ammount ); |
22 | void decVol( int ammount ); | 22 | void decVol( int ammount ); |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Get the volume in percent | 25 | * Get the volume in percent |
26 | * @return volume percentage | 26 | * @return volume percentage |
27 | */ | 27 | */ |
28 | int getVolume(); | 28 | int getVolume(); |
29 | 29 | ||
30 | public slots: | 30 | public slots: |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Set the volume in percent | 33 | * Set the volume in percent |
34 | * @value volumePerc between 0 and 100 | 34 | * @value volumePerc between 0 and 100 |
35 | */ | 35 | */ |
36 | void setVolume( int volumePerc ); | 36 | void setVolume( int volumePerc ); |
37 | 37 | ||
38 | void setMute(bool); | ||
38 | 39 | ||
39 | 40 | ||
40 | private: | 41 | private: |
41 | 42 | ||
42 | int m_volumePerc; | 43 | int m_volumePerc; |
43 | 44 | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | #endif | 47 | #endif |
47 | 48 | ||