author | llornkcor <llornkcor> | 2002-06-22 23:03:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-22 23:03:32 (UTC) |
commit | c015dff8a9e3aec56117349bb58f6d1bf1a7eb4a (patch) (unidiff) | |
tree | 2a83ddfd30bf8133df28ce0b353b617c8ef9a9ad | |
parent | b6f6bab5e56f352a4f71dadb40530d6cdcaea3cc (diff) | |
download | opie-c015dff8a9e3aec56117349bb58f6d1bf1a7eb4a.zip opie-c015dff8a9e3aec56117349bb58f6d1bf1a7eb4a.tar.gz opie-c015dff8a9e3aec56117349bb58f6d1bf1a7eb4a.tar.bz2 |
fix
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 75a707b..b490072 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,171 +1,172 @@ | |||
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* name, WFlags fl ) | 41 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) |
42 | : SoundSettingsBase( parent, name, TRUE, fl ) | 42 | : SoundSettingsBase( parent, name, 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 | volume->setValue(100-config.readNumEntry("VolumePercent")); | 48 | volume->setValue(100-config.readNumEntry("VolumePercent")); |
49 | mic->setValue(100-config.readNumEntry("Mic")); | 49 | mic->setValue(100-config.readNumEntry("Mic")); |
50 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); | 50 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); |
51 | // keysound->setChecked(config.readBoolEntry("KeySound")); | 51 | // keysound->setChecked(config.readBoolEntry("KeySound")); |
52 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
55 | 55 | ||
56 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
57 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
58 | if(rate == 8000) | 58 | if(rate == 8000) |
59 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
60 | else if(rate == 11025) | 60 | else if(rate == 11025) |
61 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
62 | else if(rate == 22050) | 62 | else if(rate == 22050) |
63 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
64 | else if(rate == 33075) | 64 | else if(rate == 33075) |
65 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
66 | else if(rate==44100) | 66 | else if(rate==44100) |
67 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
68 | 68 | ||
69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only |
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) { | 71 | if (uname(&name) != -1) { |
72 | QString release=name.release; | 72 | QString release=name.release; |
73 | 73 | ||
74 | if( release.find("embedix",0,TRUE) !=-1) | 74 | if( release.find("embedix",0,TRUE) !=-1) |
75 | stereoCheckBox->hide(); | 75 | stereoCheckBox->hide(); |
76 | } | ||
76 | // else | 77 | // else |
77 | // stereoCheckBox->hide(); | 78 | // stereoCheckBox->hide(); |
78 | 79 | ||
79 | 80 | ||
80 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 81 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
81 | 82 | ||
82 | cfg.setGroup("Defaults"); | 83 | cfg.setGroup("Defaults"); |
83 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 84 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
84 | 85 | ||
85 | updateStorageCombo(); | 86 | updateStorageCombo(); |
86 | 87 | ||
87 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 88 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
88 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 89 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
89 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 90 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
90 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 91 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
91 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | 92 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); |
92 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &))); | 93 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &))); |
93 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 94 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
94 | } | 95 | } |
95 | 96 | ||
96 | // void SoundSettings::reject() | 97 | // void SoundSettings::reject() |
97 | // { | 98 | // { |
98 | // qDebug("reject"); | 99 | // qDebug("reject"); |
99 | // Config config( "qpe"); | 100 | // Config config( "qpe"); |
100 | // config.setGroup( "Volume"); | 101 | // config.setGroup( "Volume"); |
101 | 102 | ||
102 | // setVolume(100-config.readNumEntry("VolumePercent")); | 103 | // setVolume(100-config.readNumEntry("VolumePercent")); |
103 | // setMic(100-config.readNumEntry("Mic")); | 104 | // setMic(100-config.readNumEntry("Mic")); |
104 | 105 | ||
105 | // // config.setGroup("Record"); | 106 | // // config.setGroup("Record"); |
106 | // // int rate=config.readNumEntry("SampleRate", 11025); | 107 | // // int rate=config.readNumEntry("SampleRate", 11025); |
107 | // // if(rate == 11025) | 108 | // // if(rate == 11025) |
108 | // // sampleRate->setCurrentItem(0); | 109 | // // sampleRate->setCurrentItem(0); |
109 | // // else if(rate == 22050) | 110 | // // else if(rate == 22050) |
110 | // // sampleRate->setCurrentItem(1); | 111 | // // sampleRate->setCurrentItem(1); |
111 | // // else if(rate == 32000) | 112 | // // else if(rate == 32000) |
112 | // // sampleRate->setCurrentItem(2); | 113 | // // sampleRate->setCurrentItem(2); |
113 | // // else if(rate==44100) | 114 | // // else if(rate==44100) |
114 | // // sampleRate->setCurrentItem(3); | 115 | // // sampleRate->setCurrentItem(3); |
115 | // // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 116 | // // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
116 | // // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | 117 | // // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); |
117 | // qDebug("QDialog::reject();"); | 118 | // qDebug("QDialog::reject();"); |
118 | // ::exit(-1); | 119 | // ::exit(-1); |
119 | // } | 120 | // } |
120 | 121 | ||
121 | // void SoundSettings::accept() | 122 | // void SoundSettings::accept() |
122 | // { | 123 | // { |
123 | // qDebug("accept"); | 124 | // qDebug("accept"); |
124 | // Config config( "qpe" ); | 125 | // Config config( "qpe" ); |
125 | // config.setGroup( "Volume" ); | 126 | // config.setGroup( "Volume" ); |
126 | // config.writeEntry("VolumePercent",100-volume->value()); | 127 | // config.writeEntry("VolumePercent",100-volume->value()); |
127 | // config.writeEntry("Mic",100-mic->value()); | 128 | // config.writeEntry("Mic",100-mic->value()); |
128 | // // config.writeEntry("TouchSound",touchsound->isChecked()); | 129 | // // config.writeEntry("TouchSound",touchsound->isChecked()); |
129 | // // config.writeEntry("KeySound",keysound->isChecked()); | 130 | // // config.writeEntry("KeySound",keysound->isChecked()); |
130 | 131 | ||
131 | // Config cfg("Vmemo"); | 132 | // Config cfg("Vmemo"); |
132 | // cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 133 | // cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
133 | // setVolume(volume->value()); | 134 | // setVolume(volume->value()); |
134 | // setMic(mic->value()); | 135 | // setMic(mic->value()); |
135 | 136 | ||
136 | // cfg.setGroup("Record"); | 137 | // cfg.setGroup("Record"); |
137 | // cfg.writeEntry("SampleRate",sampleRate->currentText()); | 138 | // cfg.writeEntry("SampleRate",sampleRate->currentText()); |
138 | // cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 139 | // cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
139 | // cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 140 | // cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
140 | // // Config cfg( "VMemo" ); | 141 | // // Config cfg( "VMemo" ); |
141 | // // cfg.setGroup( "Defaults" ); | 142 | // // cfg.setGroup( "Defaults" ); |
142 | // // cfg.writeEntry( "hideIcon", HideIcon_CheckBox->isChecked()); | 143 | // // cfg.writeEntry( "hideIcon", HideIcon_CheckBox->isChecked()); |
143 | // qDebug("QDialog::accept();"); | 144 | // qDebug("QDialog::accept();"); |
144 | // ::exit(0); | 145 | // ::exit(0); |
145 | // } | 146 | // } |
146 | 147 | ||
147 | void SoundSettings::setVolume(int v) | 148 | void SoundSettings::setVolume(int v) |
148 | { | 149 | { |
149 | Config config( "qpe" ); | 150 | Config config( "qpe" ); |
150 | config.setGroup( "Volume" ); | 151 | config.setGroup( "Volume" ); |
151 | config.writeEntry("VolumePercent",100-v); | 152 | config.writeEntry("VolumePercent",100-v); |
152 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 153 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
153 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; | 154 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; |
154 | #endif | 155 | #endif |
155 | } | 156 | } |
156 | 157 | ||
157 | void SoundSettings::setMic(int m) | 158 | void SoundSettings::setMic(int m) |
158 | { | 159 | { |
159 | Config config( "qpe" ); | 160 | Config config( "qpe" ); |
160 | config.setGroup( "Volume" ); | 161 | config.setGroup( "Volume" ); |
161 | config.writeEntry("Mic",100-m); | 162 | config.writeEntry("Mic",100-m); |
162 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 163 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
163 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE; | 164 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE; |
164 | #endif | 165 | #endif |
165 | } | 166 | } |
166 | 167 | ||
167 | void SoundSettings::volumeChanged( bool ) | 168 | void SoundSettings::volumeChanged( bool ) |
168 | { | 169 | { |
169 | Config config( "qpe" ); | 170 | Config config( "qpe" ); |
170 | config.setGroup( "Volume" ); | 171 | config.setGroup( "Volume" ); |
171 | volume->setValue(100-config.readNumEntry("VolumePercent")); | 172 | volume->setValue(100-config.readNumEntry("VolumePercent")); |