mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Attempted blind fix for hotkeys not saving. (#3473)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
42002d80b7
commit
dfa3818a70
1 changed files with 13 additions and 0 deletions
|
@ -201,8 +201,15 @@ void HotkeyController::loadHotkeys()
|
||||||
auto set = std::set<QString>(defaultHotkeysAdded.begin(),
|
auto set = std::set<QString>(defaultHotkeysAdded.begin(),
|
||||||
defaultHotkeysAdded.end());
|
defaultHotkeysAdded.end());
|
||||||
|
|
||||||
|
// set is currently "defaults added in settings"
|
||||||
|
auto numDefaultsFromSettings = set.size();
|
||||||
|
|
||||||
auto keys = pajlada::Settings::SettingManager::getObjectKeys("/hotkeys");
|
auto keys = pajlada::Settings::SettingManager::getObjectKeys("/hotkeys");
|
||||||
this->addDefaults(set);
|
this->addDefaults(set);
|
||||||
|
|
||||||
|
// set is currently "all defaults (defaults defined from application + defaults defined in settings)"
|
||||||
|
auto numCombinedDefaults = set.size();
|
||||||
|
|
||||||
pajlada::Settings::Setting<std::vector<QString>>::set(
|
pajlada::Settings::Setting<std::vector<QString>>::set(
|
||||||
"/hotkeys/addedDefaults", std::vector<QString>(set.begin(), set.end()));
|
"/hotkeys/addedDefaults", std::vector<QString>(set.begin(), set.end()));
|
||||||
|
|
||||||
|
@ -239,6 +246,12 @@ void HotkeyController::loadHotkeys()
|
||||||
*category, QKeySequence(keySequence), action, arguments,
|
*category, QKeySequence(keySequence), action, arguments,
|
||||||
QString::fromStdString(key)));
|
QString::fromStdString(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numDefaultsFromSettings != numCombinedDefaults)
|
||||||
|
{
|
||||||
|
// some default that the user was not aware of has been added to the application, force a save to ensure shared state between hotkey controller and settings
|
||||||
|
this->saveHotkeys();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HotkeyController::saveHotkeys()
|
void HotkeyController::saveHotkeys()
|
||||||
|
|
Loading…
Reference in a new issue