summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/options-dialog.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-25 05:18:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-25 05:18:01 +0200
commit8494245b92e02f982a506ed044a555db239bd4d6 (patch)
tree1e95e64f71114ec038b8bab0cc6d7685b642925e /facetracknoir/options-dialog.cpp
parent37c10386155bc4fed4db910fcd5c7662347f576e (diff)
shortcuts: store .ini value as portable string
Diffstat (limited to 'facetracknoir/options-dialog.cpp')
-rw-r--r--facetracknoir/options-dialog.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/facetracknoir/options-dialog.cpp b/facetracknoir/options-dialog.cpp
index 1d8e636a..8ac95b71 100644
--- a/facetracknoir/options-dialog.cpp
+++ b/facetracknoir/options-dialog.cpp
@@ -54,14 +54,14 @@ OptionsDialog::OptionsDialog()
connect(ui.bind_zero, &QPushButton::pressed, [&]() -> void { bind_key(s.zero.keycode, ui.zero_text); });
connect(ui.bind_toggle, &QPushButton::pressed, [&]() -> void { bind_key(s.toggle.keycode, ui.toggle_text); });
- ui.center_text->setText(QKeySequence(s.center.keycode).toString());
- ui.zero_text->setText(QKeySequence(s.zero.keycode).toString());
- ui.toggle_text->setText(QKeySequence(s.toggle.keycode).toString());
+ ui.center_text->setText(s.center.keycode == "" ? "None" : static_cast<QString>(s.center.keycode));
+ ui.toggle_text->setText(s.toggle.keycode == "" ? "None" : static_cast<QString>(s.toggle.keycode));
+ ui.zero_text->setText(s.zero.keycode == "" ? "None" : static_cast<QString>(s.zero.keycode));
}
-void OptionsDialog::bind_key(value<int>& ret, QLabel* label)
+void OptionsDialog::bind_key(value<QString>& ret, QLabel* label)
{
- ret = 0;
+ ret = "";
QDialog d;
auto l = new QHBoxLayout;
l->setMargin(0);
@@ -70,9 +70,9 @@ void OptionsDialog::bind_key(value<int>& ret, QLabel* label)
d.setLayout(l);
d.setFixedSize(QSize(500, 500));
d.setWindowFlags(Qt::Dialog);
- connect(k, &KeyboardListener::key_pressed, [&] (QKeySequence s) -> void { ret = static_cast<QVariant>(s).toInt(); d.close(); });
+ connect(k, &KeyboardListener::key_pressed, [&] (QKeySequence s) -> void { ret = s.toString(QKeySequence::PortableText); d.close(); });
d.exec();
- label->setText(QKeySequence(ret).toString());
+ label->setText(ret == "" ? "None" : static_cast<QString>(ret));
delete k;
delete l;
}