author | llornkcor <llornkcor> | 2002-04-20 02:56:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-20 02:56:33 (UTC) |
commit | 897921b4f3462f0a43466df79a06b89662a0f5c3 (patch) (unidiff) | |
tree | e2dcb90d6d5692e7efca536ec83377dc9b21a0c0 /noncore/settings/sound/soundsettings.cpp | |
parent | 9dc836d915eb8160a104c5ea4d59ba8015e9fce0 (diff) | |
download | opie-897921b4f3462f0a43466df79a06b89662a0f5c3.zip opie-897921b4f3462f0a43466df79a06b89662a0f5c3.tar.gz opie-897921b4f3462f0a43466df79a06b89662a0f5c3.tar.bz2 |
added location combo, default samplerate is now 22050
Diffstat (limited to 'noncore/settings/sound/soundsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 467f23e..51522b3 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,136 +1,166 @@ | |||
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 | #include "soundsettings.h" | 20 | #include "soundsettings.h" |
21 | 21 | ||
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/storage.h> | ||
25 | |||
24 | #include <qapplication.h> | 26 | #include <qapplication.h> |
25 | #include <qslider.h> | 27 | #include <qslider.h> |
26 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
27 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
28 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
29 | 31 | ||
30 | 32 | ||
31 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | 33 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) |
32 | : SoundSettingsBase( parent, name, TRUE, fl ) | 34 | : SoundSettingsBase( parent, name, TRUE, fl ) |
33 | { | 35 | { |
34 | Config config( "Sound" ); | 36 | Config config( "Sound" ); |
35 | config.setGroup( "System" ); | 37 | config.setGroup( "System" ); |
36 | volume->setValue(100-config.readNumEntry("Volume")); | 38 | volume->setValue(100-config.readNumEntry("Volume")); |
37 | mic->setValue(100-config.readNumEntry("Mic")); | 39 | mic->setValue(100-config.readNumEntry("Mic")); |
38 | touchsound->setChecked(config.readBoolEntry("Touch")); | 40 | touchsound->setChecked(config.readBoolEntry("Touch")); |
39 | keysound->setChecked(config.readBoolEntry("Key")); | 41 | keysound->setChecked(config.readBoolEntry("Key")); |
40 | 42 | ||
41 | config.setGroup("Record"); | 43 | config.setGroup("Record"); |
42 | int rate=config.readNumEntry("SampleRate", 11025); | 44 | int rate=config.readNumEntry("SampleRate", 22050); |
43 | if(rate == 11025) | 45 | if(rate == 11025) |
44 | sampleRate->setCurrentItem(0); | 46 | sampleRate->setCurrentItem(0); |
45 | else if(rate == 22050) | 47 | else if(rate == 22050) |
46 | sampleRate->setCurrentItem(1); | 48 | sampleRate->setCurrentItem(1); |
47 | else if(rate == 32000) | 49 | else if(rate == 32000) |
48 | sampleRate->setCurrentItem(2); | 50 | sampleRate->setCurrentItem(2); |
49 | else if(rate==44100) | 51 | else if(rate==44100) |
50 | sampleRate->setCurrentItem(2); | 52 | sampleRate->setCurrentItem(2); |
51 | 53 | ||
52 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 54 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
53 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 1)); | 55 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 1)); |
54 | 56 | ||
57 | updateStorageCombo(); | ||
55 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 58 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
56 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 59 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
57 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 60 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
58 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 61 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
62 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | ||
63 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | ||
59 | } | 64 | } |
60 | 65 | ||
61 | void SoundSettings::reject() | 66 | void SoundSettings::reject() |
62 | { | 67 | { |
63 | Config config( "Sound" ); | 68 | Config config( "Sound" ); |
64 | config.setGroup( "System" ); | 69 | config.setGroup( "System" ); |
65 | setVolume(100-config.readNumEntry("Volume")); | ||
66 | setMic(100-config.readNumEntry("Mic")); | ||
67 | 70 | ||
68 | config.setGroup("Record"); | 71 | setVolume(100-config.readNumEntry("Volume")); |
69 | int rate=config.readNumEntry("SampleRate", 11025); | 72 | setMic(100-config.readNumEntry("Mic")); |
70 | if(rate == 11025) | 73 | |
71 | sampleRate->setCurrentItem(0); | 74 | // config.setGroup("Record"); |
72 | else if(rate == 22050) | 75 | // int rate=config.readNumEntry("SampleRate", 11025); |
73 | sampleRate->setCurrentItem(1); | 76 | // if(rate == 11025) |
74 | else if(rate == 32000) | 77 | // sampleRate->setCurrentItem(0); |
75 | sampleRate->setCurrentItem(2); | 78 | // else if(rate == 22050) |
76 | else if(rate==44100) | 79 | // sampleRate->setCurrentItem(1); |
77 | sampleRate->setCurrentItem(3); | 80 | // else if(rate == 32000) |
78 | stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 81 | // sampleRate->setCurrentItem(2); |
79 | sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | 82 | // else if(rate==44100) |
83 | // sampleRate->setCurrentItem(3); | ||
84 | // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | ||
85 | // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | ||
80 | 86 | ||
81 | QDialog::reject(); | 87 | QDialog::reject(); |
82 | } | 88 | } |
83 | 89 | ||
84 | void SoundSettings::accept() | 90 | void SoundSettings::accept() |
85 | { | 91 | { |
86 | Config config( "Sound" ); | 92 | Config config( "Sound" ); |
87 | config.setGroup( "System" ); | 93 | config.setGroup( "System" ); |
88 | config.writeEntry("Volume",100-volume->value()); | 94 | config.writeEntry("Volume",100-volume->value()); |
89 | config.writeEntry("Mic",100-mic->value()); | 95 | config.writeEntry("Mic",100-mic->value()); |
90 | config.writeEntry("Touch",touchsound->isChecked()); | 96 | config.writeEntry("Touch",touchsound->isChecked()); |
91 | config.writeEntry("Key",keysound->isChecked()); | 97 | config.writeEntry("Key",keysound->isChecked()); |
92 | 98 | ||
93 | setVolume(volume->value()); | 99 | setVolume(volume->value()); |
94 | setMic(mic->value()); | 100 | setMic(mic->value()); |
95 | 101 | ||
96 | config.setGroup("Record"); | 102 | config.setGroup("Record"); |
97 | config.writeEntry("SampleRate",sampleRate->currentText()); | 103 | config.writeEntry("SampleRate",sampleRate->currentText()); |
98 | config.writeEntry("Stereo",stereoCheckBox->isChecked()); | 104 | config.writeEntry("Stereo",stereoCheckBox->isChecked()); |
99 | config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 105 | config.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
100 | 106 | ||
101 | QDialog::accept(); | 107 | QDialog::accept(); |
102 | } | 108 | } |
103 | 109 | ||
104 | void SoundSettings::setVolume(int v) | 110 | void SoundSettings::setVolume(int v) |
105 | { | 111 | { |
106 | Config config( "Sound" ); | 112 | Config config( "Sound" ); |
107 | config.setGroup( "System" ); | 113 | config.setGroup( "System" ); |
108 | config.writeEntry("Volume",100-v); | 114 | config.writeEntry("Volume",100-v); |
109 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 115 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
110 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; | 116 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; |
111 | #endif | 117 | #endif |
112 | } | 118 | } |
113 | 119 | ||
114 | void SoundSettings::setMic(int m) | 120 | void SoundSettings::setMic(int m) |
115 | { | 121 | { |
116 | Config config( "Sound" ); | 122 | Config config( "Sound" ); |
117 | config.setGroup( "System" ); | 123 | config.setGroup( "System" ); |
118 | config.writeEntry("Mic",100-m); | 124 | config.writeEntry("Mic",100-m); |
119 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 125 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
120 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE; | 126 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE; |
121 | #endif | 127 | #endif |
122 | } | 128 | } |
123 | 129 | ||
124 | void SoundSettings::volumeChanged( bool ) | 130 | void SoundSettings::volumeChanged( bool ) |
125 | { | 131 | { |
126 | Config config( "Sound" ); | 132 | Config config( "Sound" ); |
127 | config.setGroup( "System" ); | 133 | config.setGroup( "System" ); |
128 | volume->setValue(100-config.readNumEntry("Volume")); | 134 | volume->setValue(100-config.readNumEntry("Volume")); |
129 | } | 135 | } |
130 | 136 | ||
131 | void SoundSettings::micChanged( bool ) | 137 | void SoundSettings::micChanged( bool ) |
132 | { | 138 | { |
133 | Config config( "Sound" ); | 139 | Config config( "Sound" ); |
134 | config.setGroup( "System" ); | 140 | config.setGroup( "System" ); |
135 | mic->setValue(100-config.readNumEntry("Mic")); | 141 | mic->setValue(100-config.readNumEntry("Mic")); |
136 | } | 142 | } |
143 | |||
144 | void SoundSettings::updateStorageCombo() { | ||
145 | |||
146 | StorageInfo storageInfo; | ||
147 | QString sName, sPath; | ||
148 | QStringList list; | ||
149 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
150 | QListIterator<FileSystem> it ( fs ); | ||
151 | for( ; it.current(); ++it ){ | ||
152 | const QString name = (*it)->name(); | ||
153 | const QString path = (*it)->path(); | ||
154 | qDebug("storage name "+name +" storage path is "+path); | ||
155 | list << name + ": " +path; | ||
156 | // if(dit.current()->file().find(path) != -1 ) storage=name; | ||
157 | } | ||
158 | LocationComboBox->insertStringList(list); | ||
159 | } | ||
160 | |||
161 | void SoundSettings::setLocation(const QString & string) { | ||
162 | Config config( "Sound" ); | ||
163 | config.setGroup( "System" ); | ||
164 | config.writeEntry("RecLocation",string); | ||
165 | |||
166 | } | ||