diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-09-25 11:01:03 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-25 11:01:03 -0700 |
commit | fa2fcc4024440f96c23329a944b9ff9ff706a684 (patch) | |
tree | 5422b97901aeead6ae2dd33e1f860b81eecacba2 /core/subsurface-qt | |
parent | 9b4abca9f49bea9ce1c71bc34a976131bceb8584 (diff) | |
download | subsurface-fa2fcc4024440f96c23329a944b9ff9ff706a684.tar.gz |
Clean up group handling in SettingsObjectWrapper
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/subsurface-qt')
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 99 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 31 |
2 files changed, 61 insertions, 69 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 70d02f959..437bf7f56 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -9,7 +9,7 @@ #include "core/helpers.h" DiveComputerSettings::DiveComputerSettings(QObject *parent): - QObject(parent), group(QStringLiteral("DiveComputer")) + QObject(parent) { } @@ -80,7 +80,7 @@ void DiveComputerSettings::setDownloadMode(int mode) prefs.dive_computer.download_mode = mode; } -UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent), group("UpdateManager") +UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent) { } @@ -144,11 +144,9 @@ void UpdateManagerSettings::setNextCheck(const QDate& date) emit nextCheckChanged(date); } -static QString tecDetails = QStringLiteral("TecDetails"); PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent): - QObject(parent), - group("TecDetails") + QObject(parent) { } @@ -189,7 +187,7 @@ void PartialPressureGasSettings::setShowPo2(short value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("po2graph", value); prefs.pp_graphs.po2 = value; emit showPo2Changed(value); @@ -201,7 +199,7 @@ void PartialPressureGasSettings::setShowPn2(short value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("pn2graph", value); prefs.pp_graphs.pn2 = value; emit showPn2Changed(value); @@ -213,7 +211,7 @@ void PartialPressureGasSettings::setShowPhe(short value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("phegraph", value); prefs.pp_graphs.phe = value; emit showPheChanged(value); @@ -225,7 +223,7 @@ void PartialPressureGasSettings::setPo2Threshold(double value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("po2threshold", value); prefs.pp_graphs.po2_threshold = value; emit po2ThresholdChanged(value); @@ -237,7 +235,7 @@ void PartialPressureGasSettings::setPn2Threshold(double value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("pn2threshold", value); prefs.pp_graphs.pn2_threshold = value; emit pn2ThresholdChanged(value); @@ -249,7 +247,7 @@ void PartialPressureGasSettings::setPheThreshold(double value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("phethreshold", value); prefs.pp_graphs.phe_threshold = value; emit pheThresholdChanged(value); @@ -387,7 +385,7 @@ void TechnicalDetailsSettings::setModp02(double value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("modpO2", value); prefs.modpO2 = value; emit modpO2Changed(value); @@ -399,7 +397,7 @@ void TechnicalDetailsSettings::setShowPicturesInProfile(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("show_pictures_in_profile", value); prefs.show_pictures_in_profile = value; emit showPicturesInProfileChanged(value); @@ -411,7 +409,7 @@ void TechnicalDetailsSettings::setEad(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("ead", value); prefs.ead = value; emit eadChanged(value); @@ -423,7 +421,7 @@ void TechnicalDetailsSettings::setMod(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("mod", value); prefs.mod = value; emit modChanged(value); @@ -435,7 +433,7 @@ void TechnicalDetailsSettings::setDCceiling(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("dcceiling", value); prefs.dcceiling = value; emit dcceilingChanged(value); @@ -447,7 +445,7 @@ void TechnicalDetailsSettings::setRedceiling(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("redceiling", value); prefs.redceiling = value; emit redceilingChanged(value); @@ -459,7 +457,7 @@ void TechnicalDetailsSettings::setCalcceiling(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("calcceiling", value); prefs.calcceiling = value; emit calcceilingChanged(value); @@ -471,7 +469,7 @@ void TechnicalDetailsSettings::setCalcceiling3m(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("calcceiling3m", value); prefs.calcceiling3m = value; emit calcceiling3mChanged(value); @@ -483,7 +481,7 @@ void TechnicalDetailsSettings::setCalcalltissues(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("calcalltissues", value); prefs.calcalltissues = value; emit calcalltissuesChanged(value); @@ -495,7 +493,7 @@ void TechnicalDetailsSettings::setCalcndltts(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("calcndltts", value); prefs.calcndltts = value; emit calcndlttsChanged(value); @@ -507,7 +505,7 @@ void TechnicalDetailsSettings::setGflow(int value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("gflow", value); prefs.gflow = value; set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); @@ -520,7 +518,7 @@ void TechnicalDetailsSettings::setGfhigh(int value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("gfhigh", value); prefs.gfhigh = value; set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); @@ -533,7 +531,7 @@ void TechnicalDetailsSettings::setVpmbConservatism(short value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("vpmb_conservatism", value); prefs.vpmb_conservatism = value; set_vpmb_conservatism(value); @@ -546,7 +544,7 @@ void TechnicalDetailsSettings::setHRgraph(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("hrgraph", value); prefs.hrgraph = value; emit hrgraphChanged(value); @@ -558,7 +556,7 @@ void TechnicalDetailsSettings::setTankBar(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("tankbar", value); prefs.tankbar = value; emit tankBarChanged(value); @@ -570,7 +568,7 @@ void TechnicalDetailsSettings::setPercentageGraph(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("percentagegraph", value); prefs.percentagegraph = value; emit percentageGraphChanged(value); @@ -582,7 +580,7 @@ void TechnicalDetailsSettings::setRulerGraph(bool value) return; /* TODO: search for the QSettings of the RulerBar */ QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("RulerBar", value); prefs.rulergraph = value; emit rulerGraphChanged(value); @@ -594,7 +592,7 @@ void TechnicalDetailsSettings::setShowCCRSetpoint(bool value) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("show_ccr_setpoint", value); prefs.show_ccr_setpoint = value; emit showCCRSetpointChanged(value); @@ -605,7 +603,7 @@ void TechnicalDetailsSettings::setShowCCRSensors(bool value) if (value == prefs.show_ccr_sensors) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("show_ccr_sensors", value); prefs.show_ccr_sensors = value; emit showCCRSensorsChanged(value); @@ -616,7 +614,7 @@ void TechnicalDetailsSettings::setZoomedPlot(bool value) if (value == prefs.zoomed_plot) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("zoomed_plot", value); prefs.zoomed_plot = value; emit zoomedPlotChanged(value); @@ -627,7 +625,7 @@ void TechnicalDetailsSettings::setShowSac(bool value) if (value == prefs.show_sac) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("show_sac", value); prefs.show_sac = value; emit showSacChanged(value); @@ -638,7 +636,7 @@ void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value) if (value == prefs.gf_low_at_maxdepth) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("gf_low_at_maxdepth", value); prefs.gf_low_at_maxdepth = value; set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); @@ -650,7 +648,7 @@ void TechnicalDetailsSettings::setDisplayUnusedTanks(bool value) if (value == prefs.display_unused_tanks) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("display_unused_tanks", value); prefs.display_unused_tanks = value; emit displayUnusedTanksChanged(value); @@ -661,7 +659,7 @@ void TechnicalDetailsSettings::setShowAverageDepth(bool value) if (value == prefs.show_average_depth) return; QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(group); s.setValue("show_average_depth", value); prefs.show_average_depth = value; emit showAverageDepthChanged(value); @@ -731,8 +729,7 @@ void FacebookSettings::setAlbumId(const QString& value) GeocodingPreferences::GeocodingPreferences(QObject *parent) : - QObject(parent), - group(QStringLiteral("geocoding")) + QObject(parent) { } @@ -834,8 +831,7 @@ void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value) } ProxySettings::ProxySettings(QObject *parent) : - QObject(parent), - group(QStringLiteral("Network")) + QObject(parent) { } @@ -939,8 +935,7 @@ void ProxySettings::setPass(const QString& value) } CloudStorageSettings::CloudStorageSettings(QObject *parent) : - QObject(parent), - group(QStringLiteral("CloudStorage")) + QObject(parent) { } @@ -1137,8 +1132,7 @@ void CloudStorageSettings::setGitLocalOnly(bool value) } DivePlannerSettings::DivePlannerSettings(QObject *parent) : - QObject(parent), - group(QStringLiteral("Planner")) + QObject(parent) { } @@ -1510,8 +1504,7 @@ void DivePlannerSettings::setDecoMode(deco_mode value) } UnitsSettings::UnitsSettings(QObject *parent) : - QObject(parent), - group(QStringLiteral("Units")) + QObject(parent) { } @@ -1662,8 +1655,7 @@ void UnitsSettings::setUnitSystem(const QString& value) } GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) : - QObject(parent), - group(QStringLiteral("GeneralSettings")) + QObject(parent) { } @@ -1793,8 +1785,7 @@ void GeneralSettingsObjectWrapper::setPscrRatio(int value) } DisplaySettingsObjectWrapper::DisplaySettingsObjectWrapper(QObject *parent) : - QObject(parent), - group(QStringLiteral("Display")) + QObject(parent) { } @@ -1860,8 +1851,7 @@ void DisplaySettingsObjectWrapper::setDisplayInvalidDives(short value) } LanguageSettingsObjectWrapper::LanguageSettingsObjectWrapper(QObject *parent) : - QObject(parent), - group("Language") + QObject(parent) { } @@ -1992,9 +1982,7 @@ void LanguageSettingsObjectWrapper::setDateFormatOverride(bool value) } AnimationsSettingsObjectWrapper::AnimationsSettingsObjectWrapper(QObject* parent): - QObject(parent), - group("Animations") - + QObject(parent) { } @@ -2016,8 +2004,7 @@ void AnimationsSettingsObjectWrapper::setAnimationSpeed(int value) } LocationServiceSettingsObjectWrapper::LocationServiceSettingsObjectWrapper(QObject* parent): - QObject(parent), - group("locationService") + QObject(parent) { } diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index d3e51546f..1ab32083b 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -37,9 +37,10 @@ signals: void deviceChanged(const QString& device); void downloadModeChanged(int mode); private: - QString group; + const QString group = QStringLiteral("DiveComputer"); }; + class UpdateManagerSettings : public QObject { Q_OBJECT Q_PROPERTY(bool dont_check_for_updates READ dontCheckForUpdates WRITE setDontCheckForUpdates NOTIFY dontCheckForUpdatesChanged) @@ -62,7 +63,7 @@ signals: void lastVersionUsedChanged(const QString& value); void nextCheckChanged(const QDate& date); private: - QString group; + const QString group = QStringLiteral("UpdateManager"); }; /* Control the state of the Partial Pressure Graphs preferences */ @@ -99,8 +100,9 @@ signals: void po2ThresholdChanged(double value); void pn2ThresholdChanged(double value); void pheThresholdChanged(double value); + private: - QString group; + const QString group = QStringLiteral("TecDetails"); }; class TechnicalDetailsSettings : public QObject { @@ -208,6 +210,9 @@ signals: void displayUnusedTanksChanged(bool value); void showAverageDepthChanged(bool value); void showPicturesInProfileChanged(bool value); + +private: + const QString group = QStringLiteral("TecDetails"); }; /* Control the state of the Facebook preferences */ @@ -271,7 +276,7 @@ signals: void secondTaxonomyCategoryChanged(taxonomy_category value); void thirdTaxonomyCategoryChanged(taxonomy_category value); private: - QString group; + const QString group = QStringLiteral("geocoding"); }; class ProxySettings : public QObject { @@ -308,7 +313,7 @@ signals: void userChanged(const QString& value); void passChanged(const QString& value); private: - QString group; + const QString group = QStringLiteral("Network"); }; class CloudStorageSettings : public QObject { @@ -369,7 +374,7 @@ signals: void saveUserIdLocalChanged(short value); private: - QString group; + const QString group = QStringLiteral("CloudStorage"); }; class DivePlannerSettings : public QObject { @@ -471,7 +476,7 @@ signals: void decoModeChanged(deco_mode value); private: - QString group; + const QString group = QStringLiteral("Planner"); }; class UnitsSettings : public QObject { @@ -516,7 +521,7 @@ signals: void unitSystemChanged(const QString& value); void coordinatesTraditionalChanged(bool value); private: - QString group; + const QString group = QStringLiteral("Units"); }; class GeneralSettingsObjectWrapper : public QObject { @@ -557,7 +562,7 @@ signals: void o2ConsumptionChanged(int value); void pscrRatioChanged(int value); private: - QString group; + const QString group = QStringLiteral("GeneralSettings"); }; class DisplaySettingsObjectWrapper : public QObject { @@ -579,7 +584,7 @@ signals: void fontSizeChanged(double value); void displayInvalidDivesChanged(short value); private: - QString group; + const QString group = QStringLiteral("Display"); }; class LanguageSettingsObjectWrapper : public QObject { @@ -621,7 +626,7 @@ signals: void useSystemLanguageChanged(bool value); private: - QString group; + const QString group = QStringLiteral("Language"); }; class AnimationsSettingsObjectWrapper : public QObject { @@ -638,7 +643,7 @@ signals: void animationSpeedChanged(int value); private: - QString group; + const QString group = QStringLiteral("Animations"); }; class LocationServiceSettingsObjectWrapper : public QObject { @@ -656,7 +661,7 @@ signals: void timeThresholdChanged(int value); void distanceThresholdChanged(int value); private: - QString group; + const QString group = QStringLiteral("locationService"); }; class SettingsObjectWrapper : public QObject { |