Remember wiiremote swing now working properly
This commit is contained in:
parent
ad16a8b1ba
commit
fbd17fd2a5
@ -1323,7 +1323,7 @@ msgid "Preset:"
|
||||
msgstr "Obecny:"
|
||||
|
||||
msgid "Press a button combination to use for"
|
||||
msgstr "Naciśnij kombinację przycisków dla"
|
||||
msgstr "Ustaw kombinacje przyciskow dla"
|
||||
|
||||
msgid "Press a key"
|
||||
msgstr "Naciśnij klawisz"
|
||||
|
@ -25,7 +25,9 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
|
||||
ui_(new Ui_WiimotedevShortcutGrabber),
|
||||
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
|
||||
wiimotedev_device_(1),
|
||||
wiimotedev_buttons_(0)
|
||||
wiimotedev_buttons_(0),
|
||||
remember_wiimote_shifts_(0),
|
||||
remember_nunchuk_shifts_(0)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
|
||||
@ -43,18 +45,47 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
|
||||
foreach (const QString& name, config_->text_actions_.values())
|
||||
ui_->comboBox->addItem(name);
|
||||
|
||||
connect(ui_->remember_shifts, SIGNAL(clicked(bool)), this, SLOT(RememberSwingChecked(bool)));
|
||||
}
|
||||
|
||||
WiimotedevShortcutGrabber::~WiimotedevShortcutGrabber() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void WiimotedevShortcutGrabber::RememberSwingChecked(bool checked) {
|
||||
quint64 buttons = wiimotedev_buttons_;
|
||||
|
||||
if (checked) {
|
||||
buttons |= remember_wiimote_shifts_ | remember_nunchuk_shifts_;
|
||||
ui_->combo->setText(config_->GetReadableWiiremoteSequence(buttons));
|
||||
} else {
|
||||
remember_wiimote_shifts_ = 0;
|
||||
remember_nunchuk_shifts_ = 0;
|
||||
buttons &= ~(WIIMOTE_SHIFT_MASK | NUNCHUK_SHIFT_MASK);
|
||||
ui_->combo->setText(config_->GetReadableWiiremoteSequence(buttons));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WiimotedevShortcutGrabber::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
|
||||
if (wiimotedev_device_ != id) 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 (ui_->remember_shifts->isChecked()) {
|
||||
if (!(buttons & WIIMOTE_SHIFT_MASK)) buttons |= remember_wiimote_shifts_;
|
||||
if (!(buttons & NUNCHUK_SHIFT_MASK)) buttons |= remember_nunchuk_shifts_;
|
||||
}
|
||||
|
||||
if (wiimotedev_buttons_ == buttons) return;
|
||||
|
||||
remember_wiimote_shifts_ = buttons & WIIMOTE_SHIFT_MASK;
|
||||
remember_nunchuk_shifts_ = buttons & NUNCHUK_SHIFT_MASK;
|
||||
|
||||
ui_->combo->setText(config_->GetReadableWiiremoteSequence(buttons));
|
||||
|
||||
wiimotedev_buttons_ = buttons;
|
||||
|
@ -27,14 +27,15 @@ class Ui_WiimotedevShortcutGrabber;
|
||||
class WiimotedevShortcutGrabber : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
WiimotedevShortcutGrabber(QWidget* parent = 0);
|
||||
~WiimotedevShortcutGrabber();
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
|
||||
void RememberSwingChecked(bool checked);
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui_WiimotedevShortcutGrabber* ui_;
|
||||
WiimotedevShortcutsConfig* config_;
|
||||
boost::scoped_ptr<OrgWiimotedevDeviceEventsInterface> wiimotedev_iface_;
|
||||
@ -42,6 +43,9 @@ class WiimotedevShortcutGrabber : public QDialog {
|
||||
quint64 wiimotedev_buttons_;
|
||||
quint32 action;
|
||||
|
||||
quint64 remember_wiimote_shifts_;
|
||||
quint64 remember_nunchuk_shifts_;
|
||||
|
||||
};
|
||||
|
||||
#endif // WIIMOTEDEVSHORTCUTGRABBER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user