-rw-r--r-- | noncore/settings/sound/sound.pro | 11 | ||||
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 16 |
2 files changed, 15 insertions, 12 deletions
diff --git a/noncore/settings/sound/sound.pro b/noncore/settings/sound/sound.pro index a3804c3..58e94f3 100644 --- a/noncore/settings/sound/sound.pro +++ b/noncore/settings/sound/sound.pro | |||
@@ -1,10 +1,9 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | HEADERS = soundsettings.h soundsettingsbase.h | 2 | HEADERS = soundsettings.h soundsettingsbase.h |
3 | SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp | 3 | SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp |
4 | #INTERFACES = soundsettingsbase.ui | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | 4 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 5 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiecore2 | 6 | LIBS += -lqpe -lopiecore2 |
8 | TARGET = sound | 7 | TARGET = sound |
9 | 8 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 9 | include ( $(OPIEDIR)/include.pro ) |
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 | |||
@@ -1,112 +1,116 @@ | |||
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 | // 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); |
54 | if(rate == 8000) | 58 | if(rate == 8000) |
55 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
56 | else if(rate == 11025) | 60 | else if(rate == 11025) |
57 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
58 | else if(rate == 22050) | 62 | else if(rate == 22050) |
59 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
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 | ||
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 | 113 | ||
110 | Config vmCfg("Vmemo"); | 114 | Config vmCfg("Vmemo"); |
111 | vmCfg.setGroup("Defaults"); | 115 | vmCfg.setGroup("Defaults"); |
112 | adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); | 116 | adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); |
@@ -122,66 +126,66 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | |||
122 | connect( adpcmCheckBox,SIGNAL( toggled(bool)), this, | 126 | connect( adpcmCheckBox,SIGNAL( toggled(bool)), this, |
123 | SLOT( slotAdpcm(bool))); | 127 | SLOT( slotAdpcm(bool))); |
124 | 128 | ||
125 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 129 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
126 | } | 130 | } |
127 | 131 | ||
128 | void SoundSettings::updateStorageCombo() { | 132 | void SoundSettings::updateStorageCombo() { |
129 | 133 | ||
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 | ||
180 | void SoundSettings::setKeyButton( int index) { | 184 | void SoundSettings::setKeyButton( int index) { |
181 | Config cfg("Vmemo"); | 185 | Config cfg("Vmemo"); |
182 | cfg.setGroup("Defaults"); | 186 | cfg.setGroup("Defaults"); |
183 | cfg.writeEntry( "toggleKey", index ); | 187 | cfg.writeEntry( "toggleKey", index ); |
184 | keyReset = TRUE; | 188 | keyReset = TRUE; |
185 | if( index == 1) { | 189 | if( index == 1) { |
186 | cfg.writeEntry( "hideIcon", 0 ); | 190 | cfg.writeEntry( "hideIcon", 0 ); |
187 | keyLabel->setText(tr("Shows icon")); | 191 | keyLabel->setText(tr("Shows icon")); |