Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

volumecontrol.cpp

Go to the documentation of this file.
00001 
00002 #include <qpe/config.h>
00003 #include "qpe/qcopenvelope_qws.h"
00004 
00005 #include "volumecontrol.h"
00006 
00007 int VolumeControl::volume() {
00008     Config cfg( "qpe" );
00009     cfg. setGroup( "Volume" );
00010     m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
00011     
00012     return m_volumePerc;
00013 }
00014 
00015 
00016 void VolumeControl::setVolume( int volumePerc ) {
00017      Config cfg("qpe");
00018     cfg.setGroup("Volume");
00019 
00020     if ( volumePerc > 100 ) {
00021         volumePerc = 100;
00022     }
00023     if ( volumePerc < 0 ) {
00024         volumePerc = 0;
00025     }
00026 
00027     m_volumePerc = volumePerc;
00028     cfg.writeEntry("VolumePercent", volumePerc );
00029     QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
00030 //    QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc;
00031 }
00032 
00033 
00034 void VolumeControl::incVol( int ammount ) {
00035     int oldVol = volume();
00036     setVolume( oldVol + ammount);
00037 }
00038 
00039 void VolumeControl::decVol( int ammount ) {
00040      int oldVol = volume();
00041     setVolume( oldVol - ammount);
00042 }
00043 
00044 
00045 VolumeControl::VolumeControl( ) {
00046     volume();
00047 }
00048 
00049 VolumeControl::~VolumeControl() {
00050     QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
00051 }
00052 
00053 void VolumeControl::setMute(bool on) {
00054    QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on;
00055 }
00056 
00057 
00058 
00059 

Generated on Sat Nov 5 16:17:33 2005 for OPIE by  doxygen 1.4.2