From c80f0885bf402b6dd4ea637ad1b7d8b3ebd69300 Mon Sep 17 00:00:00 2001 From: harlekin Date: Wed, 07 Aug 2002 19:30:13 +0000 Subject: added volume handling for audio gui and other small fixes --- (limited to 'noncore/multimedia/opieplayer2/volumecontrol.cpp') diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp new file mode 100644 index 0000000..b8ec0df --- a/dev/null +++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp @@ -0,0 +1,59 @@ + +#include +#include +#include "qpe/qcopenvelope_qws.h" +#include + +#include "volumecontrol.h" + +int VolumeControl::getVolume() { + int volumePerc; + Config cfg( "qpe" ); + cfg. setGroup( "Volume" ); + volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); + m_volumePerc = volumePerc; + return volumePerc; +} + + +void VolumeControl::setVolume( int volumePerc ) { + Config cfg("qpe"); + cfg.setGroup("Volume"); + + if ( volumePerc > 100 ) { + volumePerc = 100; + } + if ( volumePerc < 0 ) { + volumePerc = 0; + } + + m_volumePerc = volumePerc; + cfg.writeEntry("VolumePercent", volumePerc ); + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; +} + + +void VolumeControl::incVol( int ammount ) { + int oldVol = getVolume(); + setVolume( oldVol + ammount); +} + +void VolumeControl::decVol( int ammount ) { + int oldVol = getVolume(); + setVolume( oldVol - ammount); +} + + +VolumeControl::VolumeControl( ) { + getVolume(); +} + +VolumeControl::~VolumeControl() { + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; +} + + + + + + -- cgit v0.9.0.2