summaryrefslogtreecommitdiff
path: root/noncore/settings/sound/soundsettings.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sound/soundsettings.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 4bc86fa..8ad0a3f 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -18,202 +18,202 @@
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#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qpe/storage.h> 27#include <qpe/storage.h>
28 28
29#include <qcheckbox.h> 29#include <qcheckbox.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qlabel.h> 31#include <qlabel.h>
32 32
33#include <sys/utsname.h> 33#include <sys/utsname.h>
34#include <sys/time.h> 34#include <sys/time.h>
35#include <sys/types.h> 35#include <sys/types.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <stdio.h> 37#include <stdio.h>
38#include <sys/stat.h> 38#include <sys/stat.h>
39 39
40 40
41SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) 41SoundSettings::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 noWarning=false; 45 noWarning=false;
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)); 65 stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
66//TODO hide if zaurus- mono only 66//TODO hide if zaurus- mono only
67 67
68#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 68#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
69//since ipaq and zaurus have particular 69//since ipaq and zaurus have particular
70//devices 70//devices
71 bool systemZaurus=FALSE; 71 bool systemZaurus=FALSE;
72 struct utsname name; /* check for embedix kernel running on the zaurus*/ 72 struct utsname name; /* check for embedix kernel running on the zaurus*/
73 if (uname(&name) != -1) {// TODO change this here,... 73 if (uname(&name) != -1) {// TODO change this here,...
74 QString release=name.release; 74 QString release=name.release;
75 if( release.find("embedix",0,TRUE) != -1) { 75 if( release.find("embedix",0,TRUE) != -1) {
76 qDebug("IS System Zaurus"); 76 qDebug("IS System Zaurus");
77 systemZaurus=TRUE; 77 systemZaurus=TRUE;
78 } 78 }
79 } 79 }
80 if(!systemZaurus) { 80 if(!systemZaurus) {
81 stereoCheckBox->setChecked(TRUE); 81 stereoCheckBox->setChecked(TRUE);
82 } 82 }
83 stereoCheckBox->setEnabled(FALSE); 83 stereoCheckBox->setEnabled(FALSE);
84 sixteenBitCheckBox->setEnabled(FALSE); 84 sixteenBitCheckBox->setEnabled(FALSE);
85#else 85#else
86#endif 86#endif
87 int sRate=cfg.readNumEntry("SizeLimit", 30); 87 int sRate=cfg.readNumEntry("SizeLimit", 30);
88 qDebug("%d",sRate); 88 qDebug("%d",sRate);
89 89
90 if(sRate ==30) 90 if(sRate ==30)
91 timeLimitComboBox->setCurrentItem(0); 91 timeLimitComboBox->setCurrentItem(0);
92 else if(sRate==20) 92 else if(sRate==20)
93 timeLimitComboBox->setCurrentItem(1); 93 timeLimitComboBox->setCurrentItem(1);
94 else if(sRate == 15) 94 else if(sRate == 15)
95 timeLimitComboBox->setCurrentItem(2); 95 timeLimitComboBox->setCurrentItem(2);
96 else if(sRate == 10) 96 else if(sRate == 10)
97 timeLimitComboBox->setCurrentItem(3); 97 timeLimitComboBox->setCurrentItem(3);
98 else if(sRate == 5) 98 else if(sRate == 5)
99 timeLimitComboBox->setCurrentItem(4); 99 timeLimitComboBox->setCurrentItem(4);
100 else 100 else
101 timeLimitComboBox->setCurrentItem(5); 101 timeLimitComboBox->setCurrentItem(5);
102 102
103 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); 103 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
104 104
105 cfg.setGroup("Defaults"); 105 cfg.setGroup("Defaults");
106 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); 106 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
107 107
108 updateStorageCombo(); 108 updateStorageCombo();
109 109
110 Config vmCfg("Vmemo"); 110 Config vmCfg("Vmemo");
111 vmCfg.setGroup("Defaults"); 111 vmCfg.setGroup("Defaults");
112 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); 112 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0));
113 113
114 connect( LocationComboBox,SIGNAL(activated(const QString &)), this, 114 connect( LocationComboBox,SIGNAL(activated(const QString&)), this,
115 SLOT( setLocation(const QString &))); 115 SLOT( setLocation(const QString&)));
116 connect( keyComboBox,SIGNAL(activated( int)), this, 116 connect( keyComboBox,SIGNAL(activated(int)), this,
117 SLOT( setKeyButton( int))); 117 SLOT( setKeyButton(int)));
118 connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, 118 connect( timeLimitComboBox,SIGNAL(activated(const QString&)), this,
119 SLOT( setSizeLimitButton(const QString &))); 119 SLOT( setSizeLimitButton(const QString&)));
120 connect( restartCheckBox,SIGNAL( toggled( bool)), this, 120 connect( restartCheckBox,SIGNAL( toggled(bool)), this,
121 SLOT( restartOpie( bool))); 121 SLOT( restartOpie(bool)));
122 connect( adpcmCheckBox,SIGNAL( toggled( bool)), this, 122 connect( adpcmCheckBox,SIGNAL( toggled(bool)), this,
123 SLOT( slotAdpcm( bool))); 123 SLOT( slotAdpcm(bool)));
124 124
125 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 125 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
126} 126}
127 127
128void SoundSettings::updateStorageCombo() { 128void SoundSettings::updateStorageCombo() {
129 129
130 Config config( "Vmemo" ); 130 Config config( "Vmemo" );
131 config.setGroup( "System" ); 131 config.setGroup( "System" );
132 QString loc = config.readEntry("RecLocation","/"); 132 QString loc = config.readEntry("RecLocation","/");
133 int i=0; 133 int i=0;
134 int set=0; 134 int set=0;
135 StorageInfo storageInfo; 135 StorageInfo storageInfo;
136 QString sName, sPath; 136 QString sName, sPath;
137 QStringList list; 137 QStringList list;
138 list << "Documents : "+QPEApplication::documentDir(); 138 list << "Documents : "+QPEApplication::documentDir();
139 list << "tmp : /tmp"; 139 list << "tmp : /tmp";
140 140
141 const QList<FileSystem> &fs = storageInfo.fileSystems(); 141 const QList<FileSystem> &fs = storageInfo.fileSystems();
142 QListIterator<FileSystem> it ( fs ); 142 QListIterator<FileSystem> it ( fs );
143 for( ; it.current(); ++it ){ 143 for( ; it.current(); ++it ){
144 const QString name = (*it)->name(); 144 const QString name = (*it)->name();
145 const QString path = (*it)->path(); 145 const QString path = (*it)->path();
146 qDebug("storage name "+name +" storage path is "+path); 146 qDebug("storage name "+name +" storage path is "+path);
147 list << name + ": " +path; 147 list << name + ": " +path;
148 if( loc.find( path,0,TRUE) != -1) 148 if( loc.find( path,0,TRUE) != -1)
149 set = i; 149 set = i;
150// if(dit.current()->file().find(path) != -1 ) storage=name; 150// if(dit.current()->file().find(path) != -1 ) storage=name;
151 i++; 151 i++;
152 } 152 }
153 153
154 LocationComboBox->insertStringList(list); 154 LocationComboBox->insertStringList(list);
155 qDebug("set item %d", set); 155 qDebug("set item %d", set);
156 LocationComboBox->setCurrentItem(set); 156 LocationComboBox->setCurrentItem(set);
157} 157}
158 158
159void SoundSettings::setLocation(const QString & string) { 159void SoundSettings::setLocation(const QString & string) {
160 Config config( "Vmemo" ); 160 Config config( "Vmemo" );
161 config.setGroup( "System" ); 161 config.setGroup( "System" );
162 config.writeEntry("RecLocation",string); 162 config.writeEntry("RecLocation",string);
163 qDebug("set location "+string); 163 qDebug("set location "+string);
164 config.write(); 164 config.write();
165} 165}
166 166
167void SoundSettings::cleanUp() { 167void SoundSettings::cleanUp() {
168 Config cfg("Vmemo"); 168 Config cfg("Vmemo");
169 cfg.writeEntry("Alert",AlertCheckBox->isChecked()); 169 cfg.writeEntry("Alert",AlertCheckBox->isChecked());
170 170
171 cfg.setGroup("Record"); 171 cfg.setGroup("Record");
172 cfg.writeEntry("SampleRate",sampleRate->currentText()); 172 cfg.writeEntry("SampleRate",sampleRate->currentText());
173 cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); 173 cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
174 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); 174 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
175 if(keyReset && noWarning) { 175 if(keyReset && noWarning) {
176 QCopEnvelope ("QPE/System", "restart()"); 176 QCopEnvelope ("QPE/System", "restart()");
177 } 177 }
178} 178}
179 179
180void SoundSettings::setKeyButton( int index) { 180void SoundSettings::setKeyButton( int index) {
181 Config cfg("Vmemo"); 181 Config cfg("Vmemo");
182 cfg.setGroup("Defaults"); 182 cfg.setGroup("Defaults");
183 cfg.writeEntry( "toggleKey", index ); 183 cfg.writeEntry( "toggleKey", index );
184 keyReset = TRUE; 184 keyReset = TRUE;
185 if( index == 1) { 185 if( index == 1) {
186 cfg.writeEntry( "hideIcon", 0 ); 186 cfg.writeEntry( "hideIcon", 0 );
187 keyLabel->setText(tr("Shows icon")); 187 keyLabel->setText(tr("Shows icon"));
188 } 188 }
189 else { 189 else {
190 cfg.writeEntry( "hideIcon", 1); 190 cfg.writeEntry( "hideIcon", 1);
191 keyLabel->setText(tr("Hides icon")); 191 keyLabel->setText(tr("Hides icon"));
192 } 192 }
193 cfg.write(); 193 cfg.write();
194} 194}
195 195
196void SoundSettings::updateLocationCombo() { 196void SoundSettings::updateLocationCombo() {
197 197
198} 198}
199 199
200void SoundSettings::setSizeLimitButton(const QString &index) { 200void SoundSettings::setSizeLimitButton(const QString &index) {
201 201
202 Config cfg("Vmemo"); 202 Config cfg("Vmemo");
203 cfg.setGroup("Record"); 203 cfg.setGroup("Record");
204 if(index.find("Unlimited",0,TRUE) != -1) 204 if(index.find("Unlimited",0,TRUE) != -1)
205 cfg.writeEntry("SizeLimit", -1); 205 cfg.writeEntry("SizeLimit", -1);
206 else 206 else
207 cfg.writeEntry("SizeLimit", index); 207 cfg.writeEntry("SizeLimit", index);
208 cfg.write(); 208 cfg.write();
209} 209}
210 210
211void SoundSettings::restartOpie(bool b) { 211void SoundSettings::restartOpie(bool b) {
212 noWarning=b; 212 noWarning=b;
213} 213}
214 214
215void SoundSettings::slotAdpcm(bool b) { 215void SoundSettings::slotAdpcm(bool b) {
216 Config vmCfg("Vmemo"); 216 Config vmCfg("Vmemo");
217 vmCfg.setGroup("Defaults"); 217 vmCfg.setGroup("Defaults");
218 vmCfg.writeEntry("use_ADPCM", b); 218 vmCfg.writeEntry("use_ADPCM", b);
219 vmCfg.write(); 219 vmCfg.write();