diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp index 2232708df..e4e45d389 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp @@ -35,6 +35,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey & m_buttonGroupType(new QButtonGroup(this)) { ui->setupUi(this); + connect(ui->keySequenceWidget, &KeySequenceWidget::keySequenceChanged, this, &ActionDialog::keySequenceChanged); // work around Qt Designer's lack of a QButtonGroup; we need it to get // at the button id of the checked radio button @@ -51,8 +52,8 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey & for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]); i++) m_buttonGroupType->addButton(typeButtons[i], i); - ui->m_pKeySequenceWidgetHotkey->setText(m_action.keySequence().toString()); - ui->m_pKeySequenceWidgetHotkey->setKeySequence(m_action.keySequence()); + ui->keySequenceWidget->setText(m_action.keySequence().toString()); + ui->keySequenceWidget->setKeySequence(m_action.keySequence()); m_buttonGroupType->button(m_action.type())->setChecked(true); ui->m_pComboSwitchInDirection->setCurrentIndex(m_action.switchDirection()); ui->m_pComboLockCursorToScreen->setCurrentIndex(m_action.lockCursorMode()); @@ -80,10 +81,10 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey & void ActionDialog::accept() { - if (!sequenceWidget()->valid() && m_buttonGroupType->checkedId() >= 0 && m_buttonGroupType->checkedId() < 3) + if (!ui->keySequenceWidget->valid() && m_buttonGroupType->checkedId() >= 0 && m_buttonGroupType->checkedId() < 3) return; - m_action.setKeySequence(sequenceWidget()->keySequence()); + m_action.setKeySequence(ui->keySequenceWidget->keySequence()); m_action.setType(m_buttonGroupType->checkedId()); m_action.setHaveScreens(ui->m_pGroupBoxScreens->isChecked()); @@ -102,9 +103,9 @@ void ActionDialog::accept() QDialog::accept(); } -void ActionDialog::on_m_pKeySequenceWidgetHotkey_keySequenceChanged() +void ActionDialog::keySequenceChanged() { - if (sequenceWidget()->keySequence().isMouseButton()) { + if (ui->keySequenceWidget->keySequence().isMouseButton()) { ui->m_pGroupBoxScreens->setEnabled(false); ui->m_pListScreens->setEnabled(false); } else { @@ -113,9 +114,4 @@ void ActionDialog::on_m_pKeySequenceWidgetHotkey_keySequenceChanged() } } -const KeySequenceWidget *ActionDialog::sequenceWidget() const -{ - return ui->m_pKeySequenceWidgetHotkey; -} - ActionDialog::~ActionDialog() = default; diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.h b/src/apps/deskflow-gui/dialogs/ActionDialog.h index 2de15b38b..5895aeebb 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.h +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.h @@ -41,12 +41,10 @@ public: protected slots: void accept() override; - void on_m_pKeySequenceWidgetHotkey_keySequenceChanged(); - -protected: - const KeySequenceWidget *sequenceWidget() const; private: + void keySequenceChanged(); + std::unique_ptr ui; Hotkey &m_hotkey; Action &m_action; diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.ui b/src/apps/deskflow-gui/dialogs/ActionDialog.ui index 8c009f27b..d4141585c 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.ui +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.ui @@ -50,7 +50,7 @@ - + 1 @@ -345,7 +345,7 @@ m_pGroupType toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setDisabled(bool) @@ -361,7 +361,7 @@ m_pRadioSwitchInDirection toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setDisabled(bool) @@ -377,7 +377,7 @@ m_pRadioLockCursorToScreen toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setDisabled(bool) @@ -393,7 +393,7 @@ m_pRadioRestartAllConnections toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setDisabled(bool) @@ -409,7 +409,7 @@ m_pRadioPress toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setEnabled(bool) @@ -425,7 +425,7 @@ m_pRadioRelease toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setEnabled(bool) @@ -441,7 +441,7 @@ m_pRadioPressAndRelease toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setEnabled(bool) @@ -617,7 +617,7 @@ m_pRadioSwitchToScreen toggled(bool) - m_pKeySequenceWidgetHotkey + keySequenceWidget setDisabled(bool)