From be3190db8a14fc51d88c65f5359b9b7787acd2a7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 4 Nov 2020 14:29:48 -0800 Subject: [PATCH] revert preference settings for title color Because of subsequent changes there is no clean way to just revert the changes introduced in commit 8b36cf1051 ("desktop: offer different colors for info tab titles"), so this manually removes the parts we don't need anymore. This also restores a tooltip value that was inadvertantly removed in that commit. Signed-off-by: Dirk Hohndel --- core/pref.h | 17 ++--- core/settings/qPrefDisplay.cpp | 24 ------ core/settings/qPrefDisplay.h | 5 -- .../preferences/preferences_defaults.cpp | 3 - .../preferences/preferences_defaults.ui | 73 ------------------- .../tab-widgets/TabDiveInformation.cpp | 1 + desktop-widgets/tab-widgets/maintab.cpp | 3 +- 7 files changed, 7 insertions(+), 119 deletions(-) diff --git a/core/pref.h b/core/pref.h index b6490f540..f670c9135 100644 --- a/core/pref.h +++ b/core/pref.h @@ -66,12 +66,6 @@ enum unit_system_values { PERSONALIZE }; -enum headerstyle_color_values { - MEDIUMBLUE, - LIGHTBLUE, - BLACK -}; - // ********** PREFERENCES ********** // This struct is kept global for all of ssrf // most of the fields are loaded from git as @@ -106,12 +100,11 @@ struct preferences { dive_computer_prefs_t dive_computer4; // ********** Display ************* - bool display_invalid_dives; - const char *divelist_font; - double font_size; - double mobile_scale; - bool show_developer; - enum headerstyle_color_values headerstyle_color; + bool display_invalid_dives; + const char *divelist_font; + double font_size; + double mobile_scale; + bool show_developer; // ********** Equipment tab ******* const char *default_cylinder; diff --git a/core/settings/qPrefDisplay.cpp b/core/settings/qPrefDisplay.cpp index 9425062dc..c733b0c6b 100644 --- a/core/settings/qPrefDisplay.cpp +++ b/core/settings/qPrefDisplay.cpp @@ -55,7 +55,6 @@ 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(); @@ -177,29 +176,6 @@ 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); diff --git a/core/settings/qPrefDisplay.h b/core/settings/qPrefDisplay.h index 6c265c593..61fa5dbaf 100644 --- a/core/settings/qPrefDisplay.h +++ b/core/settings/qPrefDisplay.h @@ -8,7 +8,6 @@ class qPrefDisplay : public QObject { Q_OBJECT - Q_PROPERTY(enum headerstyle_color_values headerstyle_color READ headerstyle_color WRITE set_headerstyle_color NOTIFY headerstyle_colorChanged) Q_PROPERTY(int animation_speed READ animation_speed WRITE set_animation_speed NOTIFY animation_speedChanged) Q_PROPERTY(QString divelist_font READ divelist_font WRITE set_divelist_font NOTIFY divelist_fontChanged) Q_PROPERTY(double font_size READ font_size WRITE set_font_size NOTIFY font_sizeChanged) @@ -36,7 +35,6 @@ public: static void sync() { loadSync(true); } public: - static enum headerstyle_color_values headerstyle_color() { return prefs.headerstyle_color; } static int animation_speed() { return prefs.animation_speed; } static QString divelist_font() { return prefs.divelist_font; } static double font_size() { return prefs.font_size; } @@ -56,7 +54,6 @@ public: static bool singleColumnPortrait() { return st_singleColumnPortrait; } public slots: - static void set_headerstyle_color(enum headerstyle_color_values value); static void set_animation_speed(int value); static void set_divelist_font(const QString &value); static void set_font_size(double value); @@ -76,7 +73,6 @@ public slots: static void set_singleColumnPortrait(bool value); signals: - void headerstyle_colorChanged(enum headerstyle_color_values value); void animation_speedChanged(int value); void divelist_fontChanged(const QString &value); void font_sizeChanged(double value); @@ -99,7 +95,6 @@ private: qPrefDisplay() {} // functions to load/sync variable with disk - static void disk_headerstyle_color(bool doSync); static void disk_animation_speed(bool doSync); static void disk_divelist_font(bool doSync); static void disk_font_size(bool doSync); diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 3fba8e1b8..ca1b51acb 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -24,7 +24,6 @@ PreferencesDefaults::~PreferencesDefaults() void PreferencesDefaults::refreshSettings() { - prefs.headerstyle_color == BLACK ? ui->black_text->setChecked(true) : (prefs.headerstyle_color == LIGHTBLUE ? ui->lightblue_text->setChecked(true) : ui->mediumblue_text->setChecked(true)); ui->font->setCurrentFont(qPrefDisplay::divelist_font()); ui->fontsize->setValue(qPrefDisplay::font_size()); ui->velocitySlider->setValue(qPrefDisplay::animation_speed()); @@ -36,6 +35,4 @@ void PreferencesDefaults::syncSettings() qPrefDisplay::set_divelist_font(ui->font->currentFont().toString()); qPrefDisplay::set_font_size(ui->fontsize->value()); qPrefDisplay::set_animation_speed(ui->velocitySlider->value()); - qPrefDisplay::set_headerstyle_color(ui->black_text->isChecked() ? BLACK : (ui->lightblue_text->isChecked() ? LIGHTBLUE : MEDIUMBLUE)); - } diff --git a/desktop-widgets/preferences/preferences_defaults.ui b/desktop-widgets/preferences/preferences_defaults.ui index b6104b256..030bb77d6 100644 --- a/desktop-widgets/preferences/preferences_defaults.ui +++ b/desktop-widgets/preferences/preferences_defaults.ui @@ -120,77 +120,6 @@ - - - Header text colors - - - - 5 - - - - - - - - - true - - - Depending on the display mode, sometimes the blue text used in headers in the various information panes is not clearly visible. Select a color that fits the current theme of your computer. For dark mode, select either Light Blue or Black (rendered white using a dark theme). The default is Medium Blue. - - - - - - - - - - - Medium Blue - - - - - - - - Light Blue - - - - - - - - Black - - - - - - - - - - - - - - - Qt::Vertical - - - - 0 - 195 - - - - - Qt::Vertical @@ -203,10 +132,8 @@ - - diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index 63d7fdd55..46d5c4f8b 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -49,6 +49,7 @@ TabDiveInformation::TabDiveInformation(QWidget *parent) : TabBase(parent), ui(ne updateWaterTypeWidget(); QPixmap warning (":salinity-warning-icon"); ui->salinityOverWrittenIcon->setPixmap(warning); + ui->salinityOverWrittenIcon->setToolTip("Water type differs from that of dc"); ui->salinityOverWrittenIcon->setToolTipDuration(2500); ui->salinityOverWrittenIcon->setVisible(false); } diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 6e794f07d..7c4d40011 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -34,7 +34,6 @@ #include "TabDiveStatistics.h" #include "TabDiveSite.h" #include "TabDiveComputer.h" -#include "core/settings/qPrefDisplay.h" #include #include @@ -102,7 +101,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), // Alas, this is not the case. When the user switches to system-format, the preferences sends the according // signal. However, the correct date and time format is set by the preferences dialog later. This should be fixed. connect(PreferencesDialog::instance(), &PreferencesDialog::settingsChanged, this, &MainTab::updateDateTimeFields); - connect(qPrefDisplay::instance(), &qPrefDisplay::headerstyle_colorChanged, this, &MainTab::colorsChanged); + QAction *action = new QAction(tr("Apply changes"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); ui.diveNotesMessage->addAction(action);