mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refactor
This commit is contained in:
parent
3fc1805942
commit
f7bba2488b
1 changed files with 4 additions and 5 deletions
|
|
@ -215,12 +215,11 @@ bool ShortcutsSettings::isValid(const QString &name, const QString &sequences) c
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the key or checkKey is a shortcut that is active in all windows
|
* Checks if the shortcut is a shortcut that is active in all windows
|
||||||
*/
|
*/
|
||||||
static bool isAlwaysActiveShortcut(const QString &key, const QString &checkKey)
|
static bool isAlwaysActiveShortcut(const QString &shortcutName)
|
||||||
{
|
{
|
||||||
return key.startsWith("MainWindow") || checkKey.startsWith("MainWindow") || key.startsWith("Tabs") ||
|
return shortcutName.startsWith("MainWindow") || shortcutName.startsWith("Tabs");
|
||||||
checkKey.startsWith("Tabs");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ShortcutsSettings::findOverlaps(const QString &name, const QString &sequences) const
|
QStringList ShortcutsSettings::findOverlaps(const QString &name, const QString &sequences) const
|
||||||
|
|
@ -230,7 +229,7 @@ QStringList ShortcutsSettings::findOverlaps(const QString &name, const QString &
|
||||||
|
|
||||||
QStringList overlaps;
|
QStringList overlaps;
|
||||||
for (const auto &key : shortCuts.keys()) {
|
for (const auto &key : shortCuts.keys()) {
|
||||||
if (key.startsWith(checkKey) || isAlwaysActiveShortcut(key, checkKey)) {
|
if (key.startsWith(checkKey) || isAlwaysActiveShortcut(key) || isAlwaysActiveShortcut(checkKey)) {
|
||||||
QString storedSequence = stringifySequence(shortCuts.value(key));
|
QString storedSequence = stringifySequence(shortCuts.value(key));
|
||||||
if (storedSequence.split(sep).contains(checkSequence)) {
|
if (storedSequence.split(sep).contains(checkSequence)) {
|
||||||
overlaps.append(getShortcutFriendlyName(key));
|
overlaps.append(getShortcutFriendlyName(key));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue