Skip to content

Commit

Permalink
[settings] fix reading/saving shortcuts which contain "=" #546
Browse files Browse the repository at this point in the history
  • Loading branch information
easymodo committed Jun 20, 2024
1 parent 7685c27 commit 7672cb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions qimgv/components/actionmanager/actionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions qimgv/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ void Settings::readShortcuts(QMap<QString, QString> &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]);
}
}
Expand All @@ -654,8 +654,8 @@ void Settings::saveShortcuts(const QMap<QString, QString> &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();
}
Expand Down

0 comments on commit 7672cb4

Please # to comment.