diff options
-rw-r--r-- | src/mumble/ALSAAudio.cpp | 26 | ||||
-rw-r--r-- | src/mumble/ALSAAudio.h | 10 | ||||
-rw-r--r-- | src/mumble/GlobalShortcut_unix.cpp | 22 | ||||
-rw-r--r-- | src/mumble/GlobalShortcut_unix.h | 5 |
4 files changed, 43 insertions, 20 deletions
diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp index da5b74d9a..c8bdfa9a7 100644 --- a/src/mumble/ALSAAudio.cpp +++ b/src/mumble/ALSAAudio.cpp @@ -112,8 +112,8 @@ void ALSAAudioOutputRegistrar::setDeviceChoice(const QVariant &choice) { g.s.qsALSAOutput = choice.toString(); } -static ConfigWidget *ALSAConfigDialogNew() { - return new ALSAConfig(); +static ConfigWidget *ALSAConfigDialogNew(Settings &st) { + return new ALSAConfig(st); } static ConfigRegistrar registrar(20, ALSAConfigDialogNew); @@ -177,7 +177,7 @@ ALSAEnumerator::ALSAEnumerator() { } } -ALSAConfig::ALSAConfig(QWidget *p) : ConfigWidget(p) { +ALSAConfig::ALSAConfig(Settings &st) : ConfigWidget(st) { setupUi(this); QList<QString> qlOutputDevs = cards.qhOutput.keys(); @@ -228,12 +228,30 @@ QIcon ALSAConfig::icon() const { return QIcon(QLatin1String("skin:config_dsound.png")); } -void ALSAConfig::accept() { +void ALSAConfig::save() const { s.iDXOutputDelay = qsOutputDelay->value(); s.qsALSAInput = qcbInputDevice->itemData(qcbInputDevice->currentIndex()).toString(); s.qsALSAOutput = qcbOutputDevice->itemData(qcbOutputDevice->currentIndex()).toString(); } +void ALSAConfig::load(const Settings &r) { + for(int i=0;i<qcbInputDevice->count();i++) { + if (qcbInputDevice->itemData(i).toString() == r.qsALSAInput) { + qcbInputDevice->setCurrentIndex(i); + break; + } + } + + for(int i=0;i<qcbOutputDevice->count();i++) { + if (qcbOutputDevice->itemData(i).toString() == r.qsALSAOutput) { + qcbOutputDevice->setCurrentIndex(i); + break; + } + } + + qsOutputDelay->setValue(r.iDXOutputDelay); +} + void ALSAConfig::on_qsOutputDelay_valueChanged(int v) { qlOutputDelay->setText(tr("%1ms").arg(v*20)); } diff --git a/src/mumble/ALSAAudio.h b/src/mumble/ALSAAudio.h index cc428f765..90c0275a7 100644 --- a/src/mumble/ALSAAudio.h +++ b/src/mumble/ALSAAudio.h @@ -41,17 +41,13 @@ class ALSAAudioInput; class ALSAConfig : public ConfigWidget, public Ui::ALSAConfig { Q_OBJECT - protected: - QComboBox *qcbInputDevice; - QComboBox *qcbOutputDevice; - QSlider *qsOutputDelay; - QLabel *qlOutputDelay; public: - ALSAConfig(QWidget *p = NULL); + ALSAConfig(Settings &st); virtual QString title() const; virtual QIcon icon() const; public slots: - void accept(); + void save() const; + void load(const Settings &r); void on_qsOutputDelay_valueChanged(int v); }; diff --git a/src/mumble/GlobalShortcut_unix.cpp b/src/mumble/GlobalShortcut_unix.cpp index b57b76fc1..b3fae9e36 100644 --- a/src/mumble/GlobalShortcut_unix.cpp +++ b/src/mumble/GlobalShortcut_unix.cpp @@ -41,8 +41,8 @@ #endif static GlobalShortcutX *gsx = NULL; -static ConfigWidget *GlobalShortcutXConfigDialogNew() { - return new GlobalShortcutXConfig(); +static ConfigWidget *GlobalShortcutXConfigDialogNew(Settings &st) { + return new GlobalShortcutXConfig(st); } static ConfigRegistrar registrar(55, GlobalShortcutXConfigDialogNew); @@ -122,7 +122,7 @@ void XInputKeyWidget::displayKeys() { setText(sl.join(QLatin1String(" "))); } -GlobalShortcutXConfig::GlobalShortcutXConfig(QWidget *p) : ConfigWidget(p) { +GlobalShortcutXConfig::GlobalShortcutXConfig(Settings &st) : ConfigWidget(st) { QGroupBox *qgbShortcuts = new QGroupBox(tr("Shortcuts")); QLabel *lab; @@ -169,20 +169,28 @@ QIcon GlobalShortcutXConfig::icon() const { return QIcon(QLatin1String("skin:config_shortcuts.png")); } -void GlobalShortcutXConfig::accept() { +void GlobalShortcutXConfig::save() const { + Settings::ShortcutMap m; + //TODO +/* foreach(GlobalShortcut *gs, gsx->qmShortcuts) { XInputKeyWidget *dikw = qhKeys[gs]; if (dikw->bModified) { QString base=QString::fromLatin1("GS%1_").arg(gs->idx); - g.qs->setValue(base + QLatin1String("num"), dikw->qlButtons.count()); + s.qs->setValue(base + QLatin1String("num"), dikw->qlButtons.count()); int i=0; foreach(int bt, dikw->qlButtons) { - g.qs->setValue(base + QString::fromLatin1("%1_Key").arg(i), bt); + s.qs->setValue(base + QString::fromLatin1("%1_Key").arg(i), bt); i++; } } } - gsx->bNeedRemap = true; + gsx->bNeedRemap = true;*/ +} + + +void GlobalShortcutXConfig::load(const Settings &r) { + //TODO } GlobalShortcutX::GlobalShortcutX() { diff --git a/src/mumble/GlobalShortcut_unix.h b/src/mumble/GlobalShortcut_unix.h index 05a977412..83a867558 100644 --- a/src/mumble/GlobalShortcut_unix.h +++ b/src/mumble/GlobalShortcut_unix.h @@ -61,11 +61,12 @@ class GlobalShortcutXConfig : public ConfigWidget { protected: QHash<GlobalShortcut *,XInputKeyWidget *> qhKeys; public: - GlobalShortcutXConfig(QWidget *p = NULL); + GlobalShortcutXConfig(Settings &st); virtual QString title() const; virtual QIcon icon() const; public slots: - void accept(); + void save() const; + void load(const Settings &r); }; #define NUM_BUTTONS 0x2ff |