diff options
author | willemferguson <willemferguson@zoology.up.ac.za> | 2019-11-19 11:52:33 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-06 07:00:34 +0900 |
commit | 732d5a9fbd2b7d72610604a1b065ebbd9ea55960 (patch) | |
tree | 70e1dc0a231970cf646e595536adc14a375b775b | |
parent | 95a0a0f5a6038d5a73775e2060e29d09d0953d7e (diff) | |
download | subsurface-732d5a9fbd2b7d72610604a1b065ebbd9ea55960.tar.gz |
desktop UI: add preference for making salinity editable
Create a checkbox in the Preferences: General screen that enables or disables
editing of the salinity data. This preference is saved with all the other
preferences.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/pref.h | 1 | ||||
-rw-r--r-- | core/settings/qPrefLog.cpp | 3 | ||||
-rw-r--r-- | core/settings/qPrefLog.h | 6 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 1 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_log.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_log.ui | 7 |
6 files changed, 19 insertions, 1 deletions
diff --git a/core/pref.h b/core/pref.h index 1e8417af8..6949b762c 100644 --- a/core/pref.h +++ b/core/pref.h @@ -123,6 +123,7 @@ struct preferences { bool filterFullTextNotes; // mobile only - include notes information in full text searh bool filterCaseSensitive; // mobile only - make fltering case sensitive bool extraEnvironmentalDefault; + bool salinityEditDefault; // ********** Geocoding ********** geocoding_prefs_t geocoding; diff --git a/core/settings/qPrefLog.cpp b/core/settings/qPrefLog.cpp index c35abe252..97d400e3c 100644 --- a/core/settings/qPrefLog.cpp +++ b/core/settings/qPrefLog.cpp @@ -16,6 +16,7 @@ void qPrefLog::loadSync(bool doSync) disk_default_file_behavior(doSync); disk_use_default_file(doSync); disk_extraEnvironmentalDefault(doSync); + disk_salinityEditDefault(doSync); disk_show_average_depth(doSync); } @@ -54,5 +55,7 @@ HANDLE_PREFERENCE_BOOL(Log, "extraEnvironmentalDefault", extraEnvironmentalDefau HANDLE_PREFERENCE_BOOL(Log, "use_default_file", use_default_file); +HANDLE_PREFERENCE_BOOL(Log, "salinityEditDefault", salinityEditDefault); + HANDLE_PREFERENCE_BOOL(Log, "show_average_depth", show_average_depth); diff --git a/core/settings/qPrefLog.h b/core/settings/qPrefLog.h index ee40bc9e7..943e43e80 100644 --- a/core/settings/qPrefLog.h +++ b/core/settings/qPrefLog.h @@ -11,9 +11,9 @@ class qPrefLog : public QObject { Q_PROPERTY(enum def_file_behavior default_file_behavior READ default_file_behavior WRITE set_default_file_behavior NOTIFY default_file_behaviorChanged) Q_PROPERTY(bool use_default_file READ use_default_file WRITE set_use_default_file NOTIFY use_default_fileChanged) Q_PROPERTY(bool extraEnvironmentalDefault READ extraEnvironmentalDefault WRITE set_extraEnvironmentalDefault NOTIFY extraEnvironmentalDefaultChanged); + Q_PROPERTY(bool salinityEditDefault READ salinityEditDefault WRITE set_salinityEditDefault NOTIFY salinityEditDefaultChanged); Q_PROPERTY(bool show_average_depth READ show_average_depth WRITE set_show_average_depth NOTIFY show_average_depthChanged) - public: static qPrefLog *instance(); @@ -27,6 +27,7 @@ public: static enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; } static bool use_default_file() { return prefs.use_default_file; } static bool extraEnvironmentalDefault() { return prefs.extraEnvironmentalDefault; } + static bool salinityEditDefault() { return prefs.salinityEditDefault; } static bool show_average_depth() { return prefs.show_average_depth; } public slots: @@ -34,6 +35,7 @@ public slots: static void set_default_file_behavior(enum def_file_behavior value); static void set_use_default_file(bool value); static void set_extraEnvironmentalDefault(bool value); + static void set_salinityEditDefault(bool value); static void set_show_average_depth(bool value); signals: @@ -41,6 +43,7 @@ signals: void default_file_behaviorChanged(enum def_file_behavior value); void use_default_fileChanged(bool value); void extraEnvironmentalDefaultChanged(bool value); + void salinityEditDefaultChanged(bool value); void show_average_depthChanged(bool value); private: @@ -50,6 +53,7 @@ private: static void disk_default_file_behavior(bool doSync); static void disk_use_default_file(bool doSync); static void disk_extraEnvironmentalDefault(bool doSync); + static void disk_salinityEditDefault(bool doSync); static void disk_show_average_depth(bool doSync); }; diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 98e33a2ff..ca1b51acb 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -27,6 +27,7 @@ void PreferencesDefaults::refreshSettings() ui->font->setCurrentFont(qPrefDisplay::divelist_font()); ui->fontsize->setValue(qPrefDisplay::font_size()); ui->velocitySlider->setValue(qPrefDisplay::animation_speed()); + } void PreferencesDefaults::syncSettings() diff --git a/desktop-widgets/preferences/preferences_log.cpp b/desktop-widgets/preferences/preferences_log.cpp index 9025945e3..d9f33e6c7 100644 --- a/desktop-widgets/preferences/preferences_log.cpp +++ b/desktop-widgets/preferences/preferences_log.cpp @@ -70,6 +70,7 @@ void PreferencesLog::refreshSettings() ui->show_average_depth->setChecked(prefs.show_average_depth); ui->displayinvalid->setChecked(qPrefDisplay::display_invalid_dives()); ui->extraEnvironmentalDefault->setChecked(prefs.extraEnvironmentalDefault); + ui->salinityEditDefault->setChecked(prefs.salinityEditDefault); } void PreferencesLog::syncSettings() @@ -87,4 +88,5 @@ void PreferencesLog::syncSettings() qPrefLog::set_show_average_depth(ui->show_average_depth->isChecked()); qPrefDisplay::set_display_invalid_dives(ui->displayinvalid->isChecked()); qPrefLog::set_extraEnvironmentalDefault(ui->extraEnvironmentalDefault->isChecked()); + qPrefLog::set_salinityEditDefault(ui->salinityEditDefault->isChecked()); } diff --git a/desktop-widgets/preferences/preferences_log.ui b/desktop-widgets/preferences/preferences_log.ui index 9d1214b92..1a5e33caf 100644 --- a/desktop-widgets/preferences/preferences_log.ui +++ b/desktop-widgets/preferences/preferences_log.ui @@ -130,6 +130,13 @@ </item> <item> + <widget class="QCheckBox" name="salinityEditDefault"> + <property name="text"> + <string>In the Information tab, allow editing of water salinity</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> |