summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-05-26 23:20:26 (UTC)
committer llornkcor <llornkcor>2002-05-26 23:20:26 (UTC)
commitf0d0d53759436686f7f15fcd55a6706b1ecaa1cc (patch) (side-by-side diff)
treee40e731fecf6c629799e6d264c47dc05528f21da /noncore
parent845ed24db904e0842f1557e185174c52d3d93092 (diff)
downloadopie-f0d0d53759436686f7f15fcd55a6706b1ecaa1cc.zip
opie-f0d0d53759436686f7f15fcd55a6706b1ecaa1cc.tar.gz
opie-f0d0d53759436686f7f15fcd55a6706b1ecaa1cc.tar.bz2
fixed location not remembering setting. added record key combo
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sound/soundsettings.cpp39
-rw-r--r--noncore/settings/sound/soundsettings.h2
-rw-r--r--noncore/settings/sound/soundsettingsbase.cpp30
-rw-r--r--noncore/settings/sound/soundsettingsbase.h3
4 files changed, 66 insertions, 8 deletions
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 40b8b87..f417b79 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -14,80 +14,87 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "soundsettings.h"
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/storage.h>
#include <qapplication.h>
#include <qslider.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl )
: SoundSettingsBase( parent, name, TRUE, fl )
{
+ keyReset=FALSE;
+
Config config( "qpe");
config.setGroup( "Volume" );
volume->setValue(100-config.readNumEntry("VolumePercent"));
mic->setValue(100-config.readNumEntry("Mic"));
// touchsound->setChecked(config.readBoolEntry("TouchSound"));
// keysound->setChecked(config.readBoolEntry("KeySound"));
Config cfg("Vmemo");
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
AlertCheckBox->setChecked(cfg.readBoolEntry("Alert"));
cfg.setGroup("Record");
int rate=config.readNumEntry("SampleRate", 22050);
if(rate == 8000)
sampleRate->setCurrentItem(0);
else if(rate == 11025)
sampleRate->setCurrentItem(1);
else if(rate == 22050)
sampleRate->setCurrentItem(2);
else if(rate == 33075)
sampleRate->setCurrentItem(3);
else if(rate==44100)
sampleRate->setCurrentItem(4);
stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
+ cfg.setGroup("Defaults");
+ keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
+
updateStorageCombo();
+
connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int)));
connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
connect(qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) );
connect( LocationComboBox,SIGNAL(activated(const QString &)),this,SLOT( setLocation(const QString &)));
+ connect( keyComboBox,SIGNAL(activated(const QString &)),this,SLOT(setKeyButton(const QString &)));
// connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
}
// void SoundSettings::reject()
// {
// qDebug("reject");
// Config config( "qpe");
// config.setGroup( "Volume");
// setVolume(100-config.readNumEntry("VolumePercent"));
// setMic(100-config.readNumEntry("Mic"));
// // config.setGroup("Record");
// // int rate=config.readNumEntry("SampleRate", 11025);
// // if(rate == 11025)
// // sampleRate->setCurrentItem(0);
// // else if(rate == 22050)
// // sampleRate->setCurrentItem(1);
// // else if(rate == 32000)
// // sampleRate->setCurrentItem(2);
// // else if(rate==44100)
// // sampleRate->setCurrentItem(3);
// // stereoCheckBox->setChecked(config.readNumEntry("Stereo", 0));
// // sixteenBitCheckBox->setChecked(config.readNumEntry("SixteenBit", 0));
@@ -136,65 +143,91 @@ void SoundSettings::setMic(int m)
Config config( "qpe" );
config.setGroup( "Volume" );
config.writeEntry("Mic",100-m);
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
QCopEnvelope( "QPE/System", "micChange(bool)" ) << FALSE;
#endif
}
void SoundSettings::volumeChanged( bool )
{
Config config( "qpe" );
config.setGroup( "Volume" );
volume->setValue(100-config.readNumEntry("VolumePercent"));
}
void SoundSettings::micChanged( bool )
{
Config config( "qpe" );
config.setGroup( "Volume" );
mic->setValue(100-config.readNumEntry("Mic"));
}
void SoundSettings::updateStorageCombo() {
+ Config config( "Vmemo" );
+ config.setGroup( "System" );
+ QString loc = config.readEntry("RecLocation","/");
+int i=0;
+int set=0;
StorageInfo storageInfo;
QString sName, sPath;
QStringList list;
const QList<FileSystem> &fs = storageInfo.fileSystems();
QListIterator<FileSystem> it ( fs );
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
qDebug("storage name "+name +" storage path is "+path);
list << name + ": " +path;
+ if( loc.find( path,0,TRUE) != -1)
+ set = i;
// if(dit.current()->file().find(path) != -1 ) storage=name;
+ i++;
}
LocationComboBox->insertStringList(list);
+ qDebug("set item %d", set);
+ LocationComboBox->setCurrentItem(set);
}
void SoundSettings::setLocation(const QString & string) {
Config config( "Vmemo" );
config.setGroup( "System" );
config.writeEntry("RecLocation",string);
-
+ qDebug("set location "+string);
+ config.write();
}
void SoundSettings::cleanUp() {
- qDebug("cleanup");
- Config config( "qpe" );
+ qDebug("cleanup");
+ Config config( "qpe" );
config.setGroup( "Volume" );
config.writeEntry("VolumePercent",100-volume->value());
config.writeEntry("Mic",100-mic->value());
// config.writeEntry("TouchSound",touchsound->isChecked());
// config.writeEntry("KeySound",keysound->isChecked());
Config cfg("Vmemo");
cfg.writeEntry("Alert",AlertCheckBox->isChecked());
setVolume(volume->value());
setMic(mic->value());
cfg.setGroup("Record");
cfg.writeEntry("SampleRate",sampleRate->currentText());
cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
+
+ if(keyReset) QCopEnvelope ("QPE/System", "restart()");
+
+}
+
+void SoundSettings::setKeyButton(const QString &name) {
+ Config cfg("Vmemo");
+ cfg.setGroup("Defaults");
+ cfg.writeEntry( "toggleKey", keyComboBox->currentItem() );
+ keyReset = TRUE;
+ cfg.write();
+}
+
+void SoundSettings::updateLocationCombo() {
+
}
diff --git a/noncore/settings/sound/soundsettings.h b/noncore/settings/sound/soundsettings.h
index cbec724..0676e12 100644
--- a/noncore/settings/sound/soundsettings.h
+++ b/noncore/settings/sound/soundsettings.h
@@ -14,38 +14,40 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef SOUNDSETTINGS_H
#define SOUNDSETTINGS_H
#include "soundsettingsbase.h"
class SoundSettings : public SoundSettingsBase
{
Q_OBJECT
public:
SoundSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
protected:
/* void accept(); */
/* void reject(); */
void updateStorageCombo();
+ void updateLocationCombo();
private slots:
+ void setKeyButton(const QString &);
void setLocation(const QString &);
void cleanUp();
void setVolume(int);
void setMic(int);
void volumeChanged( bool muted );
void micChanged( bool muted );
};
#endif // SOUNDSETTINGS_H
diff --git a/noncore/settings/sound/soundsettingsbase.cpp b/noncore/settings/sound/soundsettingsbase.cpp
index 727d202..6cb4f89 100644
--- a/noncore/settings/sound/soundsettingsbase.cpp
+++ b/noncore/settings/sound/soundsettingsbase.cpp
@@ -205,51 +205,73 @@ SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool m
Layout11->addWidget( sampleRateLabel );
sampleRate = new QComboBox( FALSE, privateLayoutWidget, "sampleRate" );
sampleRate->insertItem( tr( "8000" ) );
sampleRate->insertItem( tr( "11025" ) );
sampleRate->insertItem( tr( "22050" ) );
sampleRate->insertItem( tr( "33075" ) );
sampleRate->insertItem( tr( "44100" ) );
sampleRate->setFixedWidth(90);
Layout11->addWidget( sampleRate );
stereoCheckBox = new QCheckBox( privateLayoutWidget, "stereoCheckBox" );
stereoCheckBox->setText( tr( "Stereo" ) );
Layout11->addWidget( stereoCheckBox );
sixteenBitCheckBox = new QCheckBox( privateLayoutWidget, "sixteenBitCheckBox" );
sixteenBitCheckBox->setText( tr( "16 bit" ) );
Layout11->addWidget( sixteenBitCheckBox );
AlertCheckBox = new QCheckBox( privateLayoutWidget, "AlertCheckBox" );
AlertCheckBox->setText( tr( "Visual Alerts" ) );
Layout11->addWidget( AlertCheckBox );
TextLabel1 = new QLabel( privateLayoutWidget, "TextLabel1" );
- TextLabel1->setText( tr( "Location" ) );
+ TextLabel1->setText( tr( "Location:" ) );
Layout11->addWidget( TextLabel1 );
+
LocationComboBox = new QComboBox( FALSE, privateLayoutWidget, "LocationComboBox" );
Layout11->addWidget( LocationComboBox );
- Layout12_2->addWidget( GroupBox1 );
+ QLabel *TextLabelKey;
+ TextLabelKey = new QLabel( privateLayoutWidget, "TextLabelKey" );
+ TextLabelKey->setText( tr( "Record Key:" ) );
+
+ keyComboBox = new QComboBox( FALSE, privateLayoutWidget, "keyComboBox" );
+ keyComboBox->insertItem( tr( "" ) );
+ keyComboBox->insertItem( tr( "Taskbar Icon" ) );
+ keyComboBox->insertItem( tr( "Key_Escape" ) );
+ keyComboBox->insertItem( tr( "Key_Space" ) );
+ keyComboBox->insertItem( tr( "Key_Home" ) );
+ keyComboBox->insertItem( tr( "Key_Calender" ) );
+ keyComboBox->insertItem( tr( "Key_Contacts" ) );
+ keyComboBox->insertItem( tr( "Key_Menu" ) );
+ keyComboBox->insertItem( tr( "Key_Mail" ) );
+
+ Layout11->addWidget( TextLabelKey );
+
+ Layout11->addWidget( keyComboBox );
+
+ QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ Layout11->addItem( spacer_9 );
+
+
+ Layout12_2->addWidget( GroupBox1 );
// // touchsound = new QCheckBox( this, "touchsound" );
// // touchsound->setText( tr( "Screen sounds" ) );
// // Layout12_2->addWidget( touchsound );
// // keysound = new QCheckBox( this, "keysound" );
// // keysound->setText( tr( "Keyboard sounds" ) );
// // Layout12_2->addWidget( keysound );
- QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
- Layout12_2->addItem( spacer_9 );
SoundSettingsBaseLayout->addLayout( Layout12_2, 0, 1 );
}
/*
* Destroys the object and frees any allocated resources
*/
SoundSettingsBase::~SoundSettingsBase()
{
// no need to delete child widgets, Qt does it all for us
}
diff --git a/noncore/settings/sound/soundsettingsbase.h b/noncore/settings/sound/soundsettingsbase.h
index 7a939ea..20d1c2c 100644
--- a/noncore/settings/sound/soundsettingsbase.h
+++ b/noncore/settings/sound/soundsettingsbase.h
@@ -26,40 +26,41 @@ class SoundSettingsBase : public QMainWindow
{
Q_OBJECT
public:
SoundSettingsBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SoundSettingsBase();
QGroupBox* GroupBox3;
QLabel* PixmapLabel1_2;
QLabel* TextLabel1_2;
QLabel* volLabel;
QLabel* micLabel;
QSlider* volume;
QSlider* mic;
QLabel* PixmapLabel2_2;
QLabel* TextLabel2_2;
QGroupBox* GroupBox1;
QLabel* sampleRateLabel;
QComboBox* sampleRate;
QCheckBox* stereoCheckBox;
QCheckBox* sixteenBitCheckBox;
QCheckBox* AlertCheckBox;
QLabel* TextLabel1;
QComboBox* LocationComboBox;
-
+ QComboBox* keyComboBox;
+ bool keyReset;
protected:
QGridLayout* SoundSettingsBaseLayout;
QVBoxLayout* GroupBox3Layout;
QVBoxLayout* Layout10;
QHBoxLayout* Layout16;
QHBoxLayout* Layout13;
QHBoxLayout* Layout12;
QHBoxLayout* Layout17;
QVBoxLayout* Layout12_2;
QVBoxLayout* Layout11;
protected slots:
};
#endif // SOUNDSETTINGSBASE_H