From fd500cee35ef87dcb97ca0b5deafb62bcf96feba Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 4 Jan 2018 19:10:55 +0100 Subject: [PATCH] Ref T218, only report conflicts for same machine --- .../components/settingshotkeycomponent.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/blackgui/components/settingshotkeycomponent.cpp b/src/blackgui/components/settingshotkeycomponent.cpp index 3d9f35f5f..9e28c6e52 100644 --- a/src/blackgui/components/settingshotkeycomponent.cpp +++ b/src/blackgui/components/settingshotkeycomponent.cpp @@ -134,17 +134,19 @@ namespace BlackGui bool CSettingsHotkeyComponent::checkAndConfirmConflicts(const CActionHotkey &actionHotkey, const CActionHotkeyList &ignore) { - const auto configuredHotkeys = m_actionHotkeys.getThreadLocal(); - CActionHotkeyList conflicts = configuredHotkeys.findSupersetsOf(actionHotkey); - conflicts.push_back(configuredHotkeys.findSubsetsOf(actionHotkey)); - conflicts.removeIfIn(ignore); + // check the hotkeys of the same machine only + // and avoid duplicates (replace or add) + const CActionHotkeyList configuredHotkeysSameMachine = m_actionHotkeys.getThreadLocal().findBySameMachine(actionHotkey); + CActionHotkeyList conflicts = configuredHotkeysSameMachine.findSupersetsOf(actionHotkey); + conflicts.replaceOrAdd(configuredHotkeysSameMachine.findSubsetsOf(actionHotkey)); + conflicts.removeIfIn(ignore.findBySameMachine(actionHotkey)); if (!conflicts.isEmpty()) { - QString message = QString("The selected combination conflicts with the following %1 combinations(s):\n\n").arg(conflicts.size()); - for (const auto &conflict : conflicts) + QString message = QString("The selected combination conflicts with the following %1 combination(s):\n\n").arg(conflicts.size()); + for (const CActionHotkey &conflict : conflicts) { - message += conflict.getCombination().toQString(); + message += conflict.toQString(); message += "\n"; } message += "\n Do you want to use it anway?";