From 7672cb4b15f8f5eef2b5535e7bbb59248931db72 Mon Sep 17 00:00:00 2001 From: easymodo Date: Thu, 20 Jun 2024 18:55:26 +0300 Subject: [PATCH] [settings] fix reading/saving shortcuts which contain "=" #546 --- qimgv/components/actionmanager/actionmanager.cpp | 6 +++--- qimgv/settings.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qimgv/components/actionmanager/actionmanager.cpp b/qimgv/components/actionmanager/actionmanager.cpp index a9a80f95..05404a34 100644 --- a/qimgv/components/actionmanager/actionmanager.cpp +++ b/qimgv/components/actionmanager/actionmanager.cpp @@ -41,11 +41,11 @@ void ActionManager::initDefaults() { actionManager->defaults.insert(InputMap::keyNameCtrl() + "+WheelUp", "zoomInCursor"); actionManager->defaults.insert(InputMap::keyNameCtrl() + "+WheelDown", "zoomOutCursor"); actionManager->defaults.insert("=", "zoomIn"); // [=+] key on the number row - actionManager->defaults.insert(InputMap::keyNameCtrl() + "=", "zoomIn"); + actionManager->defaults.insert(InputMap::keyNameCtrl() + "+=", "zoomIn"); actionManager->defaults.insert("+", "zoomIn"); - actionManager->defaults.insert(InputMap::keyNameCtrl() + "+", "zoomIn"); + actionManager->defaults.insert(InputMap::keyNameCtrl() + "++", "zoomIn"); actionManager->defaults.insert("-", "zoomOut"); - actionManager->defaults.insert(InputMap::keyNameCtrl() + "-", "zoomOut"); + actionManager->defaults.insert(InputMap::keyNameCtrl() + "+-", "zoomOut"); actionManager->defaults.insert(InputMap::keyNameCtrl() + "+Down", "zoomOut"); actionManager->defaults.insert(InputMap::keyNameCtrl() + "+Up", "zoomIn"); actionManager->defaults.insert("Up", "scrollUp"); diff --git a/qimgv/settings.cpp b/qimgv/settings.cpp index 3ad76fe4..98863dba 100644 --- a/qimgv/settings.cpp +++ b/qimgv/settings.cpp @@ -640,8 +640,8 @@ void Settings::readShortcuts(QMap &shortcuts) { for(int i = 0; i < in.count(); i++) { pair = in[i].split("="); if(!pair[0].isEmpty() && !pair[1].isEmpty()) { - if(pair[1]=="eq") - pair[1]="="; + if(pair[1].endsWith("eq")) + pair[1]=pair[1].chopped(2) + "="; shortcuts.insert(pair[1], pair[0]); } } @@ -654,8 +654,8 @@ void Settings::saveShortcuts(const QMap &shortcuts) { QStringList out; while(i.hasNext()) { i.next(); - if(i.key() == "=") - out << i.value() + "=" + "eq"; + if(i.key().endsWith("=")) + out << i.value() + "=" + i.key().chopped(1) + "eq"; else out << i.value() + "=" + i.key(); }