Ref T218, only report conflicts for same machine

This commit is contained in:
Klaus Basan
2018-01-04 19:10:55 +01:00
parent 4bc9b92c69
commit fd500cee35

View File

@@ -134,17 +134,19 @@ namespace BlackGui
bool CSettingsHotkeyComponent::checkAndConfirmConflicts(const CActionHotkey &actionHotkey, const CActionHotkeyList &ignore) bool CSettingsHotkeyComponent::checkAndConfirmConflicts(const CActionHotkey &actionHotkey, const CActionHotkeyList &ignore)
{ {
const auto configuredHotkeys = m_actionHotkeys.getThreadLocal(); // check the hotkeys of the same machine only
CActionHotkeyList conflicts = configuredHotkeys.findSupersetsOf(actionHotkey); // and avoid duplicates (replace or add)
conflicts.push_back(configuredHotkeys.findSubsetsOf(actionHotkey)); const CActionHotkeyList configuredHotkeysSameMachine = m_actionHotkeys.getThreadLocal().findBySameMachine(actionHotkey);
conflicts.removeIfIn(ignore); CActionHotkeyList conflicts = configuredHotkeysSameMachine.findSupersetsOf(actionHotkey);
conflicts.replaceOrAdd(configuredHotkeysSameMachine.findSubsetsOf(actionHotkey));
conflicts.removeIfIn(ignore.findBySameMachine(actionHotkey));
if (!conflicts.isEmpty()) if (!conflicts.isEmpty())
{ {
QString message = QString("The selected combination conflicts with the following %1 combinations(s):\n\n").arg(conflicts.size()); QString message = QString("The selected combination conflicts with the following %1 combination(s):\n\n").arg(conflicts.size());
for (const auto &conflict : conflicts) for (const CActionHotkey &conflict : conflicts)
{ {
message += conflict.getCombination().toQString(); message += conflict.toQString();
message += "\n"; message += "\n";
} }
message += "\n Do you want to use it anway?"; message += "\n Do you want to use it anway?";