Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 467f23e..51522b3 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -18,12 +18,14 @@ | |||
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 <qpe/storage.h> | ||
25 | |||
24 | #include <qapplication.h> | 26 | #include <qapplication.h> |
25 | #include <qslider.h> | 27 | #include <qslider.h> |
26 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
27 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
28 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
29 | 31 | ||
@@ -36,50 +38,54 @@ SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | |||
36 | volume->setValue(100-config.readNumEntry("Volume")); | 38 | volume->setValue(100-config.readNumEntry("Volume")); |
37 | mic->setValue(100-config.readNumEntry("Mic")); | 39 | mic->setValue(100-config.readNumEntry("Mic")); |
38 | touchsound->setChecked(config.readBoolEntry("Touch")); | 40 | touchsound->setChecked(config.readBoolEntry("Touch")); |
39 | keysound->setChecked(config.readBoolEntry("Key")); | 41 | keysound->setChecked(config.readBoolEntry("Key")); |
40 | 42 | ||
41 | config.setGroup("Record"); | 43 | config.setGroup("Record"); |
42 | int rate=config.readNumEntry("SampleRate", 11025); | 44 | int rate=config.readNumEntry("SampleRate", 22050); |
43 | if(rate == 11025) | 45 | if(rate == 11025) |
44 | sampleRate->setCurrentItem(0); | 46 | sampleRate->setCurrentItem(0); |
45 | else if(rate == 22050) | 47 | else if(rate == 22050) |
46 | sampleRate->setCurrentItem(1); | 48 | sampleRate->setCurrentItem(1); |
47 | else if(rate == 32000) | 49 | else if(rate == 32000) |
48 | sampleRate->setCurrentItem(2); | 50 | sampleRate->setCurrentItem(2); |
49 | else if(rate==44100) | 51 | else if(rate==44100) |
50 | sampleRate->setCurrentItem(2); | 52 | sampleRate->setCurrentItem(2); |
51 | 53 | ||
52 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 54 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
53 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 1)); | 55 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 1)); |
54 | 56 | ||
57 | updateStorageCombo(); | ||
55 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 58 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
56 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 59 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
57 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 60 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
58 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 61 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
62 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | ||
63 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | ||
59 | } | 64 | } |
60 | 65 | ||
61 | void SoundSettings::reject() | 66 | void SoundSettings::reject() |
62 | { | 67 | { |
63 | Config config( "Sound" ); | 68 | Config config( "Sound" ); |
64 | config.setGroup( "System" ); | 69 | config.setGroup( "System" ); |
65 | setVolume(100-config.readNumEntry("Volume")); | ||
66 | setMic(100-config.readNumEntry("Mic")); | ||
67 | 70 | ||
68 | config.setGroup("Record"); | 71 | setVolume(100-config.readNumEntry("Volume")); |
69 | int rate=config.readNumEntry("SampleRate", 11025); | 72 | setMic(100-config.readNumEntry("Mic")); |
70 | if(rate == 11025) | 73 | |
71 | sampleRate->setCurrentItem(0); | 74 | // config.setGroup("Record"); |
72 | else if(rate == 22050) | 75 | // int rate=config.readNumEntry("SampleRate", 11025); |
73 | sampleRate->setCurrentItem(1); | 76 | // if(rate == 11025) |
74 | else if(rate == 32000) | 77 | // sampleRate->setCurrentItem(0); |
75 | sampleRate->setCurrentItem(2); | 78 | // else if(rate == 22050) |
76 | else if(rate==44100) | 79 | // sampleRate->setCurrentItem(1); |
77 | sampleRate->setCurrentItem(3); | 80 | // else if(rate == 32000) |
78 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 81 | // sampleRate->setCurrentItem(2); |
79 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | 82 | // else if(rate==44100) |
83 | // sampleRate->setCurrentItem(3); | ||
84 | // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | ||
85 | // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | ||
80 | 86 | ||
81 | QDialog::reject(); | 87 | QDialog::reject(); |
82 | } | 88 | } |
83 | 89 | ||
84 | void SoundSettings::accept() | 90 | void SoundSettings::accept() |
85 | { | 91 | { |
@@ -88,18 +94,18 @@ void SoundSettings::accept() | |||
88 | config.writeEntry("Volume",100-volume->value()); | 94 | config.writeEntry("Volume",100-volume->value()); |
89 | config.writeEntry("Mic",100-mic->value()); | 95 | config.writeEntry("Mic",100-mic->value()); |
90 | config.writeEntry("Touch",touchsound->isChecked()); | 96 | config.writeEntry("Touch",touchsound->isChecked()); |
91 | config.writeEntry("Key",keysound->isChecked()); | 97 | config.writeEntry("Key",keysound->isChecked()); |
92 | 98 | ||
93 | setVolume(volume->value()); | 99 | setVolume(volume->value()); |
94 | setMic(mic->value()); | 100 | setMic(mic->value()); |
95 | 101 | ||
96 | config.setGroup("Record"); | 102 | config.setGroup("Record"); |
97 | config.writeEntry("SampleRate",sampleRate->currentText()); | 103 | config.writeEntry("SampleRate",sampleRate->currentText()); |
98 | config.writeEntry("Stereo",stereoCheckBox->isChecked()); | 104 | config.writeEntry("Stereo",stereoCheckBox->isChecked()); |
99 | config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 105 | config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
100 | 106 | ||
101 | QDialog::accept(); | 107 | QDialog::accept(); |
102 | } | 108 | } |
103 | 109 | ||
104 | void SoundSettings::setVolume(int v) | 110 | void SoundSettings::setVolume(int v) |
105 | { | 111 | { |
@@ -131,6 +137,30 @@ void SoundSettings::volumeChanged( bool ) | |||
131 | void SoundSettings::micChanged( bool ) | 137 | void SoundSettings::micChanged( bool ) |
132 | { | 138 | { |
133 | Config config( "Sound" ); | 139 | Config config( "Sound" ); |
134 | config.setGroup( "System" ); | 140 | config.setGroup( "System" ); |
135 | mic->setValue(100-config.readNumEntry("Mic")); | 141 | mic->setValue(100-config.readNumEntry("Mic")); |
136 | } | 142 | } |
143 | |||
144 | void SoundSettings::updateStorageCombo() { | ||
145 | |||
146 | StorageInfo storageInfo; | ||
147 | QString sName, sPath; | ||
148 | QStringList list; | ||
149 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
150 | QListIterator<FileSystem> it ( fs ); | ||
151 | for( ; it.current(); ++it ){ | ||
152 | const QString name = (*it)->name(); | ||
153 | const QString path = (*it)->path(); | ||
154 | qDebug("storage name "+name +" storage path is "+path); | ||
155 | list << name + ": " +path; | ||
156 | // if(dit.current()->file().find(path) != -1 ) storage=name; | ||
157 | } | ||
158 | LocationComboBox->insertStringList(list); | ||
159 | } | ||
160 | |||
161 | void SoundSettings::setLocation(const QString & string) { | ||
162 | Config config( "Sound" ); | ||
163 | config.setGroup( "System" ); | ||
164 | config.writeEntry("RecLocation",string); | ||
165 | |||
166 | } | ||