summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2005-02-18 08:35:49 (UTC)
committer llornkcor <llornkcor>2005-02-18 08:35:49 (UTC)
commit0f1ae1478122e2f65f8d477d9baad8de15df1eb2 (patch) (unidiff)
tree903fe5a875bfd9fda0fccf7d8ba4b8eda9a3a07c /noncore
parent436a26541402c85a24eaf9ffb3ab2e866631000c (diff)
downloadopie-0f1ae1478122e2f65f8d477d9baad8de15df1eb2.zip
opie-0f1ae1478122e2f65f8d477d9baad8de15df1eb2.tar.gz
opie-0f1ae1478122e2f65f8d477d9baad8de15df1eb2.tar.bz2
change to dialog so user can cancel
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sound/soundsettings.cpp79
-rw-r--r--noncore/settings/sound/soundsettings.h7
-rw-r--r--noncore/settings/sound/soundsettingsbase.cpp3
-rw-r--r--noncore/settings/sound/soundsettingsbase.h5
4 files changed, 55 insertions, 39 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index d55a751..df3def5 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -43,15 +43,18 @@ using namespace Opie::Core;
43 43
44 44
45SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) 45SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
46 : SoundSettingsBase( parent, objname, TRUE, fl ) 46 : SoundSettingsBase( parent, objname, true, fl )
47{ 47{
48 keyReset=FALSE; 48 keyReset=false;
49 noWarning=false; 49 noWarning=false;
50 Config config( "qpe"); 50 Config config( "qpe");
51 config.setGroup( "Volume" ); 51 config.setGroup( "Volume" );
52 Config cfg("Vmemo"); 52 Config cfg("Vmemo");
53 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 53
54 AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); 54
55 // connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
56
57 AlertCheckBox->setChecked( cfg.readBoolEntry("Alert", 1));
55 58
56 cfg.setGroup("Record"); 59 cfg.setGroup("Record");
57 int rate=config.readNumEntry("SampleRate", 22050); 60 int rate=config.readNumEntry("SampleRate", 22050);
@@ -72,28 +75,28 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
72#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 75#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
73//since ipaq and zaurus have particular 76//since ipaq and zaurus have particular
74//devices 77//devices
75 bool systemZaurus=FALSE; 78 bool systemZaurus=false;
76 struct utsname name; /* check for embedix kernel running on the zaurus*/ 79 struct utsname name; /* check for embedix kernel running on the zaurus*/
77 if (uname(&name) != -1) {// TODO change this here,... 80 if (uname(&name) != -1) {// TODO change this here,...
78 QString release=name.release; 81 QString release=name.release;
79 if( release.find("embedix",0,TRUE) != -1) { 82 if( release.find("embedix",0,true) != -1) {
80 odebug << "IS System Zaurus" << oendl; 83 odebug << "IS System Zaurus" << oendl;
81 systemZaurus=TRUE; 84 systemZaurus=true;
82 } 85 }
83 } 86 }
84 if(!systemZaurus) { 87 if(!systemZaurus) {
85 stereoCheckBox->setChecked(TRUE); 88 stereoCheckBox->setChecked(true);
86 } 89 }
87 stereoCheckBox->setEnabled(FALSE); 90 stereoCheckBox->setEnabled(false);
88 sixteenBitCheckBox->setEnabled(FALSE); 91 sixteenBitCheckBox->setEnabled(false);
89#else 92#else
90#endif 93#endif
91 int sRate=cfg.readNumEntry("SizeLimit", 30); 94 int sRate=cfg.readNumEntry("SizeLimit", 30);
92 odebug << "" << sRate << "" << oendl; 95 odebug << "" << sRate << "" << oendl;
93 96
94 if(sRate ==30) 97 if(sRate == 30)
95 timeLimitComboBox->setCurrentItem(0); 98 timeLimitComboBox->setCurrentItem(0);
96 else if(sRate==20) 99 else if(sRate == 20)
97 timeLimitComboBox->setCurrentItem(1); 100 timeLimitComboBox->setCurrentItem(1);
98 else if(sRate == 15) 101 else if(sRate == 15)
99 timeLimitComboBox->setCurrentItem(2); 102 timeLimitComboBox->setCurrentItem(2);
@@ -107,7 +110,8 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
107 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); 110 sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
108 111
109 cfg.setGroup("Defaults"); 112 cfg.setGroup("Defaults");
110 keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); 113 recordKey = cfg.readNumEntry("toggleKey");
114 keyComboBox->setCurrentItem( recordKey);
111 115
112 updateStorageCombo(); 116 updateStorageCombo();
113 117
@@ -115,16 +119,11 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
115 vmCfg.setGroup("Defaults"); 119 vmCfg.setGroup("Defaults");
116 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); 120 adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0));
117 121
118 connect( LocationComboBox,SIGNAL(activated(const QString&)), this, 122 connect(LocationComboBox,SIGNAL(activated(const QString&)),this,SLOT(setLocation(const QString&)));
119 SLOT( setLocation(const QString&))); 123 connect(keyComboBox,SIGNAL(activated(int)),this,SLOT(setKeyButton(int)));
120 connect( keyComboBox,SIGNAL(activated(int)), this, 124 connect(timeLimitComboBox,SIGNAL(activated(const QString&)),this,SLOT(setSizeLimitButton(const QString&)));
121 SLOT( setKeyButton(int))); 125 connect(restartCheckBox,SIGNAL( toggled(bool)),this,SLOT(restartOpie(bool)));
122 connect( timeLimitComboBox,SIGNAL(activated(const QString&)), this, 126 connect(adpcmCheckBox,SIGNAL( toggled(bool)),this,SLOT(slotAdpcm(bool)));
123 SLOT( setSizeLimitButton(const QString&)));
124 connect( restartCheckBox,SIGNAL( toggled(bool)), this,
125 SLOT( restartOpie(bool)));
126 connect( adpcmCheckBox,SIGNAL( toggled(bool)), this,
127 SLOT( slotAdpcm(bool)));
128 127
129 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 128 // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
130} 129}
@@ -134,8 +133,8 @@ void SoundSettings::updateStorageCombo() {
134 Config config( "Vmemo" ); 133 Config config( "Vmemo" );
135 config.setGroup( "System" ); 134 config.setGroup( "System" );
136 QString loc = config.readEntry("RecLocation","/"); 135 QString loc = config.readEntry("RecLocation","/");
137 int i=0; 136 int i = 0;
138 int set=0; 137 int set = 0;
139 StorageInfo storageInfo; 138 StorageInfo storageInfo;
140 QString sName, sPath; 139 QString sName, sPath;
141 QStringList list; 140 QStringList list;
@@ -149,7 +148,7 @@ void SoundSettings::updateStorageCombo() {
149 const QString path = (*it)->path(); 148 const QString path = (*it)->path();
150 odebug << "storage name "+name +" storage path is "+path << oendl; 149 odebug << "storage name "+name +" storage path is "+path << oendl;
151 list << name + ": " +path; 150 list << name + ": " +path;
152 if( loc.find( path,0,TRUE) != -1) 151 if( loc.find( path,0,true) != -1)
153 set = i; 152 set = i;
154// if(dit.current()->file().find(path) != -1 ) storage=name; 153// if(dit.current()->file().find(path) != -1 ) storage=name;
155 i++; 154 i++;
@@ -168,7 +167,14 @@ void SoundSettings::setLocation(const QString & string) {
168 config.write(); 167 config.write();
169} 168}
170 169
170 void SoundSettings::accept() {
171 cleanUp();
172 qApp->quit();
173}
174
175
171void SoundSettings::cleanUp() { 176void SoundSettings::cleanUp() {
177
172 Config cfg("Vmemo"); 178 Config cfg("Vmemo");
173 cfg.writeEntry("Alert",AlertCheckBox->isChecked()); 179 cfg.writeEntry("Alert",AlertCheckBox->isChecked());
174 180
@@ -179,22 +185,27 @@ void SoundSettings::cleanUp() {
179 if(keyReset && noWarning) { 185 if(keyReset && noWarning) {
180 QCopEnvelope ("QPE/System", "restart()"); 186 QCopEnvelope ("QPE/System", "restart()");
181 } 187 }
188 cfg.setGroup("Defaults");
189 cfg.writeEntry( "toggleKey", recordKey);
190 if( recordKey == 1) {
191 cfg.writeEntry( "hideIcon", 0 );
192 }
193 else {
194 cfg.writeEntry( "hideIcon", 1);
195 }
196 cfg.write();
182} 197}
183 198
184void SoundSettings::setKeyButton( int index) { 199void SoundSettings::setKeyButton( int index) {
185 Config cfg("Vmemo"); 200 recordKey = index;
186 cfg.setGroup("Defaults"); 201 restartCheckBox->setChecked(true);
187 cfg.writeEntry( "toggleKey", index ); 202 keyReset = true;
188 keyReset = TRUE;
189 if( index == 1) { 203 if( index == 1) {
190 cfg.writeEntry( "hideIcon", 0 );
191 keyLabel->setText(tr("Shows icon")); 204 keyLabel->setText(tr("Shows icon"));
192 } 205 }
193 else { 206 else {
194 cfg.writeEntry( "hideIcon", 1);
195 keyLabel->setText(tr("Hides icon")); 207 keyLabel->setText(tr("Hides icon"));
196 } 208 }
197 cfg.write();
198} 209}
199 210
200void SoundSettings::updateLocationCombo() { 211void SoundSettings::updateLocationCombo() {
@@ -205,7 +216,7 @@ void SoundSettings::setSizeLimitButton(const QString &index) {
205 216
206 Config cfg("Vmemo"); 217 Config cfg("Vmemo");
207 cfg.setGroup("Record"); 218 cfg.setGroup("Record");
208 if(index.find("Unlimited",0,TRUE) != -1) 219 if(index.find("Unlimited",0,true) != -1)
209 cfg.writeEntry("SizeLimit", -1); 220 cfg.writeEntry("SizeLimit", -1);
210 else 221 else
211 cfg.writeEntry("SizeLimit", index); 222 cfg.writeEntry("SizeLimit", index);
diff --git a/noncore/settings/sound/soundsettings.h b/noncore/settings/sound/soundsettings.h
index 57a360f..9db664a 100644
--- a/noncore/settings/sound/soundsettings.h
+++ b/noncore/settings/sound/soundsettings.h
@@ -31,15 +31,18 @@ Q_OBJECT
31public: 31public:
32 static QString appName() { return QString::fromLatin1("sound"); } 32 static QString appName() { return QString::fromLatin1("sound"); }
33 SoundSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 33 SoundSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
34// ~SoundSettings();
34 35
35protected: 36protected:
36 bool noWarning; 37 int recordKey, hideIt;
37/* void accept(); */ 38 bool noWarning;
39 void accept();
38/* void reject(); */ 40/* void reject(); */
39 void updateStorageCombo(); 41 void updateStorageCombo();
40 void updateLocationCombo(); 42 void updateLocationCombo();
41 43
42private slots: 44private slots:
45//void closeEvent(QCloseEvent * );
43 void setKeyButton( int); 46 void setKeyButton( int);
44 void setSizeLimitButton(const QString &); 47 void setSizeLimitButton(const QString &);
45 void setLocation(const QString &); 48 void setLocation(const QString &);
diff --git a/noncore/settings/sound/soundsettingsbase.cpp b/noncore/settings/sound/soundsettingsbase.cpp
index 84187d2..2d894c6 100644
--- a/noncore/settings/sound/soundsettingsbase.cpp
+++ b/noncore/settings/sound/soundsettingsbase.cpp
@@ -68,7 +68,8 @@ static const char* const image1_data[] = {
68 * TRUE to construct a modal dialog. 68 * TRUE to construct a modal dialog.
69 */ 69 */
70SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool modal, WFlags fl ) 70SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool modal, WFlags fl )
71 : QMainWindow( parent, name, fl ) 71 : QDialog( parent, name, fl )
72// : QMainWindow( parent, name, fl )
72{ 73{
73 QPixmap image0( ( const char** ) image0_data ); 74 QPixmap image0( ( const char** ) image0_data );
74 QPixmap image1( ( const char** ) image1_data ); 75 QPixmap image1( ( const char** ) image1_data );
diff --git a/noncore/settings/sound/soundsettingsbase.h b/noncore/settings/sound/soundsettingsbase.h
index 48c31e8..0234925 100644
--- a/noncore/settings/sound/soundsettingsbase.h
+++ b/noncore/settings/sound/soundsettingsbase.h
@@ -11,7 +11,7 @@
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qdialog.h> 13#include <qdialog.h>
14#include <qmainwindow.h> 14//#include <qmainwindow.h>
15 15
16class QVBoxLayout; 16class QVBoxLayout;
17class QHBoxLayout; 17class QHBoxLayout;
@@ -22,7 +22,8 @@ class QGroupBox;
22class QLabel; 22class QLabel;
23class QSlider; 23class QSlider;
24 24
25class SoundSettingsBase : public QMainWindow 25class SoundSettingsBase : public QDialog
26//class SoundSettingsBase : public QMainWindow
26{ 27{
27 Q_OBJECT 28 Q_OBJECT
28 29