From 9749bb5d3183dd3b909f9032eaf628a0f816180d Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sun, 5 Mar 2017 14:08:45 +0100 Subject: [PATCH] Add the missing handling when user selects a different machine So far, the case that a user selects a different machine, was not handled yet. refs #881 --- src/blackgui/components/hotkeydialog.cpp | 9 +++++++++ src/blackgui/components/hotkeydialog.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/blackgui/components/hotkeydialog.cpp b/src/blackgui/components/hotkeydialog.cpp index c020a86bd..d1c28feb3 100644 --- a/src/blackgui/components/hotkeydialog.cpp +++ b/src/blackgui/components/hotkeydialog.cpp @@ -100,6 +100,7 @@ namespace BlackGui connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionChanged, this, &CHotkeyDialog::ps_combinationSelectionChanged); connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionFinished, this, &CHotkeyDialog::ps_combinationSelectionFinished); connect(ui->tv_Actions->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CHotkeyDialog::ps_changeSelectedAction); + connect(ui->cb_Identifier, static_cast(&QComboBox::currentIndexChanged), this, &CHotkeyDialog::changeApplicableMachine); initStyleSheet(); } @@ -169,6 +170,14 @@ namespace BlackGui m_actionHotkey.setAction(index.data(Models::CActionModel::ActionRole).toString()); } + void CHotkeyDialog::changeApplicableMachine(int index) + { + Q_UNUSED(index); + QVariant userData = ui->cb_Identifier->currentData(Qt::UserRole); + Q_ASSERT(userData.canConvert()); + m_actionHotkey.setApplicableMachine(userData.value()); + } + void CHotkeyDialog::ps_accept() { if (m_actionHotkey.getApplicableMachine().getMachineName().isEmpty()) diff --git a/src/blackgui/components/hotkeydialog.h b/src/blackgui/components/hotkeydialog.h index 559f08f40..60762b9fe 100644 --- a/src/blackgui/components/hotkeydialog.h +++ b/src/blackgui/components/hotkeydialog.h @@ -88,6 +88,7 @@ namespace BlackGui void ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination); void ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination); void ps_changeSelectedAction(const QItemSelection &selected, const QItemSelection &deselected); + void changeApplicableMachine(int index); void ps_accept(); void synchronize();