author | sandman <sandman> | 2002-06-24 20:06:38 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-24 20:06:38 (UTC) |
commit | 793a63d9cce0502616cad6999643b1a61836a3db (patch) (unidiff) | |
tree | 3ea020afd5a06236e5e889f3acae429d87171488 /core/applets/volumeapplet/volume.h | |
parent | fe4cb014e959518e4835d15593f2c392174af55b (diff) | |
download | opie-793a63d9cce0502616cad6999643b1a61836a3db.zip opie-793a63d9cce0502616cad6999643b1a61836a3db.tar.gz opie-793a63d9cce0502616cad6999643b1a61836a3db.tar.bz2 |
Started as a bug fix this is a near complete restructuring/rewrite:
- Added a alarm volume slider on iPAQs
- Made mic mutable
- Correctly inform the launcher about tap/key sounds
Diffstat (limited to 'core/applets/volumeapplet/volume.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/volumeapplet/volume.h | 140 |
1 files changed, 78 insertions, 62 deletions
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h index 6e631f2..ff5c64a 100644 --- a/core/applets/volumeapplet/volume.h +++ b/core/applets/volumeapplet/volume.h | |||
@@ -22,85 +22,101 @@ | |||
22 | #define __VOLUME_APPLET_H__ | 22 | #define __VOLUME_APPLET_H__ |
23 | 23 | ||
24 | 24 | ||
25 | #include <qwidget.h> | ||
26 | #include <qframe.h> | 25 | #include <qframe.h> |
27 | #include <qpixmap.h> | ||
28 | #include <qguardedptr.h> | ||
29 | #include <qtimer.h> | ||
30 | 26 | ||
27 | class QPixmap; | ||
28 | class QTimer; | ||
31 | class QSlider; | 29 | class QSlider; |
32 | class QCheckBox; | 30 | class QCheckBox; |
31 | class QButton; | ||
32 | class OLedBox; | ||
33 | 33 | ||
34 | class VolumeControl : public QFrame | 34 | class VolumeApplet; |
35 | { | ||
36 | Q_OBJECT | ||
37 | public: | ||
38 | VolumeControl( bool showMic=FALSE, QWidget *parent=0, const char *name=0 ); | ||
39 | 35 | ||
36 | class VolumeControl : public QFrame { | ||
37 | Q_OBJECT | ||
38 | |||
40 | public: | 39 | public: |
41 | QSlider *slider; | 40 | VolumeControl ( VolumeApplet *icon, bool showMic = false, QWidget *parent=0, const char *name=0 ); |
42 | QSlider *mic; | ||
43 | QCheckBox *muteBox; | ||
44 | QCheckBox *alarmSound; | ||
45 | QCheckBox *screentaps; | ||
46 | QCheckBox *keyclicks; | ||
47 | 41 | ||
42 | bool volMuted ( ) const; | ||
43 | int volPercent ( ) const; | ||
48 | 44 | ||
49 | private: | 45 | virtual void show ( bool showmic ); |
50 | QPushButton *upButton; | ||
51 | QPushButton *downButton; | ||
52 | QTimer *rateTimer; | ||
53 | |||
54 | void keyPressEvent( QKeyEvent * ); | ||
55 | void createView(bool showMic = FALSE); | ||
56 | private slots: | ||
57 | void ButtonChanged(); | ||
58 | void rateTimerDone(); | ||
59 | |||
60 | }; | ||
61 | 46 | ||
62 | class VolumeApplet : public QWidget | 47 | protected: |
63 | { | 48 | virtual void keyPressEvent ( QKeyEvent * e ); |
64 | Q_OBJECT | 49 | |
65 | public: | 50 | protected slots: |
66 | VolumeApplet( QWidget *parent = 0, const char *name=0 ); | 51 | void volumeChanged ( bool muted ); |
67 | ~VolumeApplet(); | 52 | void micChanged ( bool muted ); |
68 | bool isMute( ) { return muted; } | 53 | |
69 | int percent( ) { return volumePercent; } | 54 | private slots: |
70 | 55 | void volMoved ( int percent ); | |
71 | public slots: | 56 | void micMoved ( int percent ); |
72 | void volumeChanged( bool muted ); | 57 | void alarmMoved ( int percent ); |
73 | void micChanged( bool muted ); | 58 | |
74 | void sliderMoved( int percent ); | 59 | void volMuteToggled ( bool ); |
75 | void mute( bool ); | 60 | void micMuteToggled ( bool ); |
61 | void alarmSoundToggled ( bool ); | ||
62 | void keyClickToggled ( bool ); | ||
63 | void screenTapToggled ( bool ); | ||
64 | |||
65 | void buttonChanged ( ); | ||
66 | void rateTimerDone ( ); | ||
67 | |||
68 | private: | ||
69 | void readConfig ( bool force = false ); | ||
76 | 70 | ||
77 | void micMoved( int percent ); | 71 | enum eUpdate { |
78 | void setVolume( int percent ); | 72 | UPD_None, |
79 | void setMic( int percent ); | 73 | UPD_Vol, |
74 | UPD_Mic | ||
75 | }; | ||
76 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); | ||
80 | 77 | ||
81 | void showVolControl(bool showMic = FALSE); | ||
82 | void advVolControl(); | ||
83 | 78 | ||
84 | private: | 79 | private: |
85 | int volumePercent, micPercent; | 80 | QSlider *volSlider; |
86 | bool muted, micMuted; | 81 | QSlider *micSlider; |
87 | QPixmap volumePixmap; | 82 | QSlider *alarmSlider; |
88 | QTimer *advancedTimer; | 83 | OLedBox *volLed; |
84 | OLedBox *micLed; | ||
85 | OLedBox *alarmLed; | ||
86 | |||
87 | QCheckBox *alarmBox; | ||
88 | QCheckBox *tapBox; | ||
89 | QCheckBox *keyBox; | ||
90 | QPushButton *upButton; | ||
91 | QPushButton *downButton; | ||
92 | QTimer *rateTimer; | ||
93 | |||
94 | int m_vol_percent; | ||
95 | int m_mic_percent; | ||
96 | int m_alarm_percent; | ||
97 | bool m_vol_muted; | ||
98 | bool m_mic_muted; | ||
99 | bool m_snd_alarm; | ||
100 | bool m_snd_touch; | ||
101 | bool m_snd_key; | ||
102 | |||
103 | VolumeApplet *m_icon; | ||
104 | }; | ||
89 | 105 | ||
90 | void readSystemVolume(); | 106 | class VolumeApplet : public QWidget { |
91 | void writeSystemVolume(); | 107 | Q_OBJECT |
92 | void mousePressEvent( QMouseEvent * ); | ||
93 | void paintEvent( QPaintEvent* ); | ||
94 | 108 | ||
95 | void readSystemMic(); | 109 | public: |
96 | void keyPressEvent ( QKeyEvent * e ); | 110 | VolumeApplet ( QWidget *parent = 0, const char *name=0 ); |
97 | void mouseReleaseEvent( QMouseEvent *); | 111 | ~VolumeApplet ( ); |
98 | void writeSystemMic(); | ||
99 | 112 | ||
100 | protected slots: | 113 | protected: |
101 | void alarmSoundCheckToggled(bool); | 114 | virtual void mousePressEvent ( QMouseEvent * ); |
102 | void keyclicksCheckToggled(bool); | 115 | virtual void paintEvent ( QPaintEvent* ); |
103 | void screentapsCheckToggled(bool); | 116 | |
117 | private: | ||
118 | QPixmap * m_pixmap; | ||
119 | VolumeControl *m_dialog; | ||
104 | }; | 120 | }; |
105 | 121 | ||
106 | 122 | ||