desktop: offer different colors for info tab titles

Add a preference option to set the color of the text on the information tab to
either MediumBlue, LightBlue or Black. The last two of these colors are meant
to enable areadable font contrast on displays with dark mode.
The choice is saved with the other preferences.

[Dirk Hohndel: this isn't really about dark mode, so changed many of the types
	       and variable names, changed the user visible texts, and
               addressed some whitespace issues]

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
willemferguson 2020-11-01 20:43:54 +02:00 committed by Dirk Hohndel
parent 1ff488a439
commit 8b36cf1051
6 changed files with 133 additions and 8 deletions

View file

@ -55,6 +55,7 @@ void qPrefDisplay::loadSync(bool doSync)
disk_mobile_scale(doSync);
disk_display_invalid_dives(doSync);
disk_show_developer(doSync);
disk_headerstyle_color(doSync);
if (!doSync) {
load_tooltip_position();
load_theme();
@ -176,6 +177,29 @@ void qPrefDisplay::setCorrectFont()
prefs.display_invalid_dives = qPrefPrivate::propValue(keyFromGroupAndName(group, "displayinvalid"), default_prefs.display_invalid_dives).toBool();
}
void qPrefDisplay::set_headerstyle_color(enum headerstyle_color_values value)
{
if (value != prefs.headerstyle_color) {
prefs.headerstyle_color = value;
disk_headerstyle_color(true);
emit instance()->headerstyle_colorChanged(value);
}
}
void qPrefDisplay::disk_headerstyle_color(bool doSync)
{
static enum headerstyle_color_values current_state;
if (doSync) {
if (current_state != prefs.headerstyle_color) {
current_state = prefs.headerstyle_color;
qPrefPrivate::propSetValue(keyFromGroupAndName(group, "headerstyle_color"), prefs.headerstyle_color, default_prefs.headerstyle_color);
}
} else {
prefs.headerstyle_color = (enum headerstyle_color_values)qPrefPrivate::propValue(keyFromGroupAndName(group, "headerstyle_color"), default_prefs.headerstyle_color).toInt();
current_state = prefs.headerstyle_color;
}
}
HANDLE_PROP_QSTRING(Display, "FileDialog/LastDir", lastDir);
HANDLE_PROP_QSTRING(Display, "Theme/currentTheme", theme);