author | llornkcor <llornkcor> | 2002-06-16 18:56:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-16 18:56:32 (UTC) |
commit | b1d106338eca0c28573e2fc83c63c8ed3c76a239 (patch) (unidiff) | |
tree | fce10ba80c7cac1052e7226f62b750188b92f5eb | |
parent | 0a92e4f6ac0f3f288dbd0b83489366eb0760975a (diff) | |
download | opie-b1d106338eca0c28573e2fc83c63c8ed3c76a239.zip opie-b1d106338eca0c28573e2fc83c63c8ed3c76a239.tar.gz opie-b1d106338eca0c28573e2fc83c63c8ed3c76a239.tar.bz2 |
made mute config
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 7 | ||||
-rw-r--r-- | core/applets/volumeapplet/volumeappletimpl.cpp | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index 069f8ab..19e71c5 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -205,241 +205,248 @@ void VolumeControl::rateTimerDone() | |||
205 | else // downButton->isDown() | 205 | else // downButton->isDown() |
206 | slider->setValue( slider->value() + 2 ); | 206 | slider->setValue( slider->value() + 2 ); |
207 | } | 207 | } |
208 | 208 | ||
209 | //=========================================================================== | 209 | //=========================================================================== |
210 | 210 | ||
211 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 211 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
212 | : QWidget( parent, name ) | 212 | : QWidget( parent, name ) |
213 | { | 213 | { |
214 | Config cfg("qpe"); | 214 | Config cfg("qpe"); |
215 | cfg.setGroup("Volume"); | 215 | cfg.setGroup("Volume"); |
216 | 216 | ||
217 | setFixedHeight( 18 ); | 217 | setFixedHeight( 18 ); |
218 | setFixedWidth( 14 ); | 218 | setFixedWidth( 14 ); |
219 | 219 | ||
220 | volumePixmap = Resource::loadPixmap( "volume" ); | 220 | volumePixmap = Resource::loadPixmap( "volume" ); |
221 | 221 | ||
222 | volumePercent = cfg.readNumEntry("VolumePercent",50); | 222 | volumePercent = cfg.readNumEntry("VolumePercent",50); |
223 | micPercent = cfg.readNumEntry("Mic", 50); | 223 | micPercent = cfg.readNumEntry("Mic", 50); |
224 | muted = FALSE; // ### read from pref | 224 | muted = FALSE; // ### read from pref |
225 | micMuted = FALSE; // ### read from pref | 225 | micMuted = FALSE; // ### read from pref |
226 | 226 | ||
227 | advancedTimer = new QTimer(this); | 227 | advancedTimer = new QTimer(this); |
228 | 228 | ||
229 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 229 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
230 | connect( qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 230 | connect( qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
231 | connect( advancedTimer, SIGNAL( timeout() ),this, SLOT( advVolControl()) ); | 231 | connect( advancedTimer, SIGNAL( timeout() ),this, SLOT( advVolControl()) ); |
232 | 232 | ||
233 | writeSystemVolume(); | 233 | writeSystemVolume(); |
234 | writeSystemMic(); | 234 | writeSystemMic(); |
235 | } | 235 | } |
236 | 236 | ||
237 | VolumeApplet::~VolumeApplet() | 237 | VolumeApplet::~VolumeApplet() |
238 | { | 238 | { |
239 | } | 239 | } |
240 | 240 | ||
241 | void VolumeApplet::keyPressEvent ( QKeyEvent * e ) | 241 | void VolumeApplet::keyPressEvent ( QKeyEvent * e ) |
242 | { | 242 | { |
243 | QString s; | 243 | QString s; |
244 | s.setNum(e->key()); | 244 | s.setNum(e->key()); |
245 | qWarning(s); | 245 | qWarning(s); |
246 | } | 246 | } |
247 | void VolumeApplet::mousePressEvent( QMouseEvent * ) | 247 | void VolumeApplet::mousePressEvent( QMouseEvent * ) |
248 | { | 248 | { |
249 | advancedTimer->start( 750, TRUE ); | 249 | advancedTimer->start( 750, TRUE ); |
250 | } | 250 | } |
251 | 251 | ||
252 | void VolumeApplet::mouseReleaseEvent( QMouseEvent * ) | 252 | void VolumeApplet::mouseReleaseEvent( QMouseEvent * ) |
253 | { | 253 | { |
254 | showVolControl(FALSE); | 254 | showVolControl(FALSE); |
255 | } | 255 | } |
256 | 256 | ||
257 | void VolumeApplet::advVolControl() | 257 | void VolumeApplet::advVolControl() |
258 | { | 258 | { |
259 | showVolControl(TRUE); | 259 | showVolControl(TRUE); |
260 | } | 260 | } |
261 | 261 | ||
262 | void VolumeApplet::showVolControl(bool showMic) | 262 | void VolumeApplet::showVolControl(bool showMic) |
263 | { | 263 | { |
264 | Config cfg("qpe"); | 264 | Config cfg("qpe"); |
265 | cfg.setGroup("Volume"); | 265 | cfg.setGroup("Volume"); |
266 | volumePercent = cfg.readNumEntry("VolumePercent",50); | 266 | volumePercent = cfg.readNumEntry("VolumePercent",50); |
267 | micPercent = cfg.readNumEntry("Mic", 50); | 267 | micPercent = cfg.readNumEntry("Mic", 50); |
268 | 268 | ||
269 | // Create a small volume control window to adjust the volume with | 269 | // Create a small volume control window to adjust the volume with |
270 | VolumeControl *vc = new VolumeControl(showMic); | 270 | VolumeControl *vc = new VolumeControl(showMic); |
271 | vc->slider->setValue( 100 - volumePercent ); | 271 | vc->slider->setValue( 100 - volumePercent ); |
272 | // if (showMic) | 272 | // if (showMic) |
273 | // { | 273 | // { |
274 | vc->mic->setValue( 100 - micPercent ); | 274 | vc->mic->setValue( 100 - micPercent ); |
275 | connect( vc->mic, SIGNAL( valueChanged( int ) ), this, SLOT( micMoved( int ) ) ); | 275 | connect( vc->mic, SIGNAL( valueChanged( int ) ), this, SLOT( micMoved( int ) ) ); |
276 | // } | 276 | // } |
277 | 277 | ||
278 | vc->muteBox->setChecked( muted ); | 278 | vc->muteBox->setChecked( muted ); |
279 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); | 279 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); |
280 | connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) ); | 280 | connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) ); |
281 | 281 | ||
282 | Config config("qpe"); | 282 | Config config("qpe"); |
283 | config.setGroup("Volume"); | 283 | config.setGroup("Volume"); |
284 | 284 | ||
285 | vc->keyclicks->setChecked( config.readBoolEntry("KeySound",0)); | 285 | vc->keyclicks->setChecked( config.readBoolEntry("KeySound",0)); |
286 | vc->screentaps->setChecked( config.readBoolEntry("TouchSound",0)); | 286 | vc->screentaps->setChecked( config.readBoolEntry("TouchSound",0)); |
287 | vc->alarmSound->setChecked( config.readBoolEntry("AlarmSound",1)); | 287 | vc->alarmSound->setChecked( config.readBoolEntry("AlarmSound",1)); |
288 | 288 | ||
289 | connect( vc->alarmSound, SIGNAL(toggled(bool)), this, SLOT( alarmSoundCheckToggled(bool))); | 289 | connect( vc->alarmSound, SIGNAL(toggled(bool)), this, SLOT( alarmSoundCheckToggled(bool))); |
290 | connect( vc->keyclicks, SIGNAL(toggled(bool)), this, SLOT( keyclicksCheckToggled(bool))); | 290 | connect( vc->keyclicks, SIGNAL(toggled(bool)), this, SLOT( keyclicksCheckToggled(bool))); |
291 | connect( vc->screentaps, SIGNAL(toggled(bool)), this, SLOT( screentapsCheckToggled(bool))); | 291 | connect( vc->screentaps, SIGNAL(toggled(bool)), this, SLOT( screentapsCheckToggled(bool))); |
292 | 292 | ||
293 | QPoint curPos = mapToGlobal( rect().topLeft() ); | 293 | QPoint curPos = mapToGlobal( rect().topLeft() ); |
294 | vc->move( curPos.x()-(vc->sizeHint().width()/2+50), curPos.y() - 120 ); | 294 | vc->move( curPos.x()-(vc->sizeHint().width()/2+50), curPos.y() - 120 ); |
295 | vc->show(); | 295 | vc->show(); |
296 | 296 | ||
297 | advancedTimer->stop(); | 297 | advancedTimer->stop(); |
298 | } | 298 | } |
299 | 299 | ||
300 | void VolumeApplet::volumeChanged( bool nowMuted ) | 300 | void VolumeApplet::volumeChanged( bool nowMuted ) |
301 | { | 301 | { |
302 | int previousVolume = volumePercent; | 302 | int previousVolume = volumePercent; |
303 | 303 | ||
304 | if ( !nowMuted ) | 304 | if ( !nowMuted ) |
305 | readSystemVolume(); | 305 | readSystemVolume(); |
306 | 306 | ||
307 | // Handle case where muting it toggled | 307 | // Handle case where muting it toggled |
308 | if ( muted != nowMuted ) { | 308 | if ( muted != nowMuted ) { |
309 | muted = nowMuted; | 309 | muted = nowMuted; |
310 | repaint( TRUE ); | 310 | repaint( TRUE ); |
311 | return; | 311 | return; |
312 | } | 312 | } |
313 | 313 | ||
314 | // Avoid over repainting | 314 | // Avoid over repainting |
315 | if ( previousVolume != volumePercent ) | 315 | if ( previousVolume != volumePercent ) |
316 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); | 316 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); |
317 | } | 317 | } |
318 | 318 | ||
319 | void VolumeApplet::micChanged( bool nowMuted ) | 319 | void VolumeApplet::micChanged( bool nowMuted ) |
320 | { | 320 | { |
321 | if (!nowMuted) | 321 | if (!nowMuted) |
322 | readSystemMic(); | 322 | readSystemMic(); |
323 | micMuted = nowMuted; | 323 | micMuted = nowMuted; |
324 | } | 324 | } |
325 | 325 | ||
326 | void VolumeApplet::mute( bool toggled ) | 326 | void VolumeApplet::mute( bool toggled ) |
327 | { | 327 | { |
328 | muted = toggled; | 328 | muted = toggled; |
329 | 329 | ||
330 | // clear if removing mute | 330 | // clear if removing mute |
331 | repaint( !toggled ); | 331 | repaint( !toggled ); |
332 | writeSystemVolume(); | 332 | writeSystemVolume(); |
333 | Config cfg("qpe"); | ||
334 | cfg.setGroup("Volume"); | ||
335 | if(muted) | ||
336 | cfg.writeEntry("Mute", "TRUE"); | ||
337 | else | ||
338 | cfg.writeEntry("Mute", "FALSE"); | ||
339 | cfg.write(); | ||
333 | } | 340 | } |
334 | 341 | ||
335 | 342 | ||
336 | void VolumeApplet::sliderMoved( int percent ) | 343 | void VolumeApplet::sliderMoved( int percent ) |
337 | { | 344 | { |
338 | setVolume( 100 - percent ); | 345 | setVolume( 100 - percent ); |
339 | } | 346 | } |
340 | 347 | ||
341 | void VolumeApplet::micMoved( int percent ) | 348 | void VolumeApplet::micMoved( int percent ) |
342 | { | 349 | { |
343 | setMic( 100 - percent ); | 350 | setMic( 100 - percent ); |
344 | } | 351 | } |
345 | 352 | ||
346 | void VolumeApplet::readSystemVolume() | 353 | void VolumeApplet::readSystemVolume() |
347 | { | 354 | { |
348 | Config cfg("qpe"); | 355 | Config cfg("qpe"); |
349 | cfg.setGroup("Volume"); | 356 | cfg.setGroup("Volume"); |
350 | volumePercent = cfg.readNumEntry("VolumePercent"); | 357 | volumePercent = cfg.readNumEntry("VolumePercent"); |
351 | } | 358 | } |
352 | 359 | ||
353 | void VolumeApplet::readSystemMic() | 360 | void VolumeApplet::readSystemMic() |
354 | { | 361 | { |
355 | Config cfg("qpe"); | 362 | Config cfg("qpe"); |
356 | cfg.setGroup("Volume"); | 363 | cfg.setGroup("Volume"); |
357 | micPercent = cfg.readNumEntry("Mic"); | 364 | micPercent = cfg.readNumEntry("Mic"); |
358 | } | 365 | } |
359 | 366 | ||
360 | void VolumeApplet::setVolume( int percent ) | 367 | void VolumeApplet::setVolume( int percent ) |
361 | { | 368 | { |
362 | // clamp volume percent to be between 0 and 100 | 369 | // clamp volume percent to be between 0 and 100 |
363 | volumePercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); | 370 | volumePercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); |
364 | // repaint just the little volume rectangle | 371 | // repaint just the little volume rectangle |
365 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); | 372 | repaint( 2, height() - 3, width() - 4, 2, FALSE ); |
366 | writeSystemVolume(); | 373 | writeSystemVolume(); |
367 | } | 374 | } |
368 | 375 | ||
369 | void VolumeApplet::setMic( int percent ) | 376 | void VolumeApplet::setMic( int percent ) |
370 | { | 377 | { |
371 | // clamp volume percent to be between 0 and 100 | 378 | // clamp volume percent to be between 0 and 100 |
372 | micPercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); | 379 | micPercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); |
373 | writeSystemMic(); | 380 | writeSystemMic(); |
374 | } | 381 | } |
375 | 382 | ||
376 | void VolumeApplet::writeSystemVolume() | 383 | void VolumeApplet::writeSystemVolume() |
377 | { | 384 | { |
378 | { | 385 | { |
379 | Config cfg("qpe"); | 386 | Config cfg("qpe"); |
380 | cfg.setGroup("Volume"); | 387 | cfg.setGroup("Volume"); |
381 | cfg.writeEntry("VolumePercent",volumePercent); | 388 | cfg.writeEntry("VolumePercent",volumePercent); |
382 | } | 389 | } |
383 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 390 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
384 | // Send notification that the volume has changed | 391 | // Send notification that the volume has changed |
385 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 392 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
386 | #endif | 393 | #endif |
387 | } | 394 | } |
388 | 395 | ||
389 | void VolumeApplet::writeSystemMic() | 396 | void VolumeApplet::writeSystemMic() |
390 | { | 397 | { |
391 | { | 398 | { |
392 | Config cfg("qpe"); | 399 | Config cfg("qpe"); |
393 | cfg.setGroup("Volume"); | 400 | cfg.setGroup("Volume"); |
394 | cfg.writeEntry("Mic",micPercent); | 401 | cfg.writeEntry("Mic",micPercent); |
395 | } | 402 | } |
396 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 403 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
397 | // Send notification that the volume has changed | 404 | // Send notification that the volume has changed |
398 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << micMuted; | 405 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << micMuted; |
399 | #endif | 406 | #endif |
400 | } | 407 | } |
401 | 408 | ||
402 | void VolumeApplet::paintEvent( QPaintEvent* ) | 409 | void VolumeApplet::paintEvent( QPaintEvent* ) |
403 | { | 410 | { |
404 | QPainter p(this); | 411 | QPainter p(this); |
405 | 412 | ||
406 | if (volumePixmap.isNull()) | 413 | if (volumePixmap.isNull()) |
407 | volumePixmap = Resource::loadPixmap( "volume" ); | 414 | volumePixmap = Resource::loadPixmap( "volume" ); |
408 | p.drawPixmap( 0, 1, volumePixmap ); | 415 | p.drawPixmap( 0, 1, volumePixmap ); |
409 | p.setPen( darkGray ); | 416 | p.setPen( darkGray ); |
410 | p.drawRect( 1, height() - 4, width() - 2, 4 ); | 417 | p.drawRect( 1, height() - 4, width() - 2, 4 ); |
411 | 418 | ||
412 | int pixelsWide = volumePercent * (width() - 4) / 100; | 419 | int pixelsWide = volumePercent * (width() - 4) / 100; |
413 | p.fillRect( 2, height() - 3, pixelsWide, 2, red ); | 420 | p.fillRect( 2, height() - 3, pixelsWide, 2, red ); |
414 | p.fillRect( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 421 | p.fillRect( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
415 | 422 | ||
416 | if ( muted ) { | 423 | if ( muted ) { |
417 | p.setPen( red ); | 424 | p.setPen( red ); |
418 | p.drawLine( 1, 2, width() - 2, height() - 5 ); | 425 | p.drawLine( 1, 2, width() - 2, height() - 5 ); |
419 | p.drawLine( 1, 3, width() - 2, height() - 4 ); | 426 | p.drawLine( 1, 3, width() - 2, height() - 4 ); |
420 | p.drawLine( width() - 2, 2, 1, height() - 5 ); | 427 | p.drawLine( width() - 2, 2, 1, height() - 5 ); |
421 | p.drawLine( width() - 2, 3, 1, height() - 4 ); | 428 | p.drawLine( width() - 2, 3, 1, height() - 4 ); |
422 | } | 429 | } |
423 | } | 430 | } |
424 | 431 | ||
425 | void VolumeApplet::screentapsCheckToggled(bool b) { | 432 | void VolumeApplet::screentapsCheckToggled(bool b) { |
426 | Config cfg("qpe"); | 433 | Config cfg("qpe"); |
427 | cfg.setGroup("Volume"); | 434 | cfg.setGroup("Volume"); |
428 | cfg.writeEntry("TouchSound",b ); | 435 | cfg.writeEntry("TouchSound",b ); |
429 | cfg.write(); | 436 | cfg.write(); |
430 | } | 437 | } |
431 | 438 | ||
432 | void VolumeApplet::keyclicksCheckToggled(bool b) { | 439 | void VolumeApplet::keyclicksCheckToggled(bool b) { |
433 | Config cfg("qpe"); | 440 | Config cfg("qpe"); |
434 | cfg.setGroup("Volume"); | 441 | cfg.setGroup("Volume"); |
435 | cfg.writeEntry("KeySound",b); | 442 | cfg.writeEntry("KeySound",b); |
436 | cfg.write(); | 443 | cfg.write(); |
437 | } | 444 | } |
438 | 445 | ||
439 | void VolumeApplet::alarmSoundCheckToggled(bool b) { | 446 | void VolumeApplet::alarmSoundCheckToggled(bool b) { |
440 | Config cfg("qpe"); | 447 | Config cfg("qpe"); |
441 | cfg.setGroup("Volume"); | 448 | cfg.setGroup("Volume"); |
442 | cfg.writeEntry("AlarmSound",b); | 449 | cfg.writeEntry("AlarmSound",b); |
443 | cfg.write(); | 450 | cfg.write(); |
444 | } | 451 | } |
445 | 452 | ||
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp index fb2b79f..943e71a 100644 --- a/core/applets/volumeapplet/volumeappletimpl.cpp +++ b/core/applets/volumeapplet/volumeappletimpl.cpp | |||
@@ -1,66 +1,74 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "volume.h" | 20 | #include "volume.h" |
21 | #include "volumeappletimpl.h" | 21 | #include "volumeappletimpl.h" |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | 23 | #include <qpe/config.h> | |
24 | 24 | ||
25 | VolumeAppletImpl::VolumeAppletImpl() | 25 | VolumeAppletImpl::VolumeAppletImpl() |
26 | : volume(0), ref(0) | 26 | : volume(0), ref(0) |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | VolumeAppletImpl::~VolumeAppletImpl() | 30 | VolumeAppletImpl::~VolumeAppletImpl() |
31 | { | 31 | { |
32 | delete volume; | 32 | delete volume; |
33 | } | 33 | } |
34 | 34 | ||
35 | QWidget *VolumeAppletImpl::applet( QWidget *parent ) | 35 | QWidget *VolumeAppletImpl::applet( QWidget *parent ) |
36 | { | 36 | { |
37 | if ( !volume ) | 37 | if ( !volume ) |
38 | volume = new VolumeApplet( parent ); | 38 | volume = new VolumeApplet( parent ); |
39 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | 39 | |
40 | Config cfg("qpe"); | ||
41 | cfg.setGroup("Volume"); | ||
42 | QString foo = cfg.readEntry("Mute","TRUE"); | ||
43 | bool muted; | ||
44 | if(foo.find("TRUE",0,TRUE) != -1) | ||
45 | muted = TRUE; | ||
46 | else muted = FALSE; | ||
47 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; //mute | ||
40 | return volume; | 48 | return volume; |
41 | } | 49 | } |
42 | 50 | ||
43 | int VolumeAppletImpl::position() const | 51 | int VolumeAppletImpl::position() const |
44 | { | 52 | { |
45 | return 6; | 53 | return 6; |
46 | } | 54 | } |
47 | 55 | ||
48 | QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 56 | QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
49 | { | 57 | { |
50 | *iface = 0; | 58 | *iface = 0; |
51 | if ( uuid == IID_QUnknown ) | 59 | if ( uuid == IID_QUnknown ) |
52 | *iface = this; | 60 | *iface = this; |
53 | else if ( uuid == IID_TaskbarApplet ) | 61 | else if ( uuid == IID_TaskbarApplet ) |
54 | *iface = this; | 62 | *iface = this; |
55 | 63 | ||
56 | if ( *iface ) | 64 | if ( *iface ) |
57 | (*iface)->addRef(); | 65 | (*iface)->addRef(); |
58 | return QS_OK; | 66 | return QS_OK; |
59 | } | 67 | } |
60 | 68 | ||
61 | Q_EXPORT_INTERFACE() | 69 | Q_EXPORT_INTERFACE() |
62 | { | 70 | { |
63 | Q_CREATE_INSTANCE( VolumeAppletImpl ) | 71 | Q_CREATE_INSTANCE( VolumeAppletImpl ) |
64 | } | 72 | } |
65 | 73 | ||
66 | 74 | ||