mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
db57a633d5
commit
2ecbea3d24
15 changed files with 157 additions and 149 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue