Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 8ad0a3f..d55a751 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -8,46 +8,50 @@ | |||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
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 | // parts copyright 2002 L.J. Potter | 20 | // parts copyright 2002 L.J. Potter |
21 | 21 | ||
22 | #include "soundsettings.h" | 22 | #include "soundsettings.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/storage.h> | 29 | #include <qpe/storage.h> |
30 | using namespace Opie::Core; | ||
28 | 31 | ||
32 | /* QT */ | ||
29 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
30 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
31 | #include <qlabel.h> | 35 | #include <qlabel.h> |
32 | 36 | ||
37 | /* STD */ | ||
33 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
34 | #include <sys/time.h> | 39 | #include <sys/time.h> |
35 | #include <sys/types.h> | 40 | #include <sys/types.h> |
36 | #include <unistd.h> | 41 | #include <unistd.h> |
37 | #include <stdio.h> | ||
38 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
39 | 43 | ||
40 | 44 | ||
41 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
42 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 46 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
43 | { | 47 | { |
44 | keyReset=FALSE; | 48 | keyReset=FALSE; |
45 | noWarning=false; | 49 | noWarning=false; |
46 | Config config( "qpe"); | 50 | Config config( "qpe"); |
47 | config.setGroup( "Volume" ); | 51 | config.setGroup( "Volume" ); |
48 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
49 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
50 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
51 | 55 | ||
52 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
53 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
@@ -60,45 +64,45 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | |||
60 | else if(rate == 33075) | 64 | else if(rate == 33075) |
61 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
62 | else if(rate==44100) | 66 | else if(rate==44100) |
63 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
64 | 68 | ||
65 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
66 | //TODO hide if zaurus- mono only | 70 | //TODO hide if zaurus- mono only |
67 | 71 | ||
68 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
69 | //since ipaq and zaurus have particular | 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) { |
76 | qDebug("IS System Zaurus"); | 80 | odebug << "IS System Zaurus" << oendl; |
77 | systemZaurus=TRUE; | 81 | systemZaurus=TRUE; |
78 | } | 82 | } |
79 | } | 83 | } |
80 | if(!systemZaurus) { | 84 | if(!systemZaurus) { |
81 | stereoCheckBox->setChecked(TRUE); | 85 | stereoCheckBox->setChecked(TRUE); |
82 | } | 86 | } |
83 | stereoCheckBox->setEnabled(FALSE); | 87 | stereoCheckBox->setEnabled(FALSE); |
84 | sixteenBitCheckBox->setEnabled(FALSE); | 88 | sixteenBitCheckBox->setEnabled(FALSE); |
85 | #else | 89 | #else |
86 | #endif | 90 | #endif |
87 | int sRate=cfg.readNumEntry("SizeLimit", 30); | 91 | int sRate=cfg.readNumEntry("SizeLimit", 30); |
88 | qDebug("%d",sRate); | 92 | odebug << "" << sRate << "" << oendl; |
89 | 93 | ||
90 | if(sRate ==30) | 94 | if(sRate ==30) |
91 | timeLimitComboBox->setCurrentItem(0); | 95 | timeLimitComboBox->setCurrentItem(0); |
92 | else if(sRate==20) | 96 | else if(sRate==20) |
93 | timeLimitComboBox->setCurrentItem(1); | 97 | timeLimitComboBox->setCurrentItem(1); |
94 | else if(sRate == 15) | 98 | else if(sRate == 15) |
95 | timeLimitComboBox->setCurrentItem(2); | 99 | timeLimitComboBox->setCurrentItem(2); |
96 | else if(sRate == 10) | 100 | else if(sRate == 10) |
97 | timeLimitComboBox->setCurrentItem(3); | 101 | timeLimitComboBox->setCurrentItem(3); |
98 | else if(sRate == 5) | 102 | else if(sRate == 5) |
99 | timeLimitComboBox->setCurrentItem(4); | 103 | timeLimitComboBox->setCurrentItem(4); |
100 | else | 104 | else |
101 | timeLimitComboBox->setCurrentItem(5); | 105 | timeLimitComboBox->setCurrentItem(5); |
102 | 106 | ||
103 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
104 | 108 | ||
@@ -130,50 +134,50 @@ void SoundSettings::updateStorageCombo() { | |||
130 | Config config( "Vmemo" ); | 134 | Config config( "Vmemo" ); |
131 | config.setGroup( "System" ); | 135 | config.setGroup( "System" ); |
132 | QString loc = config.readEntry("RecLocation","/"); | 136 | QString loc = config.readEntry("RecLocation","/"); |
133 | int i=0; | 137 | int i=0; |
134 | int set=0; | 138 | int set=0; |
135 | StorageInfo storageInfo; | 139 | StorageInfo storageInfo; |
136 | QString sName, sPath; | 140 | QString sName, sPath; |
137 | QStringList list; | 141 | QStringList list; |
138 | list << "Documents : "+QPEApplication::documentDir(); | 142 | list << "Documents : "+QPEApplication::documentDir(); |
139 | list << "tmp : /tmp"; | 143 | list << "tmp : /tmp"; |
140 | 144 | ||
141 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 145 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
142 | QListIterator<FileSystem> it ( fs ); | 146 | QListIterator<FileSystem> it ( fs ); |
143 | for( ; it.current(); ++it ){ | 147 | for( ; it.current(); ++it ){ |
144 | const QString name = (*it)->name(); | 148 | const QString name = (*it)->name(); |
145 | const QString path = (*it)->path(); | 149 | const QString path = (*it)->path(); |
146 | qDebug("storage name "+name +" storage path is "+path); | 150 | odebug << "storage name "+name +" storage path is "+path << oendl; |
147 | list << name + ": " +path; | 151 | list << name + ": " +path; |
148 | if( loc.find( path,0,TRUE) != -1) | 152 | if( loc.find( path,0,TRUE) != -1) |
149 | set = i; | 153 | set = i; |
150 | // if(dit.current()->file().find(path) != -1 ) storage=name; | 154 | // if(dit.current()->file().find(path) != -1 ) storage=name; |
151 | i++; | 155 | i++; |
152 | } | 156 | } |
153 | 157 | ||
154 | LocationComboBox->insertStringList(list); | 158 | LocationComboBox->insertStringList(list); |
155 | qDebug("set item %d", set); | 159 | odebug << "set item " << set << "" << oendl; |
156 | LocationComboBox->setCurrentItem(set); | 160 | LocationComboBox->setCurrentItem(set); |
157 | } | 161 | } |
158 | 162 | ||
159 | void SoundSettings::setLocation(const QString & string) { | 163 | void SoundSettings::setLocation(const QString & string) { |
160 | Config config( "Vmemo" ); | 164 | Config config( "Vmemo" ); |
161 | config.setGroup( "System" ); | 165 | config.setGroup( "System" ); |
162 | config.writeEntry("RecLocation",string); | 166 | config.writeEntry("RecLocation",string); |
163 | qDebug("set location "+string); | 167 | odebug << "set location "+string << oendl; |
164 | config.write(); | 168 | config.write(); |
165 | } | 169 | } |
166 | 170 | ||
167 | void SoundSettings::cleanUp() { | 171 | void SoundSettings::cleanUp() { |
168 | Config cfg("Vmemo"); | 172 | Config cfg("Vmemo"); |
169 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 173 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
170 | 174 | ||
171 | cfg.setGroup("Record"); | 175 | cfg.setGroup("Record"); |
172 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 176 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
173 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 177 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
174 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 178 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
175 | if(keyReset && noWarning) { | 179 | if(keyReset && noWarning) { |
176 | QCopEnvelope ("QPE/System", "restart()"); | 180 | QCopEnvelope ("QPE/System", "restart()"); |
177 | } | 181 | } |
178 | } | 182 | } |
179 | 183 | ||