Block wiimotedev interface when adding new shortcut
This commit is contained in:
parent
fbd17fd2a5
commit
a05cd6d623
@ -1486,9 +1486,10 @@ void MainWindow::EnsureSettingsDialogCreated() {
|
|||||||
connect(settings_dialog_.get(), SIGNAL(accepted()), ui_->library_view, SLOT(ReloadSettings()));
|
connect(settings_dialog_.get(), SIGNAL(accepted()), ui_->library_view, SLOT(ReloadSettings()));
|
||||||
connect(settings_dialog_.get(), SIGNAL(accepted()), player_->GetEngine(), SLOT(ReloadSettings()));
|
connect(settings_dialog_.get(), SIGNAL(accepted()), player_->GetEngine(), SLOT(ReloadSettings()));
|
||||||
connect(settings_dialog_.get(), SIGNAL(accepted()), ui_->playlist->view(), SLOT(ReloadSettings()));
|
connect(settings_dialog_.get(), SIGNAL(accepted()), ui_->playlist->view(), SLOT(ReloadSettings()));
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
connect(settings_dialog_.get(), SIGNAL(accepted()), wiimotedev_shortcuts_.get(), SLOT(ReloadSettings()));
|
connect(settings_dialog_.get(), SIGNAL(accepted()), wiimotedev_shortcuts_.get(), SLOT(ReloadSettings()));
|
||||||
#endif
|
connect(settings_dialog_.get(), SIGNAL(SetWiimotedevInterfaceActived(bool)), wiimotedev_shortcuts_.get(), SLOT(SetWiimotedevInterfaceActived(bool)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenSettingsDialog() {
|
void MainWindow::OpenSettingsDialog() {
|
||||||
|
@ -71,6 +71,8 @@ SettingsDialog::SettingsDialog(QWidget* parent)
|
|||||||
wiimotedev_layout->addWidget(wiimotedev_config_);
|
wiimotedev_layout->addWidget(wiimotedev_config_);
|
||||||
|
|
||||||
ui_->stacked_widget->addWidget(wiimotedev_page);
|
ui_->stacked_widget->addWidget(wiimotedev_page);
|
||||||
|
|
||||||
|
connect(wiimotedev_config_, SIGNAL(SetWiimotedevInterfaceActived(bool)), this, SIGNAL(SetWiimotedevInterfaceActived(bool)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Playback
|
// Playback
|
||||||
|
@ -95,6 +95,11 @@ class SettingsDialog : public QDialog {
|
|||||||
OSDPretty* pretty_popup_;
|
OSDPretty* pretty_popup_;
|
||||||
|
|
||||||
QMap<QString, QString> language_map_;
|
QMap<QString, QString> language_map_;
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
|
signals:
|
||||||
|
void SetWiimotedevInterfaceActived(bool);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
#include "ui/wiimotedevshortcutgrabber.h"
|
#include "ui/wiimotedevshortcutgrabber.h"
|
||||||
#include "ui_wiimotedevshortcutgrabber.h"
|
#include "ui_wiimotedevshortcutgrabber.h"
|
||||||
#include "ui/wiimotedevshortcutsconfig.h"
|
|
||||||
|
|
||||||
#include "wiimotedev/consts.h"
|
#include "wiimotedev/consts.h"
|
||||||
|
|
||||||
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
|
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
|
pref_action_(action),
|
||||||
ui_(new Ui_WiimotedevShortcutGrabber),
|
ui_(new Ui_WiimotedevShortcutGrabber),
|
||||||
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
|
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
|
||||||
wiimotedev_device_(1),
|
wiimotedev_device_(1),
|
||||||
@ -42,9 +42,15 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
|
|||||||
this, SLOT(DbusWiimoteGeneralButtons(uint,qulonglong)));
|
this, SLOT(DbusWiimoteGeneralButtons(uint,qulonglong)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shortcut.action = 0;
|
||||||
|
shortcut.button = 0;
|
||||||
|
shortcut.object = 0;
|
||||||
|
|
||||||
foreach (const QString& name, config_->text_actions_.values())
|
foreach (const QString& name, config_->text_actions_.values())
|
||||||
ui_->comboBox->addItem(name);
|
ui_->comboBox->addItem(name);
|
||||||
|
|
||||||
|
ui_->comboBox->setCurrentIndex(pref_action_);
|
||||||
|
|
||||||
connect(ui_->remember_shifts, SIGNAL(clicked(bool)), this, SLOT(RememberSwingChecked(bool)));
|
connect(ui_->remember_shifts, SIGNAL(clicked(bool)), this, SLOT(RememberSwingChecked(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,21 +21,25 @@
|
|||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include "dbus/wiimotedev.h"
|
#include "dbus/wiimotedev.h"
|
||||||
|
|
||||||
class WiimotedevShortcutsConfig;
|
#include "ui/wiimotedevshortcutsconfig.h"
|
||||||
|
|
||||||
class Ui_WiimotedevShortcutGrabber;
|
class Ui_WiimotedevShortcutGrabber;
|
||||||
|
|
||||||
class WiimotedevShortcutGrabber : public QDialog {
|
class WiimotedevShortcutGrabber : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WiimotedevShortcutGrabber(QWidget* parent = 0);
|
WiimotedevShortcutGrabber(quint32 action = 0, QWidget* parent = 0);
|
||||||
~WiimotedevShortcutGrabber();
|
~WiimotedevShortcutGrabber();
|
||||||
|
|
||||||
|
WiimotedevShortcutsConfig::Shortcut shortcut;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
|
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
|
||||||
void RememberSwingChecked(bool checked);
|
void RememberSwingChecked(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
quint32 pref_action_;
|
||||||
|
|
||||||
Ui_WiimotedevShortcutGrabber* ui_;
|
Ui_WiimotedevShortcutGrabber* ui_;
|
||||||
WiimotedevShortcutsConfig* config_;
|
WiimotedevShortcutsConfig* config_;
|
||||||
boost::scoped_ptr<OrgWiimotedevDeviceEventsInterface> wiimotedev_iface_;
|
boost::scoped_ptr<OrgWiimotedevDeviceEventsInterface> wiimotedev_iface_;
|
||||||
|
@ -201,8 +201,10 @@ QString WiimotedevShortcutsConfig::GetReadableWiiremoteSequence(quint64 value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WiimotedevShortcutsConfig::AddAction() {
|
void WiimotedevShortcutsConfig::AddAction() {
|
||||||
WiimotedevShortcutGrabber grabber(this);
|
emit SetWiimotedevInterfaceActived(false);
|
||||||
|
WiimotedevShortcutGrabber grabber(0, this);
|
||||||
grabber.exec();
|
grabber.exec();
|
||||||
|
emit SetWiimotedevInterfaceActived(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimotedevShortcutsConfig::DeleteAction() {
|
void WiimotedevShortcutsConfig::DeleteAction() {
|
||||||
|
@ -59,6 +59,10 @@ private slots:
|
|||||||
|
|
||||||
void WiimotedevEnabledChecked(bool checked);
|
void WiimotedevEnabledChecked(bool checked);
|
||||||
void ItemClicked(QTreeWidgetItem*);
|
void ItemClicked(QTreeWidgetItem*);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void SetWiimotedevInterfaceActived(bool);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIIMOTEDEVSHORTCUTSCONFIG_H
|
#endif // WIIMOTEDEVSHORTCUTSCONFIG_H
|
||||||
|
@ -97,7 +97,11 @@ void WiimotedevShortcuts::ReloadSettings() {
|
|||||||
void WiimotedevShortcuts::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
|
void WiimotedevShortcuts::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
|
||||||
if (id != wiimotedev_device_ || !wiimotedev_enable_ || !player_) return;
|
if (id != wiimotedev_device_ || !wiimotedev_enable_ || !player_) return;
|
||||||
|
|
||||||
quint64 buttons = value & ~(WIIMOTE_TILT_MASK | NUNCHUK_TILT_MASK);
|
quint64 buttons = value & ~(
|
||||||
|
WIIMOTE_TILT_MASK |
|
||||||
|
NUNCHUK_TILT_MASK |
|
||||||
|
WIIMOTE_BTN_SHIFT_SHAKE |
|
||||||
|
NUNCHUK_BTN_SHIFT_SHAKE);
|
||||||
|
|
||||||
if (wiimotedev_buttons_ == buttons) return;
|
if (wiimotedev_buttons_ == buttons) return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user