Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 40b8b87..f417b79 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -35,6 +35,8 @@ | |||
35 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | 35 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) |
36 | : SoundSettingsBase( parent, name, TRUE, fl ) | 36 | : SoundSettingsBase( parent, name, TRUE, fl ) |
37 | { | 37 | { |
38 | keyReset=FALSE; | ||
39 | |||
38 | Config config( "qpe"); | 40 | Config config( "qpe"); |
39 | config.setGroup( "Volume" ); | 41 | config.setGroup( "Volume" ); |
40 | volume->setValue(100-config.readNumEntry("VolumePercent")); | 42 | volume->setValue(100-config.readNumEntry("VolumePercent")); |
@@ -61,12 +63,17 @@ SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | |||
61 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 63 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
62 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 64 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
63 | 65 | ||
66 | cfg.setGroup("Defaults"); | ||
67 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | ||
68 | |||
64 | updateStorageCombo(); | 69 | updateStorageCombo(); |
70 | |||
65 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 71 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
66 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 72 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
67 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 73 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
68 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 74 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
69 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | 75 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); |
76 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &))); | ||
70 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 77 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
71 | } | 78 | } |
72 | 79 | ||
@@ -157,6 +164,11 @@ void SoundSettings::micChanged( bool ) | |||
157 | 164 | ||
158 | void SoundSettings::updateStorageCombo() { | 165 | void SoundSettings::updateStorageCombo() { |
159 | 166 | ||
167 | Config config( "Vmemo" ); | ||
168 | config.setGroup( "System" ); | ||
169 | QString loc = config.readEntry("RecLocation","/"); | ||
170 | int i=0; | ||
171 | int set=0; | ||
160 | StorageInfo storageInfo; | 172 | StorageInfo storageInfo; |
161 | QString sName, sPath; | 173 | QString sName, sPath; |
162 | QStringList list; | 174 | QStringList list; |
@@ -167,16 +179,22 @@ void SoundSettings::updateStorageCombo() { | |||
167 | const QString path = (*it)->path(); | 179 | const QString path = (*it)->path(); |
168 | qDebug("storage name "+name +" storage path is "+path); | 180 | qDebug("storage name "+name +" storage path is "+path); |
169 | list << name + ": " +path; | 181 | list << name + ": " +path; |
182 | if( loc.find( path,0,TRUE) != -1) | ||
183 | set = i; | ||
170 | // if(dit.current()->file().find(path) != -1 ) storage=name; | 184 | // if(dit.current()->file().find(path) != -1 ) storage=name; |
185 | i++; | ||
171 | } | 186 | } |
172 | LocationComboBox->insertStringList(list); | 187 | LocationComboBox->insertStringList(list); |
188 | qDebug("set item %d", set); | ||
189 | LocationComboBox->setCurrentItem(set); | ||
173 | } | 190 | } |
174 | 191 | ||
175 | void SoundSettings::setLocation(const QString & string) { | 192 | void SoundSettings::setLocation(const QString & string) { |
176 | Config config( "Vmemo" ); | 193 | Config config( "Vmemo" ); |
177 | config.setGroup( "System" ); | 194 | config.setGroup( "System" ); |
178 | config.writeEntry("RecLocation",string); | 195 | config.writeEntry("RecLocation",string); |
179 | 196 | qDebug("set location "+string); | |
197 | config.write(); | ||
180 | } | 198 | } |
181 | 199 | ||
182 | void SoundSettings::cleanUp() { | 200 | void SoundSettings::cleanUp() { |
@@ -197,4 +215,19 @@ void SoundSettings::cleanUp() { | |||
197 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 215 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
198 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 216 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
199 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 217 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
218 | |||
219 | if(keyReset) QCopEnvelope ("QPE/System", "restart()"); | ||
220 | |||
221 | } | ||
222 | |||
223 | void SoundSettings::setKeyButton(const QString &name) { | ||
224 | Config cfg("Vmemo"); | ||
225 | cfg.setGroup("Defaults"); | ||
226 | cfg.writeEntry( "toggleKey", keyComboBox->currentItem() ); | ||
227 | keyReset = TRUE; | ||
228 | cfg.write(); | ||
229 | } | ||
230 | |||
231 | void SoundSettings::updateLocationCombo() { | ||
232 | |||
200 | } | 233 | } |