-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 | |||
@@ -309,48 +309,55 @@ void VolumeApplet::volumeChanged( bool 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"); |
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,63 +1,71 @@ | |||
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 ) |