Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 21 |
1 files changed, 18 insertions, 3 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,75 +16,90 @@ | |||
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 | ||
29 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | 31 | SoundSettings::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); |
43 | if(rate == 11025) | ||
44 | sampleRate->setCurrentItem(0); | ||
45 | else if(rate == 22050) | ||
46 | sampleRate->setCurrentItem(1); | ||
47 | else if(rate==44100) | ||
48 | sampleRate->setCurrentItem(2); | ||
49 | |||
41 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 50 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
42 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 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 | ||
50 | void SoundSettings::reject() | 59 | void 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); |
68 | if(rate == 11025) | ||
69 | sampleRate->setCurrentItem(0); | ||
70 | else if(rate == 22050) | ||
71 | sampleRate->setCurrentItem(1); | ||
72 | else if(rate==44100) | ||
73 | sampleRate->setCurrentItem(2); | ||
59 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 74 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
60 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | 75 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); |
61 | 76 | ||
62 | QDialog::reject(); | 77 | QDialog::reject(); |
63 | } | 78 | } |
64 | 79 | ||
65 | void SoundSettings::accept() | 80 | void 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 | ||
85 | void SoundSettings::setVolume(int v) | 100 | void 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) |