Fix empty hotkeys being loaded

This commit is contained in:
ArsenArsen 2017-07-05 15:30:50 +02:00
parent 7d5be857ff
commit 159720d9fa

View File

@ -28,10 +28,14 @@ void hotkeying::load(QString seqName, std::function<void()> func, QString def) {
QString name = seqName;
name.prepend("hotkey_");
if (hotkeys.contains(seqName)) return;
if (settings::settings().contains(name))
h = new QHotkey(QKeySequence(settings::settings().value(name).toString()), true);
if (settings::settings().contains(name)) {
QString k = settings::settings().value(name).toString();
if (!k.isEmpty())
h = new QHotkey(QKeySequence(settings::settings().value(k).toString()), true);
else
h = new QHotkey(def.isNull() ? "" : def, true);
} else
h = new QHotkey(def.isNull() ? "" : def, true);
QObject::connect(h, &QHotkey::activated, func);
hotkeys.insert(seqName, h);
if (!h->isRegistered() && (settings::settings().contains(name) || !def.isEmpty()))