Diffstat (limited to 'core/applets/volumeapplet/volume.h') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/volumeapplet/volume.h | 124 |
1 files changed, 70 insertions, 54 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 | |||
@@ -19,90 +19,106 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef __VOLUME_APPLET_H__ | 21 | #ifndef __VOLUME_APPLET_H__ |
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 | { | 35 | |
36 | class VolumeControl : public QFrame { | ||
36 | Q_OBJECT | 37 | Q_OBJECT |
37 | public: | ||
38 | VolumeControl( bool showMic=FALSE, QWidget *parent=0, const char *name=0 ); | ||
39 | 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; | 41 | |
43 | QCheckBox *muteBox; | 42 | bool volMuted ( ) const; |
44 | QCheckBox *alarmSound; | 43 | int volPercent ( ) const; |
45 | QCheckBox *screentaps; | 44 | |
46 | QCheckBox *keyclicks; | 45 | virtual void show ( bool showmic ); |
46 | |||
47 | protected: | ||
48 | virtual void keyPressEvent ( QKeyEvent * e ); | ||
49 | |||
50 | protected slots: | ||
51 | void volumeChanged ( bool muted ); | ||
52 | void micChanged ( bool muted ); | ||
53 | |||
54 | private slots: | ||
55 | void volMoved ( int percent ); | ||
56 | void micMoved ( int percent ); | ||
57 | void alarmMoved ( int percent ); | ||
47 | 58 | ||
59 | void volMuteToggled ( bool ); | ||
60 | void micMuteToggled ( bool ); | ||
61 | void alarmSoundToggled ( bool ); | ||
62 | void keyClickToggled ( bool ); | ||
63 | void screenTapToggled ( bool ); | ||
64 | |||
65 | void buttonChanged ( ); | ||
66 | void rateTimerDone ( ); | ||
48 | 67 | ||
49 | private: | 68 | private: |
69 | void readConfig ( bool force = false ); | ||
70 | |||
71 | enum eUpdate { | ||
72 | UPD_None, | ||
73 | UPD_Vol, | ||
74 | UPD_Mic | ||
75 | }; | ||
76 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); | ||
77 | |||
78 | |||
79 | private: | ||
80 | QSlider *volSlider; | ||
81 | QSlider *micSlider; | ||
82 | QSlider *alarmSlider; | ||
83 | OLedBox *volLed; | ||
84 | OLedBox *micLed; | ||
85 | OLedBox *alarmLed; | ||
86 | |||
87 | QCheckBox *alarmBox; | ||
88 | QCheckBox *tapBox; | ||
89 | QCheckBox *keyBox; | ||
50 | QPushButton *upButton; | 90 | QPushButton *upButton; |
51 | QPushButton *downButton; | 91 | QPushButton *downButton; |
52 | QTimer *rateTimer; | 92 | QTimer *rateTimer; |
53 | 93 | ||
54 | void keyPressEvent( QKeyEvent * ); | 94 | int m_vol_percent; |
55 | void createView(bool showMic = FALSE); | 95 | int m_mic_percent; |
56 | private slots: | 96 | int m_alarm_percent; |
57 | void ButtonChanged(); | 97 | bool m_vol_muted; |
58 | void rateTimerDone(); | 98 | bool m_mic_muted; |
99 | bool m_snd_alarm; | ||
100 | bool m_snd_touch; | ||
101 | bool m_snd_key; | ||
59 | 102 | ||
103 | VolumeApplet *m_icon; | ||
60 | }; | 104 | }; |
61 | 105 | ||
62 | class VolumeApplet : public QWidget | 106 | class VolumeApplet : public QWidget { |
63 | { | ||
64 | Q_OBJECT | 107 | Q_OBJECT |
108 | |||
65 | public: | 109 | public: |
66 | VolumeApplet( QWidget *parent = 0, const char *name=0 ); | 110 | VolumeApplet( QWidget *parent = 0, const char *name=0 ); |
67 | ~VolumeApplet(); | 111 | ~VolumeApplet(); |
68 | bool isMute( ) { return muted; } | ||
69 | int percent( ) { return volumePercent; } | ||
70 | 112 | ||
71 | public slots: | 113 | protected: |
72 | void volumeChanged( bool muted ); | 114 | virtual void mousePressEvent ( QMouseEvent * ); |
73 | void micChanged( bool muted ); | 115 | virtual void paintEvent ( QPaintEvent* ); |
74 | void sliderMoved( int percent ); | ||
75 | void mute( bool ); | ||
76 | |||
77 | void micMoved( int percent ); | ||
78 | void setVolume( int percent ); | ||
79 | void setMic( int percent ); | ||
80 | |||
81 | void showVolControl(bool showMic = FALSE); | ||
82 | void advVolControl(); | ||
83 | 116 | ||
84 | private: | 117 | private: |
85 | int volumePercent, micPercent; | 118 | QPixmap * m_pixmap; |
86 | bool muted, micMuted; | 119 | VolumeControl *m_dialog; |
87 | QPixmap volumePixmap; | ||
88 | QTimer *advancedTimer; | ||
89 | |||
90 | void readSystemVolume(); | ||
91 | void writeSystemVolume(); | ||
92 | void mousePressEvent( QMouseEvent * ); | ||
93 | void paintEvent( QPaintEvent* ); | ||
94 | |||
95 | void readSystemMic(); | ||
96 | void keyPressEvent ( QKeyEvent * e ); | ||
97 | void mouseReleaseEvent( QMouseEvent *); | ||
98 | void writeSystemMic(); | ||
99 | |||
100 | protected slots: | ||
101 | void alarmSoundCheckToggled(bool); | ||
102 | void keyclicksCheckToggled(bool); | ||
103 | void screentapsCheckToggled(bool); | ||
104 | }; | 120 | }; |
105 | 121 | ||
106 | 122 | ||
107 | #endif // __VOLUME_APPLET_H__ | 123 | #endif // __VOLUME_APPLET_H__ |
108 | 124 | ||