From 99db59d9dcfc57659877e0ddba859fad79557138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Burdukiewicz?= Date: Wed, 25 Aug 2010 16:19:54 +0000 Subject: [PATCH] Some options in wiimotedev settings page now works --- src/translations/ar.po | 3 ++ src/translations/bg.po | 3 ++ src/translations/ca.po | 3 ++ src/translations/cs.po | 3 ++ src/translations/da.po | 3 ++ src/translations/de.po | 3 ++ src/translations/el.po | 3 ++ src/translations/en_CA.po | 3 ++ src/translations/en_GB.po | 3 ++ src/translations/es.po | 3 ++ src/translations/fi.po | 3 ++ src/translations/fr.po | 3 ++ src/translations/gl.po | 3 ++ src/translations/hu.po | 3 ++ src/translations/it.po | 3 ++ src/translations/kk.po | 3 ++ src/translations/lt.po | 3 ++ src/translations/nb.po | 3 ++ src/translations/nl.po | 3 ++ src/translations/oc.po | 3 ++ src/translations/pl.po | 3 ++ src/translations/pt.po | 3 ++ src/translations/pt_BR.po | 3 ++ src/translations/ro.po | 3 ++ src/translations/ru.po | 3 ++ src/translations/sk.po | 3 ++ src/translations/sl.po | 3 ++ src/translations/sr.po | 3 ++ src/translations/sv.po | 3 ++ src/translations/tr.po | 3 ++ src/translations/translations.pot | 3 ++ src/translations/uk.po | 3 ++ src/translations/zh_CN.po | 3 ++ src/translations/zh_TW.po | 3 ++ src/ui/mainwindow.cpp | 11 +++-- src/ui/settingsdialog.cpp | 22 +++++++--- src/ui/wiimotedevshortcutsconfig.cpp | 18 ++++++++- src/ui/wiimotedevshortcutsconfig.h | 15 ++++--- src/ui/wiimotedevshortcutsconfig.ui | 48 +++++++++++++++++++++- src/wiimotedev/shortcuts.cpp | 60 +++++++++++++++------------- src/wiimotedev/shortcuts.h | 2 + 41 files changed, 233 insertions(+), 45 deletions(-) diff --git a/src/translations/ar.po b/src/translations/ar.po index 22a5c563a..e30f7a626 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -1726,6 +1726,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/bg.po b/src/translations/bg.po index 634288e5e..f321f6d2f 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -1726,6 +1726,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/ca.po b/src/translations/ca.po index dff58a6d8..eea968682 100644 --- a/src/translations/ca.po +++ b/src/translations/ca.po @@ -1747,6 +1747,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/cs.po b/src/translations/cs.po index d83bc1dd5..1b59c34fc 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -1730,6 +1730,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/da.po b/src/translations/da.po index bc8312806..9e2568e9e 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -1733,6 +1733,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/de.po b/src/translations/de.po index f3b320e36..c664a3403 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -1752,6 +1752,9 @@ msgstr "Gnome Tastenkürzel verwenden" msgid "Use Replay Gain metadata if it is available" msgstr "Benutze Replay Gain Metadaten wenn verfügbar" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/el.po b/src/translations/el.po index fa7ca8b41..a38d3b0aa 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -1756,6 +1756,9 @@ msgstr "Χρήση πλήκτρων συντόμευσης του Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Χρήση των μετα δεδομένων Replay Gain αν είναι διαθέσημα" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index 666b3eb68..a37750d13 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -1731,6 +1731,9 @@ msgstr "Use Gnome's shortcut keys" msgid "Use Replay Gain metadata if it is available" msgstr "Use Replay Gain metadata if it is available" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index 5d7694d79..bef927c03 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -1728,6 +1728,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/es.po b/src/translations/es.po index 3ee5b07ea..a264d7009 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -1755,6 +1755,9 @@ msgstr "Usar las combinaciones de teclas de Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar metadatos de ganancia de repetición si están disponibles" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/fi.po b/src/translations/fi.po index 406fdd3ee..294e3f01b 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -1728,6 +1728,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index 1d76389b8..7af9a05c8 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -1742,6 +1742,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/gl.po b/src/translations/gl.po index 7f20f58bf..1e8627da3 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -1728,6 +1728,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/hu.po b/src/translations/hu.po index 47fada5d7..a0c37ae60 100644 --- a/src/translations/hu.po +++ b/src/translations/hu.po @@ -1747,6 +1747,9 @@ msgstr "Gnome gyorsbillentyűk használata" msgid "Use Replay Gain metadata if it is available" msgstr "Replay Gain adatok használata, ha elérhetőek" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/it.po b/src/translations/it.po index e47f6bd67..f0045e71f 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -1765,6 +1765,9 @@ msgstr "Utilizza le scorciatoie di Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Utilizza i metadati del guadagno di riproduzione se disponibili" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/kk.po b/src/translations/kk.po index a15b51059..4a4a7939d 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -1728,6 +1728,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/lt.po b/src/translations/lt.po index 934523ea7..9b733d557 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -1726,6 +1726,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index e45ec377e..01031faa4 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -1730,6 +1730,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/nl.po b/src/translations/nl.po index 29ac7b534..3bb811bf4 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -1753,6 +1753,9 @@ msgstr "Gebruik Gnome's sneltoetsen" msgid "Use Replay Gain metadata if it is available" msgstr "Gebruik Replay Gain metadata indien beschikbaar" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/oc.po b/src/translations/oc.po index 021a41307..0e076e66e 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -1726,6 +1726,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index 2da4e7ec7..8b1446946 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -1739,6 +1739,9 @@ msgstr "Używaj skrótów klawiaturowych Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Używaj metadanych Replay Gain, jeśli są dostępne" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/pt.po b/src/translations/pt.po index 2765ff01b..1fc35a1bd 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -1748,6 +1748,9 @@ msgstr "Usar teclas de atalho Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar Consistência de meta-dados se estiver disponível" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index e659a47a4..c96c186c6 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -1739,6 +1739,9 @@ msgstr "Usar teclas de atalho do Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Usar metadados do fator de ganho se ele estiver disponível" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/ro.po b/src/translations/ro.po index 012efff6c..4d1eb6739 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -1727,6 +1727,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index 3e0bc7e13..fbedfc8b1 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -1744,6 +1744,9 @@ msgstr "Использовать горячие клавиши Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Использовать метаданные Replay Gain если возможно" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/sk.po b/src/translations/sk.po index c1aa71e35..f5dc463a1 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -1746,6 +1746,9 @@ msgstr "Použiť klávesové skratky GNOME" msgid "Use Replay Gain metadata if it is available" msgstr "Použiť metadáta na vyrovnanie hlasitosti ak sú dostupné" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/sl.po b/src/translations/sl.po index 2edbf1433..001457cc4 100644 --- a/src/translations/sl.po +++ b/src/translations/sl.po @@ -1745,6 +1745,9 @@ msgstr "Uporabi Gnome bližnjice" msgid "Use Replay Gain metadata if it is available" msgstr "Uporabi Replay Gain metapodatke, če je možno" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/sr.po b/src/translations/sr.po index 2a8fc77f0..0b8c17714 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -1731,6 +1731,9 @@ msgstr "Користи Гномове пречице" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/sv.po b/src/translations/sv.po index dacdd8300..4379bfb96 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -1744,6 +1744,9 @@ msgid "Use Replay Gain metadata if it is available" msgstr "" "Använd metadata för uppspelningsförstärkning om de de finns tillgängliga." +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/tr.po b/src/translations/tr.po index f118189a3..495480dab 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -1732,6 +1732,9 @@ msgstr "Gnome kısayol tuşlarını kullan" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 82a53e868..1dfbe632c 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -1716,6 +1716,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/uk.po b/src/translations/uk.po index 882591037..daeea5006 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -1743,6 +1743,9 @@ msgstr "Використовувати комбінації клавіш Gnome" msgid "Use Replay Gain metadata if it is available" msgstr "Використовувати метадані Replay Gain, якщо наявні" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index e9b9a70c8..ac5f02494 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -1726,6 +1726,9 @@ msgstr "" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 02e5acd75..f29148dda 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -1731,6 +1731,9 @@ msgstr "使用Gnome的快速鍵" msgid "Use Replay Gain metadata if it is available" msgstr "" +msgid "Use Wii remote id" +msgstr "" + msgid "Use notifications to report Wii remote status" msgstr "" diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 0cb08d644..472d8d966 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -473,6 +473,10 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg ui_->action_about->setMenuRole(QAction::AboutRole); #endif +#ifdef ENABLE_WIIMOTEDEV + wiimotedev_shortcuts_ = new WiimotedevShortcuts(player_, this); +#endif + // Global shortcuts connect(global_shortcuts_, SIGNAL(Play()), player_, SLOT(Play())); connect(global_shortcuts_, SIGNAL(Pause()), player_, SLOT(Pause())); @@ -497,6 +501,9 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg connect(settings_dialog_.get(), SIGNAL(accepted()), osd_, SLOT(ReloadSettings())); connect(settings_dialog_.get(), SIGNAL(accepted()), ui_->library_view, SLOT(ReloadSettings())); connect(settings_dialog_.get(), SIGNAL(accepted()), player_->GetEngine(), SLOT(ReloadSettings())); +#ifdef ENABLE_WIIMOTEDEV + connect(settings_dialog_.get(), SIGNAL(accepted()), wiimotedev_shortcuts_, SLOT(ReloadSettings())); +#endif // Add stream dialog connect(add_stream_dialog_.get(), SIGNAL(accepted()), SLOT(AddStreamAccepted())); @@ -577,10 +584,6 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg library_->Init(); library_->StartThreads(); - -#ifdef ENABLE_WIIMOTEDEV - wiimotedev_shortcuts_ = new WiimotedevShortcuts(player_, this); -#endif } MainWindow::~MainWindow() { diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index afec2e2b3..d23fa2b87 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -25,6 +25,8 @@ #ifdef ENABLE_WIIMOTEDEV #include "ui/wiimotedevshortcutsconfig.h" +#include "ui_wiimotedevshortcutsconfig.h" +#include "wiimotedev/shortcuts.h" #endif #ifdef HAVE_GSTREAMER @@ -58,13 +60,13 @@ SettingsDialog::SettingsDialog(QWidget* parent) ui_->list->addItem("Wiimotedev"); ui_->list->item(Page_Wiimotedev)->setIcon(QIcon(":/icons/32x32/wiimotedev.png")); - QWidget *wiimotedev_page = new QWidget(this); + QWidget* wiimotedev_page = new QWidget(this); wiimotedev_page->setObjectName(QString::fromUtf8("wiimotedev_page")); - QVBoxLayout *wiimotedev_layout = new QVBoxLayout(wiimotedev_page); + QVBoxLayout* wiimotedev_layout = new QVBoxLayout(wiimotedev_page); wiimotedev_layout->setObjectName(QString::fromUtf8("wiimotedev_layout")); - WiimotedevShortcutsConfig *wiimotedev_config = new WiimotedevShortcutsConfig(wiimotedev_page); - wiimotedev_config->setObjectName(QString::fromUtf8("wiimotedev_config")); - wiimotedev_layout->addWidget(wiimotedev_config); + wiimotedev_config_ = new WiimotedevShortcutsConfig(wiimotedev_page); + wiimotedev_config_->setObjectName(QString::fromUtf8("wiimotedev_config")); + wiimotedev_layout->addWidget(wiimotedev_config_); ui_->stacked_widget->addWidget(wiimotedev_page); #endif @@ -221,6 +223,16 @@ void SettingsDialog::accept() { s.endGroup(); #endif +#ifdef ENABLE_WIIMOTEDEV + s.beginGroup(WiimotedevShortcuts::kSettingsGroup); + s.setValue("enabled", wiimotedev_config_->ui_->wiimotedev_enable->isChecked()); + s.setValue("only_when_focused", wiimotedev_config_->ui_->wiimotedev_focus->isChecked()); + s.setValue("use_active_action", wiimotedev_config_->ui_->wiimotedev_active->isChecked()); + s.setValue("use_notification", wiimotedev_config_->ui_->wiimotedev_notification->isChecked()); + s.setValue("device", wiimotedev_config_->ui_->wiimotedev_device->value()); + s.endGroup(); +#endif + // Notifications OSD::Behaviour osd_behaviour = OSD::Disabled; if (ui_->notifications_none->isChecked()) osd_behaviour = OSD::Disabled; diff --git a/src/ui/wiimotedevshortcutsconfig.cpp b/src/ui/wiimotedevshortcutsconfig.cpp index f8dee6b47..cdf06273c 100644 --- a/src/ui/wiimotedevshortcutsconfig.cpp +++ b/src/ui/wiimotedevshortcutsconfig.cpp @@ -14,9 +14,10 @@ along with Clementine. If not, see . */ -#include "wiimotedevshortcutsconfig.h" +#include "ui/wiimotedevshortcutsconfig.h" #include "ui_wiimotedevshortcutsconfig.h" +#include "wiimotedev/shortcuts.h" WiimotedevShortcutsConfig::WiimotedevShortcutsConfig(QWidget* parent) : QWidget(parent), @@ -24,4 +25,19 @@ WiimotedevShortcutsConfig::WiimotedevShortcutsConfig(QWidget* parent) { ui_->setupUi(this); ui_->list->header()->setResizeMode(QHeaderView::ResizeToContents); + + settings_.beginGroup(WiimotedevShortcuts::kSettingsGroup); + ui_->wiimotedev_enable->setChecked(settings_.value("enabled", true).toBool()); + ui_->wiimotedev_groupbox->setChecked(settings_.value("enabled", true).toBool()); + ui_->wiimotedev_active->setChecked(settings_.value("use_active_action", false).toBool()); + ui_->wiimotedev_focus->setChecked(settings_.value("only_when_focused", false).toBool()); + ui_->wiimotedev_notification->setChecked(settings_.value("use_notification", false).toBool()); + ui_->wiimotedev_device->setValue(settings_.value("device", 1).toUInt()); + settings_.endGroup(); + + connect(ui_->wiimotedev_enable, SIGNAL(clicked(bool)), this, SLOT(WiimotedevEnabledChecked(bool))); +} + +void WiimotedevShortcutsConfig::WiimotedevEnabledChecked(bool checked) { + ui_->wiimotedev_groupbox->setEnabled(checked); } diff --git a/src/ui/wiimotedevshortcutsconfig.h b/src/ui/wiimotedevshortcutsconfig.h index 780081640..cca11189f 100644 --- a/src/ui/wiimotedevshortcutsconfig.h +++ b/src/ui/wiimotedevshortcutsconfig.h @@ -17,20 +17,23 @@ #ifndef WIIMOTEDEVSHORTCUTSCONFIG_H #define WIIMOTEDEVSHORTCUTSCONFIG_H +#include #include class Ui_WiimotedevShortcutsConfig; class WiimotedevShortcutsConfig : public QWidget { - Q_OBJECT - - public: + Q_OBJECT +public: WiimotedevShortcutsConfig(QWidget* parent = 0); - ~WiimotedevShortcutsConfig(){}; - - private: Ui_WiimotedevShortcutsConfig* ui_; +private: + QSettings settings_; + +private slots: + void WiimotedevEnabledChecked(bool checked); + }; #endif // WIIMOTEDEVSHORTCUTSCONFIG_H diff --git a/src/ui/wiimotedevshortcutsconfig.ui b/src/ui/wiimotedevshortcutsconfig.ui index 87651713a..047343756 100644 --- a/src/ui/wiimotedevshortcutsconfig.ui +++ b/src/ui/wiimotedevshortcutsconfig.ui @@ -55,12 +55,58 @@ - + Use notifications to report Wii remote status + + + + 10 + + + 0 + + + + + + 0 + 0 + + + + Use Wii remote id + + + + + + + 1 + + + 999999999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/src/wiimotedev/shortcuts.cpp b/src/wiimotedev/shortcuts.cpp index e97c16457..c9194fcef 100644 --- a/src/wiimotedev/shortcuts.cpp +++ b/src/wiimotedev/shortcuts.cpp @@ -28,7 +28,9 @@ WiimotedevShortcuts::WiimotedevShortcuts(Player* player, QObject* parent) wiimotedev_iface_(NULL), wiimotedev_buttons_(0), wiimotedev_device_(1), - wiimotedev_active_(false) + wiimotedev_active_(true), + wiimotedev_focus_(false), + wiimotedev_notification_(true) { ReloadSettings(); @@ -43,10 +45,8 @@ WiimotedevShortcuts::WiimotedevShortcuts(Player* player, QObject* parent) void WiimotedevShortcuts::SetEnabled(bool enabled) { - if (!enabled) { - disconnect(this, 0, player_, 0); - return; - } + disconnect(this, 0, player_, 0); + if (!enabled) return; connect(this, SIGNAL(Next()), player_, SLOT(Next())); connect(this, SIGNAL(Previous()), player_, SLOT(Previous())); @@ -66,8 +66,8 @@ void WiimotedevShortcuts::ReloadSettings() { settings_.beginGroup(WiimotedevShortcuts::kActionsGroup); if (!settings_.allKeys().count()) { - SetDefaultSettings(); - settings_.sync(); + SetDefaultSettings(); + settings_.sync(); } quint64 fvalue, svalue; @@ -84,33 +84,38 @@ void WiimotedevShortcuts::ReloadSettings() { settings_.beginGroup(WiimotedevShortcuts::kSettingsGroup); SetEnabled(settings_.value("enabled", quint64(true)).toBool()); wiimotedev_device_ = settings_.value("device", 1).toInt(); + wiimotedev_active_ = settings_.value("use_active_action", wiimotedev_active_).toBool(); + wiimotedev_focus_ = settings_.value("only_when_focused", wiimotedev_focus_).toBool(); + wiimotedev_notification_ = settings_.value("use_notification", wiimotedev_notification_).toBool(); + settings_.endGroup(); } void WiimotedevShortcuts::SetDefaultSettings() { - QSettings settings; - settings.beginGroup(WiimotedevShortcuts::kActionsGroup); - settings.setValue(QString::number(WIIMOTE_BTN_LEFT), PlayerPreviousTrack); - settings.setValue(QString::number(WIIMOTE_BTN_RIGHT), PlayerNextTrack); - settings.setValue(QString::number(WIIMOTE_BTN_SHIFT_LEFT), PlayerPreviousTrack); - settings.setValue(QString::number(WIIMOTE_BTN_SHIFT_RIGHT), PlayerNextTrack); - settings.setValue(QString::number(WIIMOTE_BTN_PLUS), PlayerIncVolume); - settings.setValue(QString::number(WIIMOTE_BTN_MINUS), PlayerDecVolume); - settings.setValue(QString::number(WIIMOTE_BTN_1), PlayerTogglePause); - settings.setValue(QString::number(WIIMOTE_BTN_2), PlayerShowOSD); - settings.endGroup(); + QSettings settings; + settings.beginGroup(WiimotedevShortcuts::kActionsGroup); + settings.setValue(QString::number(WIIMOTE_BTN_LEFT), PlayerPreviousTrack); + settings.setValue(QString::number(WIIMOTE_BTN_RIGHT), PlayerNextTrack); + settings.setValue(QString::number(WIIMOTE_BTN_SHIFT_LEFT), PlayerPreviousTrack); + settings.setValue(QString::number(WIIMOTE_BTN_SHIFT_RIGHT), PlayerNextTrack); + settings.setValue(QString::number(WIIMOTE_BTN_PLUS), PlayerIncVolume); + settings.setValue(QString::number(WIIMOTE_BTN_MINUS), PlayerDecVolume); + settings.setValue(QString::number(WIIMOTE_BTN_1), PlayerTogglePause); + settings.setValue(QString::number(WIIMOTE_BTN_2), PlayerShowOSD); + settings.endGroup(); - settings.beginGroup(WiimotedevShortcuts::kSettingsGroup); - settings.setValue("enabled", true); - settings.setValue("device", 1); - settings.endGroup(); + settings.beginGroup(WiimotedevShortcuts::kSettingsGroup); + settings.setValue("enabled", true); + settings.setValue("device", 1); + settings.setValue("use_active_action", true); + settings.setValue("only_when_focused", false); + settings.setValue("use_notification", true); + settings.endGroup(); - settings.sync(); + settings.sync(); } - - void WiimotedevShortcuts::EmitRequest(quint32 action) { switch (action) { case PlayerNextTrack: emit Next(); break; @@ -140,9 +145,8 @@ void WiimotedevShortcuts::DbusWiimoteGeneralButtons(quint32 id, quint64 value) { while (actions.hasNext()) { actions.next(); - quint64 key = actions.key(); - if (!key) continue; - if ((key & buttons) == key) EmitRequest(actions.value()); + if (!actions.key()) continue; + if ((actions.key() & buttons) == actions.key()) EmitRequest(actions.value()); } wiimotedev_buttons_ = buttons; diff --git a/src/wiimotedev/shortcuts.h b/src/wiimotedev/shortcuts.h index 0d0a423b7..a1b181a8f 100644 --- a/src/wiimotedev/shortcuts.h +++ b/src/wiimotedev/shortcuts.h @@ -50,6 +50,8 @@ private: quint32 wiimotedev_device_; bool wiimotedev_active_; + bool wiimotedev_focus_; + bool wiimotedev_notification_; private: enum Action {