author | llornkcor <llornkcor> | 2002-07-26 00:45:18 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-26 00:45:18 (UTC) |
commit | cf32a5b8d6886b357d0f4a6ecdc5b10f78a6a041 (patch) (unidiff) | |
tree | 1761b748606385d299063ce00fc2d32baea1189d | |
parent | f3556b164b79fc2a9607681bd6bdf2a4c8522d5e (diff) | |
download | opie-cf32a5b8d6886b357d0f4a6ecdc5b10f78a6a041.zip opie-cf32a5b8d6886b357d0f4a6ecdc5b10f78a6a041.tar.gz opie-cf32a5b8d6886b357d0f4a6ecdc5b10f78a6a041.tar.bz2 |
fix size limit config
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 99fccf7..010e0af 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,186 +1,188 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
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 | 20 | ||
21 | #include "soundsettings.h" | 21 | #include "soundsettings.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
27 | 27 | ||
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | #include <qslider.h> | 29 | #include <qslider.h> |
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | 33 | ||
34 | #include <sys/utsname.h> | 34 | #include <sys/utsname.h> |
35 | #include <sys/time.h> | 35 | #include <sys/time.h> |
36 | #include <sys/types.h> | 36 | #include <sys/types.h> |
37 | #include <unistd.h> | 37 | #include <unistd.h> |
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | #include <sys/stat.h> | 39 | #include <sys/stat.h> |
40 | 40 | ||
41 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 41 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
42 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 42 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
43 | { | 43 | { |
44 | keyReset=FALSE; | 44 | keyReset=FALSE; |
45 | 45 | ||
46 | Config config( "qpe"); | 46 | Config config( "qpe"); |
47 | config.setGroup( "Volume" ); | 47 | config.setGroup( "Volume" ); |
48 | Config cfg("Vmemo"); | 48 | Config cfg("Vmemo"); |
49 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 49 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
50 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 50 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
51 | 51 | ||
52 | cfg.setGroup("Record"); | 52 | cfg.setGroup("Record"); |
53 | int rate=config.readNumEntry("SampleRate", 22050); | 53 | int rate=config.readNumEntry("SampleRate", 22050); |
54 | if(rate == 8000) | 54 | if(rate == 8000) |
55 | sampleRate->setCurrentItem(0); | 55 | sampleRate->setCurrentItem(0); |
56 | else if(rate == 11025) | 56 | else if(rate == 11025) |
57 | sampleRate->setCurrentItem(1); | 57 | sampleRate->setCurrentItem(1); |
58 | else if(rate == 22050) | 58 | else if(rate == 22050) |
59 | sampleRate->setCurrentItem(2); | 59 | sampleRate->setCurrentItem(2); |
60 | else if(rate == 33075) | 60 | else if(rate == 33075) |
61 | sampleRate->setCurrentItem(3); | 61 | sampleRate->setCurrentItem(3); |
62 | else if(rate==44100) | 62 | else if(rate==44100) |
63 | sampleRate->setCurrentItem(4); | 63 | sampleRate->setCurrentItem(4); |
64 | 64 | ||
65 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only | 65 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only |
66 | 66 | ||
67 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) //since ipaq and zaurus have particular | 67 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) //since ipaq and zaurus have particular |
68 | //devices | 68 | //devices |
69 | bool systemZaurus=FALSE; | 69 | bool systemZaurus=FALSE; |
70 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 70 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
71 | if (uname(&name) != -1) {// TODO change this here,... | 71 | if (uname(&name) != -1) {// TODO change this here,... |
72 | QString release=name.release; | 72 | QString release=name.release; |
73 | if( release.find("embedix",0,TRUE) != -1) { | 73 | if( release.find("embedix",0,TRUE) != -1) { |
74 | qDebug("IS System Zaurus"); | 74 | qDebug("IS System Zaurus"); |
75 | systemZaurus=TRUE; | 75 | systemZaurus=TRUE; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | if(!systemZaurus) { | 78 | if(!systemZaurus) { |
79 | stereoCheckBox->setChecked(TRUE); | 79 | stereoCheckBox->setChecked(TRUE); |
80 | } | 80 | } |
81 | stereoCheckBox->setEnabled(FALSE); | 81 | stereoCheckBox->setEnabled(FALSE); |
82 | sixteenBitCheckBox->setEnabled(FALSE); | 82 | sixteenBitCheckBox->setEnabled(FALSE); |
83 | #else | 83 | #else |
84 | #endif | 84 | #endif |
85 | int sRate=cfg.readNumEntry("SizeLimit", 30); | 85 | int sRate=cfg.readNumEntry("SizeLimit", 30); |
86 | qDebug("%d",sRate); | 86 | qDebug("%d",sRate); |
87 | 87 | ||
88 | if(sRate ==30) | 88 | if(sRate ==30) |
89 | timeLimitComboBox->setCurrentItem(0); | 89 | timeLimitComboBox->setCurrentItem(0); |
90 | else if(sRate==20) | 90 | else if(sRate==20) |
91 | timeLimitComboBox->setCurrentItem(1); | 91 | timeLimitComboBox->setCurrentItem(1); |
92 | else if(sRate == 15) | 92 | else if(sRate == 15) |
93 | timeLimitComboBox->setCurrentItem(2); | 93 | timeLimitComboBox->setCurrentItem(2); |
94 | else if(sRate == 10) | 94 | else if(sRate == 10) |
95 | timeLimitComboBox->setCurrentItem(3); | 95 | timeLimitComboBox->setCurrentItem(3); |
96 | else | 96 | else if(sRate == 5) |
97 | timeLimitComboBox->setCurrentItem(4); | 97 | timeLimitComboBox->setCurrentItem(4); |
98 | else | ||
99 | timeLimitComboBox->setCurrentItem(5); | ||
98 | 100 | ||
99 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 101 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
100 | 102 | ||
101 | cfg.setGroup("Defaults"); | 103 | cfg.setGroup("Defaults"); |
102 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 104 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
103 | 105 | ||
104 | updateStorageCombo(); | 106 | updateStorageCombo(); |
105 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | 107 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); |
106 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT( setKeyButton(const QString &))); | 108 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT( setKeyButton(const QString &))); |
107 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)),this,SLOT( setSizeLimitButton(const QString &))); | 109 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)),this,SLOT( setSizeLimitButton(const QString &))); |
108 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 110 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
109 | } | 111 | } |
110 | void SoundSettings::updateStorageCombo() { | 112 | void SoundSettings::updateStorageCombo() { |
111 | 113 | ||
112 | Config config( "Vmemo" ); | 114 | Config config( "Vmemo" ); |
113 | config.setGroup( "System" ); | 115 | config.setGroup( "System" ); |
114 | QString loc = config.readEntry("RecLocation","/"); | 116 | QString loc = config.readEntry("RecLocation","/"); |
115 | int i=0; | 117 | int i=0; |
116 | int set=0; | 118 | int set=0; |
117 | StorageInfo storageInfo; | 119 | StorageInfo storageInfo; |
118 | QString sName, sPath; | 120 | QString sName, sPath; |
119 | QStringList list; | 121 | QStringList list; |
120 | list << "Documents : "+QPEApplication::documentDir(); | 122 | list << "Documents : "+QPEApplication::documentDir(); |
121 | list << "tmp : /tmp"; | 123 | list << "tmp : /tmp"; |
122 | 124 | ||
123 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 125 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
124 | QListIterator<FileSystem> it ( fs ); | 126 | QListIterator<FileSystem> it ( fs ); |
125 | for( ; it.current(); ++it ){ | 127 | for( ; it.current(); ++it ){ |
126 | const QString name = (*it)->name(); | 128 | const QString name = (*it)->name(); |
127 | const QString path = (*it)->path(); | 129 | const QString path = (*it)->path(); |
128 | qDebug("storage name "+name +" storage path is "+path); | 130 | qDebug("storage name "+name +" storage path is "+path); |
129 | list << name + ": " +path; | 131 | list << name + ": " +path; |
130 | if( loc.find( path,0,TRUE) != -1) | 132 | if( loc.find( path,0,TRUE) != -1) |
131 | set = i; | 133 | set = i; |
132 | // if(dit.current()->file().find(path) != -1 ) storage=name; | 134 | // if(dit.current()->file().find(path) != -1 ) storage=name; |
133 | i++; | 135 | i++; |
134 | } | 136 | } |
135 | 137 | ||
136 | LocationComboBox->insertStringList(list); | 138 | LocationComboBox->insertStringList(list); |
137 | qDebug("set item %d", set); | 139 | qDebug("set item %d", set); |
138 | LocationComboBox->setCurrentItem(set); | 140 | LocationComboBox->setCurrentItem(set); |
139 | } | 141 | } |
140 | 142 | ||
141 | void SoundSettings::setLocation(const QString & string) { | 143 | void SoundSettings::setLocation(const QString & string) { |
142 | Config config( "Vmemo" ); | 144 | Config config( "Vmemo" ); |
143 | config.setGroup( "System" ); | 145 | config.setGroup( "System" ); |
144 | config.writeEntry("RecLocation",string); | 146 | config.writeEntry("RecLocation",string); |
145 | qDebug("set location "+string); | 147 | qDebug("set location "+string); |
146 | config.write(); | 148 | config.write(); |
147 | } | 149 | } |
148 | 150 | ||
149 | void SoundSettings::cleanUp() { | 151 | void SoundSettings::cleanUp() { |
150 | Config cfg("Vmemo"); | 152 | Config cfg("Vmemo"); |
151 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 153 | cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
152 | 154 | ||
153 | cfg.setGroup("Record"); | 155 | cfg.setGroup("Record"); |
154 | cfg.writeEntry("SampleRate",sampleRate->currentText()); | 156 | cfg.writeEntry("SampleRate",sampleRate->currentText()); |
155 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 157 | cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
156 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 158 | cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
157 | 159 | ||
158 | if(keyReset) QCopEnvelope ("QPE/System", "restart()"); | 160 | if(keyReset) QCopEnvelope ("QPE/System", "restart()"); |
159 | 161 | ||
160 | } | 162 | } |
161 | 163 | ||
162 | void SoundSettings::setKeyButton(const QString &name) { | 164 | void SoundSettings::setKeyButton(const QString &name) { |
163 | Config cfg("Vmemo"); | 165 | Config cfg("Vmemo"); |
164 | cfg.setGroup("Defaults"); | 166 | cfg.setGroup("Defaults"); |
165 | cfg.writeEntry( "toggleKey", keyComboBox->currentItem() ); | 167 | cfg.writeEntry( "toggleKey", keyComboBox->currentItem() ); |
166 | keyReset = TRUE; | 168 | keyReset = TRUE; |
167 | if(keyComboBox->currentItem() == 1) | 169 | if(keyComboBox->currentItem() == 1) |
168 | cfg.writeEntry( "hideIcon", 0 ); | 170 | cfg.writeEntry( "hideIcon", 0 ); |
169 | else | 171 | else |
170 | cfg.writeEntry( "hideIcon", 1); | 172 | cfg.writeEntry( "hideIcon", 1); |
171 | 173 | ||
172 | 174 | ||
173 | cfg.write(); | 175 | cfg.write(); |
174 | } | 176 | } |
175 | 177 | ||
176 | void SoundSettings::updateLocationCombo() { | 178 | void SoundSettings::updateLocationCombo() { |
177 | 179 | ||
178 | } | 180 | } |
179 | 181 | ||
180 | void SoundSettings::setSizeLimitButton(const QString &index) { | 182 | void SoundSettings::setSizeLimitButton(const QString &index) { |
181 | 183 | ||
182 | Config cfg("Vmemo"); | 184 | Config cfg("Vmemo"); |
183 | cfg.setGroup("Record"); | 185 | cfg.setGroup("Record"); |
184 | cfg.writeEntry("SizeLimit", index); | 186 | cfg.writeEntry("SizeLimit", index); |
185 | cfg.write(); | 187 | cfg.write(); |
186 | } | 188 | } |