diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-09-07 09:06:00 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-09-07 14:37:18 -0700 |
commit | 2ecbea3d24529b9776acb620c82af04a076b817f (patch) | |
tree | 0b0fc4eec864ff79db095d775341085cb1315895 /core/settings/qPrefDisplay.cpp | |
parent | db57a633d587444a7196c8d4274b8f327e77ceba (diff) | |
download | subsurface-2ecbea3d24529b9776acb620c82af04a076b817f.tar.gz |
qPref: use helper function to ensure key/name grouping
We had a couple of instances of names being incorrectly merged with their
group, this should handle that better. It's a bit of a big hammer to use, but
it seems to work (and it makes it easy to then git grep for cases that don't
use the new helper function.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings/qPrefDisplay.cpp')
-rw-r--r-- | core/settings/qPrefDisplay.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/settings/qPrefDisplay.cpp b/core/settings/qPrefDisplay.cpp index ef4d8e1b8..c22c6b5b6 100644 --- a/core/settings/qPrefDisplay.cpp +++ b/core/settings/qPrefDisplay.cpp @@ -90,7 +90,7 @@ void qPrefDisplay::set_divelist_font(const QString &value) void qPrefDisplay::disk_divelist_font(bool doSync) { if (doSync) - qPrefPrivate::propSetValue(group + "/divelist_font", prefs.divelist_font, default_prefs.divelist_font); + qPrefPrivate::propSetValue(keyFromGroupAndName(group, "divelist_font"), prefs.divelist_font, default_prefs.divelist_font); else setCorrectFont(); } @@ -110,29 +110,29 @@ void qPrefDisplay::set_font_size(double value) void qPrefDisplay::disk_font_size(bool doSync) { if (doSync) - qPrefPrivate::propSetValue(group + "/font_size", prefs.font_size, default_prefs.font_size); + qPrefPrivate::propSetValue(keyFromGroupAndName(group, "font_size"), prefs.font_size, default_prefs.font_size); else setCorrectFont(); } //JAN static const QString group = QStringLiteral("Animations"); -HANDLE_PREFERENCE_INT(Display, "/animation_speed", animation_speed); +HANDLE_PREFERENCE_INT(Display, "animation_speed", animation_speed); -HANDLE_PREFERENCE_BOOL(Display, "/displayinvalid", display_invalid_dives); +HANDLE_PREFERENCE_BOOL(Display, "displayinvalid", display_invalid_dives); -HANDLE_PREFERENCE_BOOL(Display, "/show_developer", show_developer); +HANDLE_PREFERENCE_BOOL(Display, "show_developer", show_developer); void qPrefDisplay::setCorrectFont() { // get the font from the settings or our defaults // respect the system default font size if none is explicitly set - QFont defaultFont = qPrefPrivate::propValue(group + "/divelist_font", prefs.divelist_font).value<QFont>(); + QFont defaultFont = qPrefPrivate::propValue(keyFromGroupAndName(group, "divelist_font"), prefs.divelist_font).value<QFont>(); if (IS_FP_SAME(system_divelist_default_font_size, -1.0)) { prefs.font_size = qApp->font().pointSizeF(); system_divelist_default_font_size = prefs.font_size; // this way we don't save it on exit } - prefs.font_size = qPrefPrivate::propValue(group + "/font_size", prefs.font_size).toFloat(); + prefs.font_size = qPrefPrivate::propValue(keyFromGroupAndName(group, "font_size"), prefs.font_size).toFloat(); // painful effort to ignore previous default fonts on Windows - ridiculous QString fontName = defaultFont.toString(); if (fontName.contains(",")) @@ -146,7 +146,7 @@ void qPrefDisplay::setCorrectFont() defaultFont.setPointSizeF(prefs.font_size); qApp->setFont(defaultFont); - prefs.display_invalid_dives = qPrefPrivate::propValue(group + "/displayinvalid", default_prefs.display_invalid_dives).toBool(); + prefs.display_invalid_dives = qPrefPrivate::propValue(keyFromGroupAndName(group, "displayinvalid"), default_prefs.display_invalid_dives).toBool(); } HANDLE_PROP_QSTRING(Display, "FileDialog/LastDir", lastDir); |