diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-11-18 16:06:41 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-20 20:56:13 +0100 |
commit | dd8e4fae2aa31f1fac2a8a6f086db0db0a3209c6 (patch) | |
tree | 5bf0f8872a35f71430733c9766bc70ad65cea499 /core/subsurface-qt/SettingsObjectWrapper.cpp | |
parent | e762fd2d416cbe77669a83e302709aa3fbda68f7 (diff) | |
download | subsurface-dd8e4fae2aa31f1fac2a8a6f086db0db0a3209c6.tar.gz |
Make handling of booleans consistent on the C++-side of preferences
In general, the C++-side of the preferences code consistently uses
the bool data type for boolean settings. There are five exceptions,
which use short instead:
showPo2
showPn2
showPhe
saveUserIdLocal
displayInvalidDives
This patch attempts to make the code more consistent by turning
these into bools as well.
Tests showed that writing as short and reading as bool is handled
gracefully by the Qt variant code. Therefore, an upgrade should not
cause user-visible changes to their settings.
As a bonus, two extern declarations of the set_save_userid_local()
function, which is not defined anywhere, were removed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 16f4471ed..7fc738461 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -169,17 +169,17 @@ PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent): } -short PartialPressureGasSettings::showPo2() const +bool PartialPressureGasSettings::showPo2() const { return prefs.pp_graphs.po2; } -short PartialPressureGasSettings::showPn2() const +bool PartialPressureGasSettings::showPn2() const { return prefs.pp_graphs.pn2; } -short PartialPressureGasSettings::showPhe() const +bool PartialPressureGasSettings::showPhe() const { return prefs.pp_graphs.phe; } @@ -205,7 +205,7 @@ double PartialPressureGasSettings::pheThreshold() const return prefs.pp_graphs.phe_threshold; } -void PartialPressureGasSettings::setShowPo2(short value) +void PartialPressureGasSettings::setShowPo2(bool value) { if (value == prefs.pp_graphs.po2) return; @@ -217,7 +217,7 @@ void PartialPressureGasSettings::setShowPo2(short value) emit showPo2Changed(value); } -void PartialPressureGasSettings::setShowPn2(short value) +void PartialPressureGasSettings::setShowPn2(bool value) { if (value == prefs.pp_graphs.pn2) return; @@ -229,7 +229,7 @@ void PartialPressureGasSettings::setShowPn2(short value) emit showPn2Changed(value); } -void PartialPressureGasSettings::setShowPhe(short value) +void PartialPressureGasSettings::setShowPhe(bool value) { if (value == prefs.pp_graphs.phe) return; @@ -1092,7 +1092,7 @@ void CloudStorageSettings::setBackgroundSync(bool value) emit backgroundSyncChanged(value); } -void CloudStorageSettings::setSaveUserIdLocal(short int value) +void CloudStorageSettings::setSaveUserIdLocal(bool value) { //TODO: this is not saved on disk? if (value == prefs.save_userid_local) @@ -1101,7 +1101,7 @@ void CloudStorageSettings::setSaveUserIdLocal(short int value) emit saveUserIdLocalChanged(value); } -short int CloudStorageSettings::saveUserIdLocal() const +bool CloudStorageSettings::saveUserIdLocal() const { return prefs.save_userid_local; } @@ -1895,7 +1895,7 @@ double DisplaySettingsObjectWrapper::fontSize() const return prefs.font_size; } -short DisplaySettingsObjectWrapper::displayInvalidDives() const +bool DisplaySettingsObjectWrapper::displayInvalidDives() const { return prefs.display_invalid_dives; } @@ -1937,7 +1937,7 @@ void DisplaySettingsObjectWrapper::setFontSize(double value) emit fontSizeChanged(value); } -void DisplaySettingsObjectWrapper::setDisplayInvalidDives(short value) +void DisplaySettingsObjectWrapper::setDisplayInvalidDives(bool value) { if (value == prefs.display_invalid_dives) return; @@ -2272,7 +2272,7 @@ void SettingsObjectWrapper::load() } defaultFont.setPointSizeF(prefs.font_size); qApp->setFont(defaultFont); - GET_INT("displayinvalid", display_invalid_dives); + GET_BOOL("displayinvalid", display_invalid_dives); s.endGroup(); s.beginGroup("Animations"); |