diff options
author | jan Iversen <jani@apache.org> | 2018-08-05 10:57:24 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-12 07:36:10 -0700 |
commit | cb2dc7515b3b14eed268ff580b30759d2c2272a5 (patch) | |
tree | 1c5c2e29308890e1ec9627d46d3f1065a7eda101 /core | |
parent | b98ba9ba94cb4d7293daa80139c6bd7ecda882fe (diff) | |
download | subsurface-cb2dc7515b3b14eed268ff580b30759d2c2272a5.tar.gz |
core: activate qPrefTechnicalDetails
remove TechnicalDetails from SettingsObjectWrapper and reference qPrefTechnicalDetails
update files using SettingsObjectWrapper/TechnicalDetails to use qPrefTechnicalDetails
this activated qPrefTechnicalDetails and removed the similar class from
SettingsObjectWrapper.
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/settings/qPref.cpp | 1 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 488 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 123 |
3 files changed, 5 insertions, 607 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp index c5f2e663c..cd93fe44e 100644 --- a/core/settings/qPref.cpp +++ b/core/settings/qPref.cpp @@ -21,6 +21,7 @@ void qPref::loadSync(bool doSync) qPrefDivePlanner::instance()->loadSync(doSync); // qPrefFaceook does not use disk. qPrefProxy::instance()->loadSync(doSync); + qPrefTechnicalDetails::instance()->loadSync(doSync); qPrefUnits::instance()->loadSync(doSync); qPrefUpdateManager::instance()->loadSync(doSync); } diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index dcc2427c9..224e314a5 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -134,452 +134,6 @@ void PartialPressureGasSettings::setPheThreshold(double value) emit pheThresholdChanged(value); } - -TechnicalDetailsSettings::TechnicalDetailsSettings(QObject* parent): QObject(parent) -{ - -} - -deco_mode TechnicalDetailsSettings::deco() const -{ - - return prefs.display_deco_mode; -} - -void TechnicalDetailsSettings::setDecoMode(deco_mode d) -{ - if (prefs.display_deco_mode == d) - return; - - prefs.display_deco_mode = d; - QSettings s; - s.beginGroup(group); - s.setValue("display_deco_mode", d); - emit decoModeChanged(d); -} - -double TechnicalDetailsSettings:: modpO2() const -{ - return prefs.modpO2; -} - -bool TechnicalDetailsSettings::ead() const -{ - return prefs.ead; -} - -bool TechnicalDetailsSettings::dcceiling() const -{ - return prefs.dcceiling; -} - -bool TechnicalDetailsSettings::redceiling() const -{ - return prefs.redceiling; -} - -bool TechnicalDetailsSettings::calcceiling() const -{ - return prefs.calcceiling; -} - -bool TechnicalDetailsSettings::calcceiling3m() const -{ - return prefs.calcceiling3m; -} - -bool TechnicalDetailsSettings::calcalltissues() const -{ - return prefs.calcalltissues; -} - -bool TechnicalDetailsSettings::calcndltts() const -{ - return prefs.calcndltts; -} - -int TechnicalDetailsSettings::gflow() const -{ - return prefs.gflow; -} - -int TechnicalDetailsSettings::gfhigh() const -{ - return prefs.gfhigh; -} - -short TechnicalDetailsSettings::vpmbConservatism() const -{ - return prefs.vpmb_conservatism; -} - -bool TechnicalDetailsSettings::hrgraph() const -{ - return prefs.hrgraph; -} - -bool TechnicalDetailsSettings::tankBar() const -{ - return prefs.tankbar; -} - -bool TechnicalDetailsSettings::percentageGraph() const -{ - return prefs.percentagegraph; -} - -bool TechnicalDetailsSettings::rulerGraph() const -{ - return prefs.rulergraph; -} - -bool TechnicalDetailsSettings::showSCROCpO2() const -{ - return prefs.show_scr_ocpo2; -} - -bool TechnicalDetailsSettings::showCCRSetpoint() const -{ - return prefs.show_ccr_setpoint; -} - -bool TechnicalDetailsSettings::showCCRSensors() const -{ - return prefs.show_ccr_sensors; -} - -bool TechnicalDetailsSettings::zoomedPlot() const -{ - return prefs.zoomed_plot; -} - -bool TechnicalDetailsSettings::showSac() const -{ - return prefs.show_sac; -} - -bool TechnicalDetailsSettings::displayUnusedTanks() const -{ - return prefs.display_unused_tanks; -} - -bool TechnicalDetailsSettings::showAverageDepth() const -{ - return prefs.show_average_depth; -} - -bool TechnicalDetailsSettings::showIcd() const -{ - return prefs.show_icd; -} - -bool TechnicalDetailsSettings::mod() const -{ - return prefs.mod; -} - -bool TechnicalDetailsSettings::showPicturesInProfile() const -{ - return prefs.show_pictures_in_profile; -} - -void TechnicalDetailsSettings::setModpO2(double value) -{ - if (value == prefs.modpO2) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("modpO2", value); - prefs.modpO2 = value; - emit modpO2Changed(value); -} - -void TechnicalDetailsSettings::setShowPicturesInProfile(bool value) -{ - if (value == prefs.show_pictures_in_profile) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("show_pictures_in_profile", value); - prefs.show_pictures_in_profile = value; - emit showPicturesInProfileChanged(value); -} - -void TechnicalDetailsSettings::setEad(bool value) -{ - if (value == prefs.ead) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("ead", value); - prefs.ead = value; - emit eadChanged(value); -} - -void TechnicalDetailsSettings::setMod(bool value) -{ - if (value == prefs.mod) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("mod", value); - prefs.mod = value; - emit modChanged(value); -} - -void TechnicalDetailsSettings::setDCceiling(bool value) -{ - if (value == prefs.dcceiling) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("dcceiling", value); - prefs.dcceiling = value; - emit dcceilingChanged(value); -} - -void TechnicalDetailsSettings::setRedceiling(bool value) -{ - if (value == prefs.redceiling) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("redceiling", value); - prefs.redceiling = value; - emit redceilingChanged(value); -} - -void TechnicalDetailsSettings::setCalcceiling(bool value) -{ - if (value == prefs.calcceiling) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("calcceiling", value); - prefs.calcceiling = value; - emit calcceilingChanged(value); -} - -void TechnicalDetailsSettings::setCalcceiling3m(bool value) -{ - if (value == prefs.calcceiling3m) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("calcceiling3m", value); - prefs.calcceiling3m = value; - emit calcceiling3mChanged(value); -} - -void TechnicalDetailsSettings::setCalcalltissues(bool value) -{ - if (value == prefs.calcalltissues) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("calcalltissues", value); - prefs.calcalltissues = value; - emit calcalltissuesChanged(value); -} - -void TechnicalDetailsSettings::setCalcndltts(bool value) -{ - if (value == prefs.calcndltts) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("calcndltts", value); - prefs.calcndltts = value; - emit calcndlttsChanged(value); -} - -void TechnicalDetailsSettings::setGflow(int value) -{ - if (value == prefs.gflow) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("gflow", value); - prefs.gflow = value; - set_gf(prefs.gflow, prefs.gfhigh); - emit gflowChanged(value); -} - -void TechnicalDetailsSettings::setGfhigh(int value) -{ - if (value == prefs.gfhigh) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("gfhigh", value); - prefs.gfhigh = value; - set_gf(prefs.gflow, prefs.gfhigh); - emit gfhighChanged(value); -} - -void TechnicalDetailsSettings::setVpmbConservatism(short value) -{ - if (value == prefs.vpmb_conservatism) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("vpmb_conservatism", value); - prefs.vpmb_conservatism = value; - set_vpmb_conservatism(value); - emit vpmbConservatismChanged(value); -} - -void TechnicalDetailsSettings::setHRgraph(bool value) -{ - if (value == prefs.hrgraph) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("hrgraph", value); - prefs.hrgraph = value; - emit hrgraphChanged(value); -} - -void TechnicalDetailsSettings::setTankBar(bool value) -{ - if (value == prefs.tankbar) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("tankbar", value); - prefs.tankbar = value; - emit tankBarChanged(value); -} - -void TechnicalDetailsSettings::setPercentageGraph(bool value) -{ - if (value == prefs.percentagegraph) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("percentagegraph", value); - prefs.percentagegraph = value; - emit percentageGraphChanged(value); -} - -void TechnicalDetailsSettings::setRulerGraph(bool value) -{ - if (value == prefs.rulergraph) - return; - /* TODO: search for the QSettings of the RulerBar */ - QSettings s; - s.beginGroup(group); - s.setValue("RulerBar", value); - prefs.rulergraph = value; - emit rulerGraphChanged(value); -} - -void TechnicalDetailsSettings::setShowCCRSetpoint(bool value) -{ - if (value == prefs.show_ccr_setpoint) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("show_ccr_setpoint", value); - prefs.show_ccr_setpoint = value; - emit showCCRSetpointChanged(value); -} - -void TechnicalDetailsSettings::setShowSCROCpO2(bool value) -{ - if (value == prefs.show_scr_ocpo2) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("show_scr_ocpo2", value); - prefs.show_scr_ocpo2 = value; - emit showSCROCpO2Changed(value); -} - -void TechnicalDetailsSettings::setShowCCRSensors(bool value) -{ - if (value == prefs.show_ccr_sensors) - return; - QSettings s; - s.beginGroup(group); - s.setValue("show_ccr_sensors", value); - prefs.show_ccr_sensors = value; - emit showCCRSensorsChanged(value); -} - -void TechnicalDetailsSettings::setZoomedPlot(bool value) -{ - if (value == prefs.zoomed_plot) - return; - QSettings s; - s.beginGroup(group); - s.setValue("zoomed_plot", value); - prefs.zoomed_plot = value; - emit zoomedPlotChanged(value); -} - -void TechnicalDetailsSettings::setShowSac(bool value) -{ - if (value == prefs.show_sac) - return; - QSettings s; - s.beginGroup(group); - s.setValue("show_sac", value); - prefs.show_sac = value; - emit showSacChanged(value); -} - -void TechnicalDetailsSettings::setDisplayUnusedTanks(bool value) -{ - if (value == prefs.display_unused_tanks) - return; - QSettings s; - s.beginGroup(group); - s.setValue("display_unused_tanks", value); - prefs.display_unused_tanks = value; - emit displayUnusedTanksChanged(value); -} - -void TechnicalDetailsSettings::setShowAverageDepth(bool value) -{ - if (value == prefs.show_average_depth) - return; - QSettings s; - s.beginGroup(group); - s.setValue("show_average_depth", value); - prefs.show_average_depth = value; - emit showAverageDepthChanged(value); -} - -void TechnicalDetailsSettings::setShowIcd(bool value) -{ - if (value == prefs.show_icd) - return; - QSettings s; - s.beginGroup(group); - s.setValue("show_icd", value); - prefs.show_icd = value; - emit showIcdChanged(value); -} - GeocodingPreferences::GeocodingPreferences(QObject *parent) : QObject(parent) { @@ -1018,7 +572,7 @@ void LocationServiceSettingsObjectWrapper::setTimeThreshold(int value) SettingsObjectWrapper::SettingsObjectWrapper(QObject* parent): QObject(parent), - techDetails(new TechnicalDetailsSettings(this)), + techDetails(new qPrefTechnicalDetails(this)), pp_gas(new PartialPressureGasSettings(this)), facebook(new qPrefFacebook(this)), geocoding(new GeocodingPreferences(this)), @@ -1044,45 +598,7 @@ void SettingsObjectWrapper::load() uiLanguage(NULL); qPrefUnits::instance()->load(); - - s.beginGroup("TecDetails"); - GET_BOOL("po2graph", pp_graphs.po2); - GET_BOOL("pn2graph", pp_graphs.pn2); - GET_BOOL("phegraph", pp_graphs.phe); - GET_DOUBLE("po2thresholdmin", pp_graphs.po2_threshold_min); - GET_DOUBLE("po2thresholdmax", pp_graphs.po2_threshold_max); - GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold); - GET_DOUBLE("phethreshold", pp_graphs.phe_threshold); - GET_BOOL("mod", mod); - GET_DOUBLE("modpO2", modpO2); - GET_BOOL("ead", ead); - GET_BOOL("redceiling", redceiling); - GET_BOOL("dcceiling", dcceiling); - GET_BOOL("calcceiling", calcceiling); - GET_BOOL("calcceiling3m", calcceiling3m); - GET_BOOL("calcndltts", calcndltts); - GET_BOOL("calcalltissues", calcalltissues); - GET_BOOL("hrgraph", hrgraph); - GET_BOOL("tankbar", tankbar); - GET_BOOL("RulerBar", rulergraph); - GET_BOOL("percentagegraph", percentagegraph); - GET_INT("gflow", gflow); - GET_INT("gfhigh", gfhigh); - GET_INT("vpmb_conservatism", vpmb_conservatism); - GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); - GET_BOOL("show_ccr_setpoint",show_ccr_setpoint); - GET_BOOL("show_ccr_sensors",show_ccr_sensors); - GET_BOOL("show_scr_ocpo2",show_scr_ocpo2); - GET_BOOL("zoomed_plot", zoomed_plot); - set_gf(prefs.gflow, prefs.gfhigh); - set_vpmb_conservatism(prefs.vpmb_conservatism); - GET_BOOL("show_sac", show_sac); - GET_BOOL("display_unused_tanks", display_unused_tanks); - GET_BOOL("show_average_depth", show_average_depth); - GET_BOOL("show_icd", show_icd); - GET_BOOL("show_pictures_in_profile", show_pictures_in_profile); - prefs.display_deco_mode = (deco_mode) s.value("display_deco_mode").toInt(); - s.endGroup(); + qPrefTechnicalDetails::instance()->load(); s.beginGroup("GeneralSettings"); GET_TXT("default_filename", default_filename); diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 95c5b8592..7b84f26d5 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -56,125 +56,6 @@ private: const QString group = QStringLiteral("TecDetails"); }; -class TechnicalDetailsSettings : public QObject { - Q_OBJECT - Q_PROPERTY(double modpO2 READ modpO2 WRITE setModpO2 NOTIFY modpO2Changed) - Q_PROPERTY(bool ead READ ead WRITE setEad NOTIFY eadChanged) - Q_PROPERTY(bool mod READ mod WRITE setMod NOTIFY modChanged) - Q_PROPERTY(bool dcceiling READ dcceiling WRITE setDCceiling NOTIFY dcceilingChanged) - Q_PROPERTY(bool redceiling READ redceiling WRITE setRedceiling NOTIFY redceilingChanged) - Q_PROPERTY(bool calcceiling READ calcceiling WRITE setCalcceiling NOTIFY calcceilingChanged) - Q_PROPERTY(bool calcceiling3m READ calcceiling3m WRITE setCalcceiling3m NOTIFY calcceiling3mChanged) - Q_PROPERTY(bool calcalltissues READ calcalltissues WRITE setCalcalltissues NOTIFY calcalltissuesChanged) - Q_PROPERTY(bool calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged) - Q_PROPERTY(int gflow READ gflow WRITE setGflow NOTIFY gflowChanged) - Q_PROPERTY(int gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged) - Q_PROPERTY(short vpmb_conservatism READ vpmbConservatism WRITE setVpmbConservatism NOTIFY vpmbConservatismChanged) - Q_PROPERTY(bool hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged) - Q_PROPERTY(bool tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged) - Q_PROPERTY(bool percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged) - Q_PROPERTY(bool rulergraph READ rulerGraph WRITE setRulerGraph NOTIFY rulerGraphChanged) - Q_PROPERTY(bool show_ccr_setpoint READ showCCRSetpoint WRITE setShowCCRSetpoint NOTIFY showCCRSetpointChanged) - Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged) - Q_PROPERTY(bool show_scr_ocpo2 READ showSCROCpO2 WRITE setShowSCROCpO2 NOTIFY showSCROCpO2Changed) - Q_PROPERTY(bool zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged) - Q_PROPERTY(bool show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged) - Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged) - Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) - Q_PROPERTY(bool show_icd READ showIcd WRITE setShowIcd NOTIFY showIcdChanged) - Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged) - Q_PROPERTY(deco_mode deco READ deco WRITE setDecoMode NOTIFY decoModeChanged) - -public: - TechnicalDetailsSettings(QObject *parent); - - double modpO2() const; - bool ead() const; - bool mod() const; - bool dcceiling() const; - bool redceiling() const; - bool calcceiling() const; - bool calcceiling3m() const; - bool calcalltissues() const; - bool calcndltts() const; - int gflow() const; - int gfhigh() const; - short vpmbConservatism() const; - bool hrgraph() const; - bool tankBar() const; - bool percentageGraph() const; - bool rulerGraph() const; - bool showCCRSetpoint() const; - bool showCCRSensors() const; - bool showSCROCpO2() const; - bool zoomedPlot() const; - bool showSac() const; - bool displayUnusedTanks() const; - bool showAverageDepth() const; - bool showIcd() const; - bool showPicturesInProfile() const; - deco_mode deco() const; - -public slots: - void setMod(bool value); - void setModpO2(double value); - void setEad(bool value); - void setDCceiling(bool value); - void setRedceiling(bool value); - void setCalcceiling(bool value); - void setCalcceiling3m(bool value); - void setCalcalltissues(bool value); - void setCalcndltts(bool value); - void setGflow(int value); - void setGfhigh(int value); - void setVpmbConservatism(short); - void setHRgraph(bool value); - void setTankBar(bool value); - void setPercentageGraph(bool value); - void setRulerGraph(bool value); - void setShowCCRSetpoint(bool value); - void setShowCCRSensors(bool value); - void setShowSCROCpO2(bool value); - void setZoomedPlot(bool value); - void setShowSac(bool value); - void setDisplayUnusedTanks(bool value); - void setShowAverageDepth(bool value); - void setShowIcd(bool value); - void setShowPicturesInProfile(bool value); - void setDecoMode(deco_mode d); - -signals: - void modpO2Changed(double value); - void eadChanged(bool value); - void modChanged(bool value); - void dcceilingChanged(bool value); - void redceilingChanged(bool value); - void calcceilingChanged(bool value); - void calcceiling3mChanged(bool value); - void calcalltissuesChanged(bool value); - void calcndlttsChanged(bool value); - void gflowChanged(int value); - void gfhighChanged(int value); - void vpmbConservatismChanged(short value); - void hrgraphChanged(bool value); - void tankBarChanged(bool value); - void percentageGraphChanged(bool value); - void rulerGraphChanged(bool value); - void showCCRSetpointChanged(bool value); - void showCCRSensorsChanged(bool value); - void showSCROCpO2Changed(bool value); - void zoomedPlotChanged(bool value); - void showSacChanged(bool value); - void displayUnusedTanksChanged(bool value); - void showAverageDepthChanged(bool value); - void showIcdChanged(bool value); - void showPicturesInProfileChanged(bool value); - void decoModeChanged(deco_mode m); - -private: - const QString group = QStringLiteral("TecDetails"); -}; - /* Control the state of the Geocoding preferences */ class GeocodingPreferences : public QObject { Q_OBJECT @@ -323,7 +204,7 @@ private: class SettingsObjectWrapper : public QObject { Q_OBJECT - Q_PROPERTY(TechnicalDetailsSettings* techical_details MEMBER techDetails CONSTANT) + Q_PROPERTY(qPrefTechnicalDetails* techical_details MEMBER techDetails CONSTANT) Q_PROPERTY(PartialPressureGasSettings* pp_gas MEMBER pp_gas CONSTANT) Q_PROPERTY(qPrefFacebook* facebook MEMBER facebook CONSTANT) Q_PROPERTY(GeocodingPreferences* geocoding MEMBER geocoding CONSTANT) @@ -342,7 +223,7 @@ class SettingsObjectWrapper : public QObject { public: static SettingsObjectWrapper *instance(); - TechnicalDetailsSettings *techDetails; + qPrefTechnicalDetails *techDetails; PartialPressureGasSettings *pp_gas; qPrefFacebook *facebook; GeocodingPreferences *geocoding; |