Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 20f0dab..dd341c0 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -29,25 +29,27 @@ | |||
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qslider.h> | 31 | #include <qslider.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qlabel.h> | ||
35 | 36 | ||
36 | #include <sys/utsname.h> | 37 | #include <sys/utsname.h> |
37 | #include <sys/time.h> | 38 | #include <sys/time.h> |
38 | #include <sys/types.h> | 39 | #include <sys/types.h> |
39 | #include <unistd.h> | 40 | #include <unistd.h> |
40 | #include <stdio.h> | 41 | #include <stdio.h> |
41 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
42 | 43 | ||
44 | |||
43 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
44 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 46 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
45 | { | 47 | { |
46 | keyReset=FALSE; | 48 | keyReset=FALSE; |
47 | 49 | noWarning=false; | |
48 | Config config( "qpe"); | 50 | Config config( "qpe"); |
49 | config.setGroup( "Volume" ); | 51 | config.setGroup( "Volume" ); |
50 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
51 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
52 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
53 | 55 | ||
@@ -61,15 +63,17 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | |||
61 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
62 | else if(rate == 33075) | 64 | else if(rate == 33075) |
63 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
64 | else if(rate==44100) | 66 | else if(rate==44100) |
65 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
66 | 68 | ||
67 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
70 | //TODO hide if zaurus- mono only | ||
68 | 71 | ||
69 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) //since ipaq and zaurus have particular | 72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
73 | //since ipaq and zaurus have particular | ||
70 | //devices | 74 | //devices |
71 | bool systemZaurus=FALSE; | 75 | bool systemZaurus=FALSE; |
72 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
73 | if (uname(&name) != -1) {// TODO change this here,... | 77 | if (uname(&name) != -1) {// TODO change this here,... |
74 | QString release=name.release; | 78 | QString release=name.release; |
75 | if( release.find("embedix",0,TRUE) != -1) { | 79 | if( release.find("embedix",0,TRUE) != -1) { |
@@ -103,15 +107,20 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | |||
103 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
104 | 108 | ||
105 | cfg.setGroup("Defaults"); | 109 | cfg.setGroup("Defaults"); |
106 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 110 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
107 | 111 | ||
108 | updateStorageCombo(); | 112 | updateStorageCombo(); |
109 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | 113 | connect( LocationComboBox,SIGNAL(activated(const QString &)), this, |
110 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT( setKeyButton(const QString &))); | 114 | SLOT( setLocation(const QString &))); |
111 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)),this,SLOT( setSizeLimitButton(const QString &))); | 115 | connect( keyComboBox,SIGNAL(activated( int)), this, |
116 | SLOT( setKeyButton( int))); | ||
117 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, | ||
118 | SLOT( setSizeLimitButton(const QString &))); | ||
119 | connect( restartCheckBox,SIGNAL( toggled( bool)), this, | ||
120 | SLOT( restartOpie( bool))); | ||
112 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 121 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
113 | } | 122 | } |
114 | 123 | ||
115 | void SoundSettings::updateStorageCombo() { | 124 | void SoundSettings::updateStorageCombo() { |
116 | 125 | ||
117 | Config config( "Vmemo" ); | 126 | Config config( "Vmemo" ); |
@@ -157,34 +166,30 @@ void SoundSettings::cleanUp() { | |||
157 | 166 | ||
158 | cfg.setGroup("Record"); | 167 | cfg.setGroup("Record"); |
159 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 168 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
160 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 169 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
161 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 170 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
162 | 171 | ||
163 | if(keyReset) { | 172 | if(keyReset && noWarning) { |
164 | switch ( QMessageBox::warning(this,tr("Restart"), | ||
165 | tr("To implement a new key switch\nOpie will have to be restarted./n<B>Restart</B> Opie now?"), | ||
166 | tr("Yes"),tr("No"),0,1,1) ) { | ||
167 | case 0: | ||
168 | QCopEnvelope ("QPE/System", "restart()"); | 173 | QCopEnvelope ("QPE/System", "restart()"); |
169 | break; | ||
170 | }; | ||
171 | } | 174 | } |
172 | } | 175 | } |
173 | 176 | ||
174 | void SoundSettings::setKeyButton(const QString &name) { | 177 | void SoundSettings::setKeyButton( int index) { |
175 | Config cfg("Vmemo"); | 178 | Config cfg("Vmemo"); |
176 | cfg.setGroup("Defaults"); | 179 | cfg.setGroup("Defaults"); |
177 | cfg.writeEntry( "toggleKey", keyComboBox->currentItem() ); | 180 | cfg.writeEntry( "toggleKey", index ); |
178 | keyReset = TRUE; | 181 | keyReset = TRUE; |
179 | if(keyComboBox->currentItem() == 1) | 182 | if( index == 1) { |
180 | cfg.writeEntry( "hideIcon", 0 ); | 183 | cfg.writeEntry( "hideIcon", 0 ); |
181 | else | 184 | keyLabel->setText(tr("Shows icon")); |
185 | } | ||
186 | else { | ||
182 | cfg.writeEntry( "hideIcon", 1); | 187 | cfg.writeEntry( "hideIcon", 1); |
183 | 188 | keyLabel->setText(tr("Hides icon")); | |
184 | 189 | } | |
185 | cfg.write(); | 190 | cfg.write(); |
186 | } | 191 | } |
187 | 192 | ||
188 | void SoundSettings::updateLocationCombo() { | 193 | void SoundSettings::updateLocationCombo() { |
189 | 194 | ||
190 | } | 195 | } |
@@ -196,6 +201,11 @@ void SoundSettings::setSizeLimitButton(const QString &index) { | |||
196 | if(index.find("Unlimited",0,TRUE) != -1) | 201 | if(index.find("Unlimited",0,TRUE) != -1) |
197 | cfg.writeEntry("SizeLimit", -1); | 202 | cfg.writeEntry("SizeLimit", -1); |
198 | else | 203 | else |
199 | cfg.writeEntry("SizeLimit", index); | 204 | cfg.writeEntry("SizeLimit", index); |
200 | cfg.write(); | 205 | cfg.write(); |
201 | } | 206 | } |
207 | |||
208 | void SoundSettings::restartOpie(bool b) { | ||
209 | noWarning=b; | ||
210 | } | ||
211 | |||