summaryrefslogtreecommitdiff
path: root/noncore/settings/sound/soundsettings.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sound/soundsettings.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 17dbdc0..c2bf405 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -16,88 +16,103 @@
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 "soundsettings.h" 20#include "soundsettings.h"
21 21
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qslider.h> 25#include <qslider.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qcombobox.h>
29
28 30
29SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) 31SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl )
30 : SoundSettingsBase( parent, name, TRUE, fl ) 32 : SoundSettingsBase( parent, name, TRUE, fl )
31{ 33{
32 Config config( "Sound" ); 34 Config config( "Sound" );
33 config.setGroup( "System" ); 35 config.setGroup( "System" );
34 volume->setValue(100-config.readNumEntry("Volume")); 36 volume->setValue(100-config.readNumEntry("Volume"));
35 mic->setValue(100-config.readNumEntry("Mic")); 37 mic->setValue(100-config.readNumEntry("Mic"));
36 touchsound->setChecked(config.readBoolEntry("Touch")); 38 touchsound->setChecked(config.readBoolEntry("Touch"));
37 keysound->setChecked(config.readBoolEntry("Key")); 39 keysound->setChecked(config.readBoolEntry("Key"));
38 40
39 config.setGroup("Record"); 41 config.setGroup("Record");
40 sampleRate->setText(config.readEntry("SampleRate", "11025")); 42 int rate=config.readNumEntry("SampleRate", 11025);
41 stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); 43 if(rate == 11025)
42 sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); 44 sampleRate->setCurrentItem(0);
45 else if(rate == 22050)
46 sampleRate->setCurrentItem(1);
47 else if(rate==44100)
48 sampleRate->setCurrentItem(2);
49
50 stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0));
51 sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0));
43 52
44 connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); 53 connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
45 connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); 54 connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int)));
46 connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); 55 connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
47 connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); 56 connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) );
48} 57}
49 58
50void SoundSettings::reject() 59void SoundSettings::reject()
51{ 60{
52 Config config( "Sound" ); 61 Config config( "Sound" );
53 config.setGroup( "System" ); 62 config.setGroup( "System" );
54 setVolume(100-config.readNumEntry("Volume")); 63 setVolume(100-config.readNumEntry("Volume"));
55 setMic(100-config.readNumEntry("Mic")); 64 setMic(100-config.readNumEntry("Mic"));
56 65
57 config.setGroup("Record"); 66 config.setGroup("Record");
58 sampleRate->setText(config.readEntry("SampleRate", "11025")); 67 int rate=config.readNumEntry("SampleRate", 11025);
59 stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); 68 if(rate == 11025)
60 sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); 69 sampleRate->setCurrentItem(0);
70 else if(rate == 22050)
71 sampleRate->setCurrentItem(1);
72 else if(rate==44100)
73 sampleRate->setCurrentItem(2);
74 stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0));
75 sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0));
61 76
62 QDialog::reject(); 77 QDialog::reject();
63} 78}
64 79
65void SoundSettings::accept() 80void SoundSettings::accept()
66{ 81{
67 Config config( "Sound" ); 82 Config config( "Sound" );
68 config.setGroup( "System" ); 83 config.setGroup( "System" );
69 config.writeEntry("Volume",100-volume->value()); 84 config.writeEntry("Volume",100-volume->value());
70 config.writeEntry("Mic",100-mic->value()); 85 config.writeEntry("Mic",100-mic->value());
71 config.writeEntry("Touch",touchsound->isChecked()); 86 config.writeEntry("Touch",touchsound->isChecked());
72 config.writeEntry("Key",keysound->isChecked()); 87 config.writeEntry("Key",keysound->isChecked());
73 88
74 setVolume(volume->value()); 89 setVolume(volume->value());
75 setMic(mic->value()); 90 setMic(mic->value());
76 91
77 config.setGroup("Record"); 92 config.setGroup("Record");
78 config.writeEntry("SampleRate",sampleRate->text()); 93 config.writeEntry("SampleRate",sampleRate->currentText());
79 config.writeEntry("Stereo",stereoCheckBox->isChecked()); 94 config.writeEntry("Stereo",stereoCheckBox->isChecked());
80 config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); 95 config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
81 96
82 QDialog::accept(); 97 QDialog::accept();
83} 98}
84 99
85void SoundSettings::setVolume(int v) 100void SoundSettings::setVolume(int v)
86{ 101{
87 Config config( "Sound" ); 102 Config config( "Sound" );
88 config.setGroup( "System" ); 103 config.setGroup( "System" );
89 config.writeEntry("Volume",100-v); 104 config.writeEntry("Volume",100-v);
90#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 105#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
91 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; 106 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
92#endif 107#endif
93} 108}
94 109
95void SoundSettings::setMic(int m) 110void SoundSettings::setMic(int m)
96{ 111{
97 Config config( "Sound" ); 112 Config config( "Sound" );
98 config.setGroup( "System" ); 113 config.setGroup( "System" );
99 config.writeEntry("Mic",100-m); 114 config.writeEntry("Mic",100-m);
100#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 115#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
101 QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE; 116 QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE;
102#endif 117#endif
103} 118}