summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-02-25 14:09:50 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-02-25 14:19:59 +0100
commit02f2779611e717701bdac557180ed669de0a5a22 (patch)
tree28ef26218b38e5928051a1b61c1a51bcdd5c298a /gui
parentfb691fb6c36b5e21170ba13a5d228e8fcb5e190b (diff)
gui/options-dialog: prevent crap key text from being saved
Unprintable characters won't work in addition to not displaying right. This happens with altgr diacritics on the Polish keyboard on Linux. Skip all key text with unprintable characters, as if the key was getting unbound.
Diffstat (limited to 'gui')
-rw-r--r--gui/options-dialog.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index 42b5cc52..18b434c4 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -180,7 +180,21 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label)
pause_keybindings(true);
k->exec();
pause_keybindings(false);
- label->setText(kopts_to_string(kopts));
+ const bool is_crap = progn(
+ for (const QChar& c : kopts.keycode())
+ if (!c.isPrint())
+ return true;
+ return false;
+ );
+ if (is_crap)
+ {
+ kopts.keycode = QStringLiteral("");
+ kopts.guid = QStringLiteral("");
+ kopts.button = -1;
+ label->setText(tr("None"));
+ }
+ else
+ label->setText(kopts_to_string(kopts));
}
void OptionsDialog::doOK()