summaryrefslogtreecommitdiffhomepage
path: root/gui/settings.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-07-08 23:29:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-07-08 23:29:49 +0200
commitfa1801471c2708ed8266ec7b99bd4cec886ccc1b (patch)
treeaa56218c2c7e4939aaf11a2046b0f12760326545 /gui/settings.cpp
parent90940a774eab876c38d5cef981b4be5bae67a462 (diff)
options: fix 2 issues
1. Calling valueChanged didn't invoke machinery in value<t>, only base_value aka value_. There's a fast path in value<t>::type() despite the pessimization. 2. Split global scope stuff into options::globals from the options::globals stuff 3. Adjust usages
Diffstat (limited to 'gui/settings.cpp')
-rw-r--r--gui/settings.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/gui/settings.cpp b/gui/settings.cpp
index 31bbd87b..5ee59260 100644
--- a/gui/settings.cpp
+++ b/gui/settings.cpp
@@ -18,10 +18,11 @@
#include <QFileDialog>
using namespace options;
+using namespace options::globals;
QString options_dialog::kopts_to_string(const key_opts& kopts)
{
- if (static_cast<QString>(kopts.guid) != "")
+ if (!kopts.guid->isEmpty())
{
const int btn = kopts.button & ~Qt::KeyboardModifierMask;
const int mods = kopts.button & Qt::KeyboardModifierMask;
@@ -31,14 +32,14 @@ QString options_dialog::kopts_to_string(const key_opts& kopts)
if (mods & Qt::ShiftModifier) mm += "Shift+";
return mm + tr("Joy button %1").arg(QString::number(btn));
}
- if (static_cast<QString>(kopts.keycode) == "")
+ if (kopts.keycode->isEmpty())
return tr("None");
return kopts.keycode;
}
void options_dialog::set_disable_translation_state(bool value)
{
- group::with_global_settings_object([&](QSettings& s)
+ with_global_settings_object([&](QSettings& s)
{
s.setValue("disable-translation", value);
});
@@ -105,7 +106,7 @@ options_dialog::options_dialog(std::function<void(bool)>&& pause_keybindings) :
tie_setting(main.neck_enable, ui.neck_enable);
- const bool is_translation_disabled = group::with_global_settings_object([] (QSettings& s) {
+ const bool is_translation_disabled = with_global_settings_object([] (QSettings& s) {
return s.value("disable-translation", false).toBool();
});
ui.disable_translation->setChecked(is_translation_disabled);