summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-26 00:48:09 (UTC)
committer llornkcor <llornkcor>2002-07-26 00:48:09 (UTC)
commitf3678966b4f08e9cc99b5f625c028e6f2d29a8ae (patch) (unidiff)
treea9d3b94d3768d288f2de47660f55c56e4c3d6a07
parentcf32a5b8d6886b357d0f4a6ecdc5b10f78a6a041 (diff)
downloadopie-f3678966b4f08e9cc99b5f625c028e6f2d29a8ae.zip
opie-f3678966b4f08e9cc99b5f625c028e6f2d29a8ae.tar.gz
opie-f3678966b4f08e9cc99b5f625c028e6f2d29a8ae.tar.bz2
really fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sound/soundsettings.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 010e0af..cddb478 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -1,188 +1,191 @@
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
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 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 if(sRate == 5) 96 else if(sRate == 5)
97 timeLimitComboBox->setCurrentItem(4); 97 timeLimitComboBox->setCurrentItem(4);
98 else 98 else
99 timeLimitComboBox->setCurrentItem(5); 99 timeLimitComboBox->setCurrentItem(5);
100 100
101 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); 101 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
102 102
103 cfg.setGroup("Defaults"); 103 cfg.setGroup("Defaults");
104 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); 104 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
105 105
106 updateStorageCombo(); 106 updateStorageCombo();
107 connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); 107 connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &)));
108 connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT( setKeyButton(const QString &))); 108 connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT( setKeyButton(const QString &)));
109 connect( timeLimitComboBox,SIGNAL(activated( const QString &)),this,SLOT( setSizeLimitButton(const QString &))); 109 connect( timeLimitComboBox,SIGNAL(activated( const QString &)),this,SLOT( setSizeLimitButton(const QString &)));
110// connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 110// connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
111} 111}
112void SoundSettings::updateStorageCombo() { 112void SoundSettings::updateStorageCombo() {
113 113
114 Config config( "Vmemo" ); 114 Config config( "Vmemo" );
115 config.setGroup( "System" ); 115 config.setGroup( "System" );
116 QString loc = config.readEntry("RecLocation","/"); 116 QString loc = config.readEntry("RecLocation","/");
117int i=0; 117int i=0;
118int set=0; 118int set=0;
119 StorageInfo storageInfo; 119 StorageInfo storageInfo;
120 QString sName, sPath; 120 QString sName, sPath;
121 QStringList list; 121 QStringList list;
122 list << "Documents : "+QPEApplication::documentDir(); 122 list << "Documents : "+QPEApplication::documentDir();
123 list << "tmp : /tmp"; 123 list << "tmp : /tmp";
124 124
125 const QList<FileSystem> &fs = storageInfo.fileSystems(); 125 const QList<FileSystem> &fs = storageInfo.fileSystems();
126 QListIterator<FileSystem> it ( fs ); 126 QListIterator<FileSystem> it ( fs );
127 for( ; it.current(); ++it ){ 127 for( ; it.current(); ++it ){
128 const QString name = (*it)->name(); 128 const QString name = (*it)->name();
129 const QString path = (*it)->path(); 129 const QString path = (*it)->path();
130 qDebug("storage name "+name +" storage path is "+path); 130 qDebug("storage name "+name +" storage path is "+path);
131 list << name + ": " +path; 131 list << name + ": " +path;
132 if( loc.find( path,0,TRUE) != -1) 132 if( loc.find( path,0,TRUE) != -1)
133 set = i; 133 set = i;
134// if(dit.current()->file().find(path) != -1 ) storage=name; 134// if(dit.current()->file().find(path) != -1 ) storage=name;
135 i++; 135 i++;
136 } 136 }
137 137
138 LocationComboBox->insertStringList(list); 138 LocationComboBox->insertStringList(list);
139 qDebug("set item %d", set); 139 qDebug("set item %d", set);
140 LocationComboBox->setCurrentItem(set); 140 LocationComboBox->setCurrentItem(set);
141} 141}
142 142
143void SoundSettings::setLocation(const QString & string) { 143void SoundSettings::setLocation(const QString & string) {
144 Config config( "Vmemo" ); 144 Config config( "Vmemo" );
145 config.setGroup( "System" ); 145 config.setGroup( "System" );
146 config.writeEntry("RecLocation",string); 146 config.writeEntry("RecLocation",string);
147 qDebug("set location "+string); 147 qDebug("set location "+string);
148 config.write(); 148 config.write();
149} 149}
150 150
151void SoundSettings::cleanUp() { 151void SoundSettings::cleanUp() {
152 Config cfg("Vmemo"); 152 Config cfg("Vmemo");
153 cfg.writeEntry("Alert",AlertCheckBox->isChecked()); 153 cfg.writeEntry("Alert",AlertCheckBox->isChecked());
154 154
155 cfg.setGroup("Record"); 155 cfg.setGroup("Record");
156 cfg.writeEntry("SampleRate",sampleRate->currentText()); 156 cfg.writeEntry("SampleRate",sampleRate->currentText());
157 cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); 157 cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
158 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); 158 cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
159 159
160 if(keyReset) QCopEnvelope ("QPE/System", "restart()"); 160 if(keyReset) QCopEnvelope ("QPE/System", "restart()");
161 161
162} 162}
163 163
164void SoundSettings::setKeyButton(const QString &name) { 164void SoundSettings::setKeyButton(const QString &name) {
165 Config cfg("Vmemo"); 165 Config cfg("Vmemo");
166 cfg.setGroup("Defaults"); 166 cfg.setGroup("Defaults");
167 cfg.writeEntry( "toggleKey", keyComboBox->currentItem() ); 167 cfg.writeEntry( "toggleKey", keyComboBox->currentItem() );
168 keyReset = TRUE; 168 keyReset = TRUE;
169 if(keyComboBox->currentItem() == 1) 169 if(keyComboBox->currentItem() == 1)
170 cfg.writeEntry( "hideIcon", 0 ); 170 cfg.writeEntry( "hideIcon", 0 );
171 else 171 else
172 cfg.writeEntry( "hideIcon", 1); 172 cfg.writeEntry( "hideIcon", 1);
173 173
174 174
175 cfg.write(); 175 cfg.write();
176} 176}
177 177
178void SoundSettings::updateLocationCombo() { 178void SoundSettings::updateLocationCombo() {
179 179
180} 180}
181 181
182void SoundSettings::setSizeLimitButton(const QString &index) { 182void SoundSettings::setSizeLimitButton(const QString &index) {
183 183
184 Config cfg("Vmemo"); 184 Config cfg("Vmemo");
185 cfg.setGroup("Record"); 185 cfg.setGroup("Record");
186 cfg.writeEntry("SizeLimit", index); 186 if(index.find("Unlimited",0,TRUE) != -1)
187 cfg.writeEntry("SizeLimit", -1);
188 else
189 cfg.writeEntry("SizeLimit", index);
187 cfg.write(); 190 cfg.write();
188} 191}