-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index f417b79..75a707b 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,127 +1,143 @@ | |||
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> | ||
35 | #include <sys/time.h> | ||
36 | #include <sys/types.h> | ||
37 | #include <unistd.h> | ||
38 | #include <stdio.h> | ||
39 | #include <sys/stat.h> | ||
34 | 40 | ||
35 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | 41 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) |
36 | : SoundSettingsBase( parent, name, TRUE, fl ) | 42 | : SoundSettingsBase( parent, name, TRUE, fl ) |
37 | { | 43 | { |
38 | keyReset=FALSE; | 44 | keyReset=FALSE; |
39 | 45 | ||
40 | Config config( "qpe"); | 46 | Config config( "qpe"); |
41 | config.setGroup( "Volume" ); | 47 | config.setGroup( "Volume" ); |
42 | volume->setValue(100-config.readNumEntry("VolumePercent")); | 48 | volume->setValue(100-config.readNumEntry("VolumePercent")); |
43 | mic->setValue(100-config.readNumEntry("Mic")); | 49 | mic->setValue(100-config.readNumEntry("Mic")); |
44 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); | 50 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); |
45 | // keysound->setChecked(config.readBoolEntry("KeySound")); | 51 | // keysound->setChecked(config.readBoolEntry("KeySound")); |
46 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
47 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
48 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
49 | 55 | ||
50 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
51 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
52 | if(rate == 8000) | 58 | if(rate == 8000) |
53 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
54 | else if(rate == 11025) | 60 | else if(rate == 11025) |
55 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
56 | else if(rate == 22050) | 62 | else if(rate == 22050) |
57 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
58 | else if(rate == 33075) | 64 | else if(rate == 33075) |
59 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
60 | else if(rate==44100) | 66 | else if(rate==44100) |
61 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
62 | 68 | ||
63 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 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*/ | ||
71 | if (uname(&name) != -1) { | ||
72 | QString release=name.release; | ||
73 | |||
74 | if( release.find("embedix",0,TRUE) !=-1) | ||
75 | stereoCheckBox->hide(); | ||
76 | // else | ||
77 | // stereoCheckBox->hide(); | ||
78 | |||
79 | |||
64 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 80 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
65 | 81 | ||
66 | cfg.setGroup("Defaults"); | 82 | cfg.setGroup("Defaults"); |
67 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 83 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
68 | 84 | ||
69 | updateStorageCombo(); | 85 | updateStorageCombo(); |
70 | 86 | ||
71 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 87 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
72 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 88 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
73 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 89 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
74 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 90 | connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
75 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); | 91 | connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &))); |
76 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &))); | 92 | connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &))); |
77 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 93 | // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
78 | } | 94 | } |
79 | 95 | ||
80 | // void SoundSettings::reject() | 96 | // void SoundSettings::reject() |
81 | // { | 97 | // { |
82 | // qDebug("reject"); | 98 | // qDebug("reject"); |
83 | // Config config( "qpe"); | 99 | // Config config( "qpe"); |
84 | // config.setGroup( "Volume"); | 100 | // config.setGroup( "Volume"); |
85 | 101 | ||
86 | // setVolume(100-config.readNumEntry("VolumePercent")); | 102 | // setVolume(100-config.readNumEntry("VolumePercent")); |
87 | // setMic(100-config.readNumEntry("Mic")); | 103 | // setMic(100-config.readNumEntry("Mic")); |
88 | 104 | ||
89 | // // config.setGroup("Record"); | 105 | // // config.setGroup("Record"); |
90 | // // int rate=config.readNumEntry("SampleRate", 11025); | 106 | // // int rate=config.readNumEntry("SampleRate", 11025); |
91 | // // if(rate == 11025) | 107 | // // if(rate == 11025) |
92 | // // sampleRate->setCurrentItem(0); | 108 | // // sampleRate->setCurrentItem(0); |
93 | // // else if(rate == 22050) | 109 | // // else if(rate == 22050) |
94 | // // sampleRate->setCurrentItem(1); | 110 | // // sampleRate->setCurrentItem(1); |
95 | // // else if(rate == 32000) | 111 | // // else if(rate == 32000) |
96 | // // sampleRate->setCurrentItem(2); | 112 | // // sampleRate->setCurrentItem(2); |
97 | // // else if(rate==44100) | 113 | // // else if(rate==44100) |
98 | // // sampleRate->setCurrentItem(3); | 114 | // // sampleRate->setCurrentItem(3); |
99 | // // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); | 115 | // // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0)); |
100 | // // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); | 116 | // // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0)); |
101 | // qDebug("QDialog::reject();"); | 117 | // qDebug("QDialog::reject();"); |
102 | // ::exit(-1); | 118 | // ::exit(-1); |
103 | // } | 119 | // } |
104 | 120 | ||
105 | // void SoundSettings::accept() | 121 | // void SoundSettings::accept() |
106 | // { | 122 | // { |
107 | // qDebug("accept"); | 123 | // qDebug("accept"); |
108 | // Config config( "qpe" ); | 124 | // Config config( "qpe" ); |
109 | // config.setGroup( "Volume" ); | 125 | // config.setGroup( "Volume" ); |
110 | // config.writeEntry("VolumePercent",100-volume->value()); | 126 | // config.writeEntry("VolumePercent",100-volume->value()); |
111 | // config.writeEntry("Mic",100-mic->value()); | 127 | // config.writeEntry("Mic",100-mic->value()); |
112 | // // config.writeEntry("TouchSound",touchsound->isChecked()); | 128 | // // config.writeEntry("TouchSound",touchsound->isChecked()); |
113 | // // config.writeEntry("KeySound",keysound->isChecked()); | 129 | // // config.writeEntry("KeySound",keysound->isChecked()); |
114 | 130 | ||
115 | // Config cfg("Vmemo"); | 131 | // Config cfg("Vmemo"); |
116 | // cfg.writeEntry("Alert",AlertCheckBox->isChecked()); | 132 | // cfg.writeEntry("Alert",AlertCheckBox->isChecked()); |
117 | // setVolume(volume->value()); | 133 | // setVolume(volume->value()); |
118 | // setMic(mic->value()); | 134 | // setMic(mic->value()); |
119 | 135 | ||
120 | // cfg.setGroup("Record"); | 136 | // cfg.setGroup("Record"); |
121 | // cfg.writeEntry("SampleRate",sampleRate->currentText()); | 137 | // cfg.writeEntry("SampleRate",sampleRate->currentText()); |
122 | // cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); | 138 | // cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); |
123 | // cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); | 139 | // cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); |
124 | // // Config cfg( "VMemo" ); | 140 | // // Config cfg( "VMemo" ); |
125 | // // cfg.setGroup( "Defaults" ); | 141 | // // cfg.setGroup( "Defaults" ); |
126 | // // cfg.writeEntry( "hideIcon", HideIcon_CheckBox->isChecked()); | 142 | // // cfg.writeEntry( "hideIcon", HideIcon_CheckBox->isChecked()); |
127 | // qDebug("QDialog::accept();"); | 143 | // qDebug("QDialog::accept();"); |