author | llornkcor <llornkcor> | 2002-04-07 00:46:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-07 00:46:35 (UTC) |
commit | e237c0758206c34f96c11870e033412b89e37463 (patch) (unidiff) | |
tree | ff61337aafa002a494a134cb61daaeda10aa0a44 | |
parent | 014a5c29fc8a1b2e6bc2ec550134163bea86443c (diff) | |
download | opie-e237c0758206c34f96c11870e033412b89e37463.zip opie-e237c0758206c34f96c11870e033412b89e37463.tar.gz opie-e237c0758206c34f96c11870e033412b89e37463.tar.bz2 |
re-commit buttons
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 296 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.h | 47 |
2 files changed, 246 insertions, 97 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index ee9eab3..344f86f 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
@@ -19,4 +19,5 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | |||
21 | #include "volume.h" | 22 | #include "volume.h" |
22 | 23 | ||
@@ -34,4 +35,6 @@ | |||
34 | #include <qframe.h> | 35 | #include <qframe.h> |
35 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
37 | #include <qlabel.h> | ||
38 | |||
36 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
37 | #include <qtimer.h> | 40 | #include <qtimer.h> |
@@ -41,10 +44,21 @@ | |||
41 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. | 44 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. |
42 | 45 | ||
43 | VolumeControl::VolumeControl( QWidget *parent, const char *name ) | 46 | VolumeControl::VolumeControl( bool showMic, QWidget *parent, const char *name ) |
44 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 47 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
45 | { | 48 | { |
46 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 49 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
50 | createView(showMic); | ||
51 | } | ||
52 | |||
53 | void VolumeControl::createView(bool showMic) | ||
54 | { | ||
55 | Config cfg("Sound"); | ||
56 | cfg.setGroup("System"); | ||
57 | //showMic = TRUE; | ||
58 | QHBoxLayout *hboxLayout = new QHBoxLayout(this); | ||
59 | hboxLayout->setMargin( 3 ); | ||
60 | hboxLayout->setSpacing( 0); | ||
47 | 61 | ||
48 | QVBoxLayout *vboxButtons = new QVBoxLayout; | 62 | QVBoxLayout *vboxButtons = new QVBoxLayout(this); |
49 | upButton = new QPushButton( this ); | 63 | upButton = new QPushButton( this ); |
50 | upButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 64 | upButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
@@ -54,8 +68,11 @@ VolumeControl::VolumeControl( QWidget *parent, const char *name ) | |||
54 | downButton->setPixmap( Resource::loadPixmap( "down" ) ); | 68 | downButton->setPixmap( Resource::loadPixmap( "down" ) ); |
55 | vboxButtons->setSpacing( 2 ); | 69 | vboxButtons->setSpacing( 2 ); |
70 | |||
56 | vboxButtons->addWidget( upButton ); | 71 | vboxButtons->addWidget( upButton ); |
57 | vboxButtons->addWidget( downButton ); | 72 | vboxButtons->addWidget( downButton ); |
58 | 73 | ||
59 | QHBoxLayout *hbox = new QHBoxLayout; | 74 | QVBoxLayout *vbox = new QVBoxLayout( this ); |
75 | QHBoxLayout *hbox = NULL; | ||
76 | |||
60 | slider = new QSlider( this ); | 77 | slider = new QSlider( this ); |
61 | slider->setRange( 0, 100 ); | 78 | slider->setRange( 0, 100 ); |
@@ -63,23 +80,50 @@ VolumeControl::VolumeControl( QWidget *parent, const char *name ) | |||
63 | slider->setTickInterval( 20 ); | 80 | slider->setTickInterval( 20 ); |
64 | slider->setFocusPolicy( QWidget::NoFocus ); | 81 | slider->setFocusPolicy( QWidget::NoFocus ); |
65 | hbox->setSpacing( 4 ); | 82 | slider->setValue(cfg.readNumEntry("Volume")); |
66 | hbox->addWidget( slider ); | ||
67 | hbox->addLayout( vboxButtons ); | ||
68 | 83 | ||
69 | QVBoxLayout *vbox = new QVBoxLayout( this ); | 84 | QVBoxLayout *sbox = new QVBoxLayout(this); |
70 | QFrame *separator = new QFrame( this ); | 85 | sbox->setMargin( 3 ); |
71 | separator->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 86 | sbox->setSpacing( 3 ); |
87 | sbox->addWidget( new QLabel("Vol", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter ); | ||
88 | sbox->addWidget( slider, 0, Qt::AlignVCenter | Qt::AlignHCenter ); | ||
89 | |||
90 | if (showMic == TRUE) { | ||
91 | mic = new QSlider(this); | ||
92 | mic->setRange( 0, 100 ); | ||
93 | mic->setTickmarks( QSlider::Both ); | ||
94 | mic->setTickInterval( 20 ); | ||
95 | mic->setFocusPolicy( QWidget::NoFocus ); | ||
96 | mic->setValue(cfg.readNumEntry("Mic")); | ||
97 | |||
98 | QVBoxLayout *mbox = new QVBoxLayout(this); | ||
99 | mbox->setMargin( 3 ); | ||
100 | mbox->setSpacing( 3 ); | ||
101 | mbox->addWidget( new QLabel("Mic", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter ); | ||
102 | mbox->addWidget( mic, 0, Qt::AlignVCenter | Qt::AlignHCenter ); | ||
103 | |||
104 | hbox = new QHBoxLayout( this ); | ||
105 | hbox->setMargin( 3 ); | ||
106 | hbox->setSpacing( 3 ); | ||
107 | hbox->addLayout( sbox, 1); | ||
108 | hbox->addLayout( mbox, 1); | ||
109 | } | ||
110 | |||
72 | muteBox = new QCheckBox( tr("Mute"), this ); | 111 | muteBox = new QCheckBox( tr("Mute"), this ); |
73 | muteBox->setFocusPolicy( QWidget::NoFocus ); | 112 | muteBox->setFocusPolicy( QWidget::NoFocus ); |
74 | vbox->setSpacing( 4 ); | 113 | |
75 | vbox->setMargin( 6 ); | 114 | vbox->setMargin( 3 ); |
76 | vbox->addLayout( hbox ); | 115 | vbox->setSpacing( 0 ); |
77 | vbox->addWidget( separator ); | 116 | if (showMic == TRUE) |
117 | vbox->addLayout( hbox, 1 ); | ||
118 | else | ||
119 | vbox->addLayout( sbox, 1); | ||
78 | vbox->addWidget( muteBox, 0, Qt::AlignVCenter | Qt::AlignHCenter ); | 120 | vbox->addWidget( muteBox, 0, Qt::AlignVCenter | Qt::AlignHCenter ); |
79 | 121 | ||
80 | setFixedHeight( 100 ); | 122 | hboxLayout->addLayout( vboxButtons ); |
123 | hboxLayout->addLayout(vbox); | ||
124 | |||
125 | setFixedHeight( 120 ); | ||
81 | setFixedWidth( sizeHint().width() ); | 126 | setFixedWidth( sizeHint().width() ); |
82 | setFocusPolicy(QWidget::NoFocus); | 127 | setFocusPolicy(QWidget::NoFocus); |
83 | |||
84 | connect( upButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); | 128 | connect( upButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); |
85 | connect( upButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); | 129 | connect( upButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); |
@@ -91,20 +135,21 @@ VolumeControl::VolumeControl( QWidget *parent, const char *name ) | |||
91 | } | 135 | } |
92 | 136 | ||
93 | void VolumeControl::keyPressEvent( QKeyEvent *e) | 137 | void VolumeControl::keyPressEvent( QKeyEvent *e) |
94 | { | 138 | { |
95 | switch(e->key()) { | 139 | switch(e->key()) |
96 | case Key_Up: | 140 | { |
97 | slider->subtractStep(); | 141 | case Key_Up: |
98 | break; | 142 | slider->subtractStep(); |
99 | case Key_Down: | 143 | break; |
100 | slider->addStep(); | 144 | case Key_Down: |
101 | break; | 145 | slider->addStep(); |
102 | case Key_Space: | 146 | break; |
103 | muteBox->toggle(); | 147 | case Key_Space: |
104 | break; | 148 | muteBox->toggle(); |
105 | case Key_Escape: | 149 | break; |
106 | close(); | 150 | case Key_Escape: |
107 | break; | 151 | close(); |
108 | } | 152 | break; |
153 | } | ||
109 | } | 154 | } |
110 | 155 | ||
@@ -135,11 +180,25 @@ VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | |||
135 | : QWidget( parent, name ) | 180 | : QWidget( parent, name ) |
136 | { | 181 | { |
137 | setFixedHeight( 18 ); | 182 | Config cfg("Sound"); |
138 | setFixedWidth( 14 ); | 183 | cfg.setGroup("System"); |
139 | volumePixmap = Resource::loadPixmap( "volume" ); | 184 | |
140 | muted = FALSE; // ### read from pref | 185 | setFixedHeight( 18 ); |
141 | volumePercent = 50; // ### read from pref | 186 | setFixedWidth( 14 ); |
142 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 187 | |
143 | writeSystemVolume(); | 188 | volumePixmap = Resource::loadPixmap( "volume" ); |
189 | |||
190 | volumePercent = cfg.readNumEntry("Volume",50); | ||
191 | micPercent = cfg.readNumEntry("Mic", 50); | ||
192 | muted = FALSE; // ### read from pref | ||
193 | micMuted = FALSE; // ### read from pref | ||
194 | |||
195 | advancedTimer = new QTimer(this); | ||
196 | |||
197 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | ||
198 | connect( qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | ||
199 | connect( advancedTimer, SIGNAL( timeout() ),this, SLOT( advVolControl()) ); | ||
200 | |||
201 | writeSystemVolume(); | ||
202 | writeSystemMic(); | ||
144 | } | 203 | } |
145 | 204 | ||
@@ -148,15 +207,49 @@ VolumeApplet::~VolumeApplet() | |||
148 | } | 207 | } |
149 | 208 | ||
150 | void VolumeApplet::mousePressEvent( QMouseEvent *) | 209 | void VolumeApplet::keyPressEvent ( QKeyEvent * e ) |
151 | { | 210 | { |
152 | // Create a small volume control window to adjust the volume with | 211 | QString s; |
153 | VolumeControl *vc = new VolumeControl; | 212 | s.setNum(e->key()); |
154 | vc->slider->setValue( 100 - volumePercent ); | 213 | qWarning(s); |
155 | vc->muteBox->setChecked( muted ); | 214 | } |
156 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); | 215 | void VolumeApplet::mousePressEvent( QMouseEvent * ) |
157 | connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) ); | 216 | { |
158 | QPoint curPos = mapToGlobal( rect().topLeft() ); | 217 | advancedTimer->start( 750, TRUE ); |
159 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 ); | 218 | } |
160 | vc->show(); | 219 | |
220 | void VolumeApplet::mouseReleaseEvent( QMouseEvent * ) | ||
221 | { | ||
222 | showVolControl(FALSE); | ||
223 | } | ||
224 | |||
225 | void VolumeApplet::advVolControl() | ||
226 | { | ||
227 | showVolControl(TRUE); | ||
228 | } | ||
229 | |||
230 | void VolumeApplet::showVolControl(bool showMic) | ||
231 | { | ||
232 | Config cfg("Sound"); | ||
233 | cfg.setGroup("System"); | ||
234 | volumePercent = cfg.readNumEntry("Volume",50); | ||
235 | micPercent = cfg.readNumEntry("Mic", 50); | ||
236 | |||
237 | // Create a small volume control window to adjust the volume with | ||
238 | VolumeControl *vc = new VolumeControl(showMic); | ||
239 | vc->slider->setValue( 100 - volumePercent ); | ||
240 | if (showMic) | ||
241 | { | ||
242 | vc->mic->setValue( 100 - micPercent ); | ||
243 | connect( vc->mic, SIGNAL( valueChanged( int ) ), this, SLOT( micMoved( int ) ) ); | ||
244 | } | ||
245 | |||
246 | vc->muteBox->setChecked( muted ); | ||
247 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); | ||
248 | connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) ); | ||
249 | QPoint curPos = mapToGlobal( rect().topLeft() ); | ||
250 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 120 ); | ||
251 | vc->show(); | ||
252 | |||
253 | advancedTimer->stop(); | ||
161 | } | 254 | } |
162 | 255 | ||
@@ -170,12 +263,19 @@ void VolumeApplet::volumeChanged( bool nowMuted ) | |||
170 | // Handle case where muting it toggled | 263 | // Handle case where muting it toggled |
171 | if ( muted != nowMuted ) { | 264 | if ( muted != nowMuted ) { |
172 | muted = nowMuted; | 265 | muted = nowMuted; |
173 | repaint( TRUE ); | 266 | repaint( TRUE ); |
174 | return; | 267 | return; |
175 | } | 268 | } |
176 | 269 | ||
177 | // Avoid over repainting | 270 | // Avoid over repainting |
178 | if ( previousVolume != volumePercent ) | 271 | if ( previousVolume != volumePercent ) |
179 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); | 272 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); |
273 | } | ||
274 | |||
275 | void VolumeApplet::micChanged( bool nowMuted ) | ||
276 | { | ||
277 | if (!nowMuted) | ||
278 | readSystemMic(); | ||
279 | micMuted = nowMuted; | ||
180 | } | 280 | } |
181 | 281 | ||
@@ -183,4 +283,5 @@ void VolumeApplet::mute( bool toggled ) | |||
183 | { | 283 | { |
184 | muted = toggled; | 284 | muted = toggled; |
285 | |||
185 | // clear if removing mute | 286 | // clear if removing mute |
186 | repaint( !toggled ); | 287 | repaint( !toggled ); |
@@ -188,4 +289,5 @@ void VolumeApplet::mute( bool toggled ) | |||
188 | } | 289 | } |
189 | 290 | ||
291 | |||
190 | void VolumeApplet::sliderMoved( int percent ) | 292 | void VolumeApplet::sliderMoved( int percent ) |
191 | { | 293 | { |
@@ -193,4 +295,9 @@ void VolumeApplet::sliderMoved( int percent ) | |||
193 | } | 295 | } |
194 | 296 | ||
297 | void VolumeApplet::micMoved( int percent ) | ||
298 | { | ||
299 | setMic( 100 - percent ); | ||
300 | } | ||
301 | |||
195 | void VolumeApplet::readSystemVolume() | 302 | void VolumeApplet::readSystemVolume() |
196 | { | 303 | { |
@@ -200,4 +307,11 @@ void VolumeApplet::readSystemVolume() | |||
200 | } | 307 | } |
201 | 308 | ||
309 | void VolumeApplet::readSystemMic() | ||
310 | { | ||
311 | Config cfg("Sound"); | ||
312 | cfg.setGroup("System"); | ||
313 | micPercent = cfg.readNumEntry("Mic"); | ||
314 | } | ||
315 | |||
202 | void VolumeApplet::setVolume( int percent ) | 316 | void VolumeApplet::setVolume( int percent ) |
203 | { | 317 | { |
@@ -209,37 +323,57 @@ void VolumeApplet::setVolume( int percent ) | |||
209 | } | 323 | } |
210 | 324 | ||
325 | void VolumeApplet::setMic( int percent ) | ||
326 | { | ||
327 | // clamp volume percent to be between 0 and 100 | ||
328 | micPercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); | ||
329 | writeSystemMic(); | ||
330 | } | ||
331 | |||
211 | void VolumeApplet::writeSystemVolume() | 332 | void VolumeApplet::writeSystemVolume() |
212 | { | 333 | { |
213 | { | 334 | { |
214 | Config cfg("Sound"); | 335 | Config cfg("Sound"); |
215 | cfg.setGroup("System"); | 336 | cfg.setGroup("System"); |
216 | cfg.writeEntry("Volume",volumePercent); | 337 | cfg.writeEntry("Volume",volumePercent); |
217 | } | 338 | } |
218 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 339 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
219 | // Send notification that the volume has changed | 340 | // Send notification that the volume has changed |
220 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 341 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
221 | #endif | 342 | #endif |
222 | } | 343 | } |
223 | 344 | ||
224 | void VolumeApplet::paintEvent( QPaintEvent* ) | 345 | void VolumeApplet::writeSystemMic() |
225 | { | 346 | { |
226 | QPainter p(this); | 347 | { |
227 | 348 | Config cfg("Sound"); | |
228 | if (volumePixmap.isNull()) | 349 | cfg.setGroup("System"); |
229 | volumePixmap = Resource::loadPixmap( "volume" ); | 350 | cfg.writeEntry("Mic",micPercent); |
230 | p.drawPixmap( 0, 1, volumePixmap ); | 351 | } |
231 | p.setPen( darkGray ); | 352 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
232 | p.drawRect( 1, height() - 4, width() - 2, 4 ); | 353 | // Send notification that the volume has changed |
233 | 354 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << micMuted; | |
234 | int pixelsWide = volumePercent * (width() - 4) / 100; | 355 | #endif |
235 | p.fillRect( 2, height() - 3, pixelsWide, 2, red ); | 356 | } |
236 | p.fillRect( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | ||
237 | 357 | ||
238 | if ( muted ) { | 358 | void VolumeApplet::paintEvent( QPaintEvent* ) |
239 | p.setPen( red ); | 359 | { |
240 | p.drawLine( 1, 2, width() - 2, height() - 5 ); | 360 | QPainter p(this); |
241 | p.drawLine( 1, 3, width() - 2, height() - 4 ); | 361 | |
242 | p.drawLine( width() - 2, 2, 1, height() - 5 ); | 362 | if (volumePixmap.isNull()) |
243 | p.drawLine( width() - 2, 3, 1, height() - 4 ); | 363 | volumePixmap = Resource::loadPixmap( "volume" ); |
244 | } | 364 | p.drawPixmap( 0, 1, volumePixmap ); |
365 | p.setPen( darkGray ); | ||
366 | p.drawRect( 1, height() - 4, width() - 2, 4 ); | ||
367 | |||
368 | int pixelsWide = volumePercent * (width() - 4) / 100; | ||
369 | p.fillRect( 2, height() - 3, pixelsWide, 2, red ); | ||
370 | p.fillRect( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | ||
371 | |||
372 | if ( muted ) { | ||
373 | p.setPen( red ); | ||
374 | p.drawLine( 1, 2, width() - 2, height() - 5 ); | ||
375 | p.drawLine( 1, 3, width() - 2, height() - 4 ); | ||
376 | p.drawLine( width() - 2, 2, 1, height() - 5 ); | ||
377 | p.drawLine( width() - 2, 3, 1, height() - 4 ); | ||
378 | } | ||
245 | } | 379 | } |
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h index a982f53..9fc12d8 100644 --- a/core/applets/volumeapplet/volume.h +++ b/core/applets/volumeapplet/volume.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
@@ -18,4 +18,5 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #ifndef __VOLUME_APPLET_H__ | 21 | #ifndef __VOLUME_APPLET_H__ |
21 | #define __VOLUME_APPLET_H__ | 22 | #define __VOLUME_APPLET_H__ |
@@ -26,9 +27,8 @@ | |||
26 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
27 | #include <qguardedptr.h> | 28 | #include <qguardedptr.h> |
29 | #include <qtimer.h> | ||
28 | 30 | ||
29 | class QSlider; | 31 | class QSlider; |
30 | class QCheckBox; | 32 | class QCheckBox; |
31 | class QPushButton; | ||
32 | class QTimer; | ||
33 | 33 | ||
34 | class VolumeControl : public QFrame | 34 | class VolumeControl : public QFrame |
@@ -36,21 +36,22 @@ class VolumeControl : public QFrame | |||
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | VolumeControl( QWidget *parent=0, const char *name=0 ); | 38 | VolumeControl( bool showMic=FALSE, QWidget *parent=0, const char *name=0 ); |
39 | 39 | ||
40 | public: | 40 | public: |
41 | QSlider *slider; | 41 | QSlider *slider; |
42 | QSlider *mic; | ||
42 | QCheckBox *muteBox; | 43 | QCheckBox *muteBox; |
43 | 44 | ||
44 | private: | 45 | private: |
46 | QPushButton *upButton; | ||
47 | QPushButton *downButton; | ||
48 | QTimer *rateTimer; | ||
49 | |||
45 | void keyPressEvent( QKeyEvent * ); | 50 | void keyPressEvent( QKeyEvent * ); |
46 | 51 | void createView(bool showMic = FALSE); | |
47 | private slots: | 52 | private slots: |
48 | void ButtonChanged(); | 53 | void ButtonChanged(); |
49 | void rateTimerDone(); | 54 | void rateTimerDone(); |
50 | 55 | ||
51 | private: | ||
52 | QPushButton *upButton; | ||
53 | QPushButton *downButton; | ||
54 | QTimer *rateTimer; | ||
55 | }; | 56 | }; |
56 | 57 | ||
@@ -66,9 +67,21 @@ public: | |||
66 | public slots: | 67 | public slots: |
67 | void volumeChanged( bool muted ); | 68 | void volumeChanged( bool muted ); |
68 | void setVolume( int percent ); | 69 | void micChanged( bool muted ); |
69 | void sliderMoved( int percent ); | 70 | void sliderMoved( int percent ); |
70 | void mute( bool ); | 71 | void mute( bool ); |
71 | 72 | ||
73 | void micMoved( int percent ); | ||
74 | void setVolume( int percent ); | ||
75 | void setMic( int percent ); | ||
76 | |||
77 | void showVolControl(bool showMic = FALSE); | ||
78 | void advVolControl(); | ||
79 | |||
72 | private: | 80 | private: |
81 | int volumePercent, micPercent; | ||
82 | bool muted, micMuted; | ||
83 | QPixmap volumePixmap; | ||
84 | QTimer *advancedTimer; | ||
85 | |||
73 | void readSystemVolume(); | 86 | void readSystemVolume(); |
74 | void writeSystemVolume(); | 87 | void writeSystemVolume(); |
@@ -76,10 +89,12 @@ private: | |||
76 | void paintEvent( QPaintEvent* ); | 89 | void paintEvent( QPaintEvent* ); |
77 | 90 | ||
78 | private: | 91 | void readSystemMic(); |
79 | int volumePercent; | 92 | void keyPressEvent ( QKeyEvent * e ); |
80 | bool muted; | 93 | void mouseReleaseEvent( QMouseEvent *); |
81 | QPixmap volumePixmap; | 94 | void writeSystemMic(); |
95 | |||
82 | }; | 96 | }; |
83 | 97 | ||
84 | 98 | ||
85 | #endif // __VOLUME_APPLET_H__ | 99 | #endif // __VOLUME_APPLET_H__ |
100 | |||