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 | |||
@@ -22,4 +22,6 @@ | |||
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> |
@@ -40,5 +42,5 @@ SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | |||
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); |
@@ -50,11 +52,14 @@ SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
@@ -63,19 +68,20 @@ void SoundSettings::reject() | |||
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(); |
@@ -92,10 +98,10 @@ void SoundSettings::accept() | |||
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(); |
@@ -135,2 +141,26 @@ void SoundSettings::micChanged( bool ) | |||
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 | } | ||