aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/settings/qPref.cpp1
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp456
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h119
3 files changed, 5 insertions, 571 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp
index 135cb6818..ede230236 100644
--- a/core/settings/qPref.cpp
+++ b/core/settings/qPref.cpp
@@ -18,6 +18,7 @@ void qPref::loadSync(bool doSync)
qPrefCloudStorage::instance()->loadSync(doSync);
qPrefDisplay::instance()->loadSync(doSync);
qPrefDiveComputer::instance()->loadSync(doSync);
+ qPrefDivePlanner::instance()->loadSync(doSync);
// qPrefFaceook does not use disk.
qPrefProxy::instance()->loadSync(doSync);
qPrefUnits::instance()->loadSync(doSync);
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 7997852e6..c31d3831b 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -715,429 +715,6 @@ void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value)
emit thirdTaxonomyCategoryChanged(value);
}
-DivePlannerSettings::DivePlannerSettings(QObject *parent) :
- QObject(parent)
-{
-}
-
-bool DivePlannerSettings::lastStop() const
-{
- return prefs.last_stop;
-}
-
-bool DivePlannerSettings::verbatimPlan() const
-{
- return prefs.verbatim_plan;
-}
-
-bool DivePlannerSettings::displayRuntime() const
-{
- return prefs.display_runtime;
-}
-
-bool DivePlannerSettings::displayDuration() const
-{
- return prefs.display_duration;
-}
-
-bool DivePlannerSettings::displayTransitions() const
-{
- return prefs.display_transitions;
-}
-
-bool DivePlannerSettings::displayVariations() const
-{
- return prefs.display_variations;
-}
-
-bool DivePlannerSettings::doo2breaks() const
-{
- return prefs.doo2breaks;
-}
-
-bool DivePlannerSettings::dropStoneMode() const
-{
- return prefs.drop_stone_mode;
-}
-
-bool DivePlannerSettings::safetyStop() const
-{
- return prefs.safetystop;
-}
-
-bool DivePlannerSettings::switchAtRequiredStop() const
-{
- return prefs.switch_at_req_stop;
-}
-
-int DivePlannerSettings::ascrate75() const
-{
- return prefs.ascrate75;
-}
-
-int DivePlannerSettings::ascrate50() const
-{
- return prefs.ascrate50;
-}
-
-int DivePlannerSettings::ascratestops() const
-{
- return prefs.ascratestops;
-}
-
-int DivePlannerSettings::ascratelast6m() const
-{
- return prefs.ascratelast6m;
-}
-
-int DivePlannerSettings::descrate() const
-{
- return prefs.descrate;
-}
-
-int DivePlannerSettings::sacfactor() const
-{
- return prefs.sacfactor;
-}
-
-int DivePlannerSettings::problemsolvingtime() const
-{
- return prefs.problemsolvingtime;
-}
-
-int DivePlannerSettings::bottompo2() const
-{
- return prefs.bottompo2;
-}
-
-int DivePlannerSettings::decopo2() const
-{
- return prefs.decopo2;
-}
-
-int DivePlannerSettings::bestmixend() const
-{
- return prefs.bestmixend.mm;
-}
-
-int DivePlannerSettings::reserveGas() const
-{
- return prefs.reserve_gas;
-}
-
-int DivePlannerSettings::minSwitchDuration() const
-{
- return prefs.min_switch_duration;
-}
-
-int DivePlannerSettings::bottomSac() const
-{
- return prefs.bottomsac;
-}
-
-int DivePlannerSettings::decoSac() const
-{
- return prefs.decosac;
-}
-
-deco_mode DivePlannerSettings::decoMode() const
-{
- return prefs.planner_deco_mode;
-}
-
-void DivePlannerSettings::setLastStop(bool value)
-{
- if (value == prefs.last_stop)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("last_stop", value);
- prefs.last_stop = value;
- emit lastStopChanged(value);
-}
-
-void DivePlannerSettings::setVerbatimPlan(bool value)
-{
- if (value == prefs.verbatim_plan)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("verbatim_plan", value);
- prefs.verbatim_plan = value;
- emit verbatimPlanChanged(value);
-}
-
-void DivePlannerSettings::setDisplayRuntime(bool value)
-{
- if (value == prefs.display_runtime)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("display_runtime", value);
- prefs.display_runtime = value;
- emit displayRuntimeChanged(value);
-}
-
-void DivePlannerSettings::setDisplayDuration(bool value)
-{
- if (value == prefs.display_duration)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("display_duration", value);
- prefs.display_duration = value;
- emit displayDurationChanged(value);
-}
-
-void DivePlannerSettings::setDisplayTransitions(bool value)
-{
- if (value == prefs.display_transitions)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("display_transitions", value);
- prefs.display_transitions = value;
- emit displayTransitionsChanged(value);
-}
-
-void DivePlannerSettings::setDisplayVariations(bool value)
-{
- if (value == prefs.display_variations)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("display_variations", value);
- prefs.display_variations = value;
- emit displayVariationsChanged(value);
-}
-
-void DivePlannerSettings::setDoo2breaks(bool value)
-{
- if (value == prefs.doo2breaks)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("doo2breaks", value);
- prefs.doo2breaks = value;
- emit doo2breaksChanged(value);
-}
-
-void DivePlannerSettings::setDropStoneMode(bool value)
-{
- if (value == prefs.drop_stone_mode)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("drop_stone_mode", value);
- prefs.drop_stone_mode = value;
- emit dropStoneModeChanged(value);
-}
-
-void DivePlannerSettings::setSafetyStop(bool value)
-{
- if (value == prefs.safetystop)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("safetystop", value);
- prefs.safetystop = value;
- emit safetyStopChanged(value);
-}
-
-void DivePlannerSettings::setSwitchAtRequiredStop(bool value)
-{
- if (value == prefs.switch_at_req_stop)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("switch_at_req_stop", value);
- prefs.switch_at_req_stop = value;
- emit switchAtRequiredStopChanged(value);
-}
-
-void DivePlannerSettings::setAscrate75(int value)
-{
- if (value == prefs.ascrate75)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("ascrate75", value);
- prefs.ascrate75 = value;
- emit ascrate75Changed(value);
-}
-
-void DivePlannerSettings::setAscrate50(int value)
-{
- if (value == prefs.ascrate50)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("ascrate50", value);
- prefs.ascrate50 = value;
- emit ascrate50Changed(value);
-}
-
-void DivePlannerSettings::setAscratestops(int value)
-{
- if (value == prefs.ascratestops)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("ascratestops", value);
- prefs.ascratestops = value;
- emit ascratestopsChanged(value);
-}
-
-void DivePlannerSettings::setAscratelast6m(int value)
-{
- if (value == prefs.ascratelast6m)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("ascratelast6m", value);
- prefs.ascratelast6m = value;
- emit ascratelast6mChanged(value);
-}
-
-void DivePlannerSettings::setDescrate(int value)
-{
- if (value == prefs.descrate)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("descrate", value);
- prefs.descrate = value;
- emit descrateChanged(value);
-}
-
-void DivePlannerSettings::setSacFactor(int value)
-{
- if (value == prefs.sacfactor)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("sacfactor", value);
- prefs.sacfactor = value;
- emit sacFactorChanged(value);
-}
-
-void DivePlannerSettings::setProblemSolvingTime(int value)
-{
- if (value == prefs.problemsolvingtime)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("problemsolvingtime", value);
- prefs.problemsolvingtime = value;
- emit problemSolvingTimeChanged(value);
-}
-
-void DivePlannerSettings::setBottompo2(int value)
-{
- if (value == prefs.bottompo2)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("bottompo2", value);
- prefs.bottompo2 = value;
- emit bottompo2Changed(value);
-}
-
-void DivePlannerSettings::setDecopo2(int value)
-{
- if (value == prefs.decopo2)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("decopo2", value);
- prefs.decopo2 = value;
- emit decopo2Changed(value);
-}
-
-void DivePlannerSettings::setBestmixend(int value)
-{
- if (value == prefs.bestmixend.mm)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("bestmixend", value);
- prefs.bestmixend.mm = value;
- emit bestmixendChanged(value);
-}
-
-void DivePlannerSettings::setReserveGas(int value)
-{
- if (value == prefs.reserve_gas)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("reserve_gas", value);
- prefs.reserve_gas = value;
- emit reserveGasChanged(value);
-}
-
-void DivePlannerSettings::setMinSwitchDuration(int value)
-{
- if (value == prefs.min_switch_duration)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("min_switch_duration", value);
- prefs.min_switch_duration = value;
- emit minSwitchDurationChanged(value);
-}
-
-void DivePlannerSettings::setBottomSac(int value)
-{
- if (value == prefs.bottomsac)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("bottomsac", value);
- prefs.bottomsac = value;
- emit bottomSacChanged(value);
-}
-
-void DivePlannerSettings::setDecoSac(int value)
-{
- if (value == prefs.decosac)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("decosac", value);
- prefs.decosac = value;
- emit decoSacChanged(value);
-}
-
-void DivePlannerSettings::setDecoMode(deco_mode value)
-{
- if (value == prefs.planner_deco_mode)
- return;
-
- QSettings s;
- s.beginGroup(group);
- s.setValue("deco_mode", value);
- prefs.planner_deco_mode = value;
- emit decoModeChanged(value);
-}
-
GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) :
QObject(parent)
{
@@ -1528,7 +1105,7 @@ QObject(parent),
geocoding(new GeocodingPreferences(this)),
proxy(new qPrefProxy(this)),
cloud_storage(new qPrefCloudStorage(this)),
- planner_settings(new DivePlannerSettings(this)),
+ planner_settings(new qPrefDivePlanner(this)),
unit_settings(new qPrefUnits(this)),
general_settings(new GeneralSettingsObjectWrapper(this)),
display_settings(new qPrefDisplay(this)),
@@ -1626,36 +1203,7 @@ void SettingsObjectWrapper::load()
GET_INT("distance_threshold", distance_threshold);
s.endGroup();
- s.beginGroup("Planner");
- GET_BOOL("last_stop", last_stop);
- GET_BOOL("verbatim_plan", verbatim_plan);
- GET_BOOL("display_duration", display_duration);
- GET_BOOL("display_runtime", display_runtime);
- GET_BOOL("display_transitions", display_transitions);
- GET_BOOL("display_variations", display_variations);
- GET_BOOL("safetystop", safetystop);
- GET_BOOL("doo2breaks", doo2breaks);
- GET_BOOL("switch_at_req_stop",switch_at_req_stop);
- GET_BOOL("drop_stone_mode", drop_stone_mode);
-
- GET_INT("reserve_gas", reserve_gas);
- GET_INT("ascrate75", ascrate75);
- GET_INT("ascrate50", ascrate50);
- GET_INT("ascratestops", ascratestops);
- GET_INT("ascratelast6m", ascratelast6m);
- GET_INT("descrate", descrate);
- GET_INT("sacfactor", sacfactor);
- GET_INT("problemsolvingtime", problemsolvingtime);
- GET_INT("bottompo2", bottompo2);
- GET_INT("decopo2", decopo2);
- GET_INT("bestmixend", bestmixend.mm);
- GET_INT("min_switch_duration", min_switch_duration);
- GET_INT("bottomsac", bottomsac);
- GET_INT("decosac", decosac);
-
- prefs.planner_deco_mode = deco_mode(s.value("deco_mode", default_prefs.planner_deco_mode).toInt());
- s.endGroup();
-
+ qPrefDivePlanner::instance()->load();
qPrefDiveComputer::instance()->load();
s.beginGroup("UpdateManager");
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index 9099b0ceb..54add731d 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -229,120 +229,6 @@ private:
const QString group = QStringLiteral("geocoding");
};
-class DivePlannerSettings : public QObject {
- Q_OBJECT
- Q_PROPERTY(bool last_stop READ lastStop WRITE setLastStop NOTIFY lastStopChanged)
- Q_PROPERTY(bool verbatim_plan READ verbatimPlan WRITE setVerbatimPlan NOTIFY verbatimPlanChanged)
- Q_PROPERTY(bool display_runtime READ displayRuntime WRITE setDisplayRuntime NOTIFY displayRuntimeChanged)
- Q_PROPERTY(bool display_duration READ displayDuration WRITE setDisplayDuration NOTIFY displayDurationChanged)
- Q_PROPERTY(bool display_transitions READ displayTransitions WRITE setDisplayTransitions NOTIFY displayTransitionsChanged)
- Q_PROPERTY(bool display_variations READ displayVariations WRITE setDisplayVariations NOTIFY displayVariationsChanged)
- Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE setDoo2breaks NOTIFY doo2breaksChanged)
- Q_PROPERTY(bool drop_stone_mode READ dropStoneMode WRITE setDropStoneMode NOTIFY dropStoneModeChanged)
- Q_PROPERTY(bool safetystop READ safetyStop WRITE setSafetyStop NOTIFY safetyStopChanged)
- Q_PROPERTY(bool switch_at_req_stop READ switchAtRequiredStop WRITE setSwitchAtRequiredStop NOTIFY switchAtRequiredStopChanged)
- Q_PROPERTY(int ascrate75 READ ascrate75 WRITE setAscrate75 NOTIFY ascrate75Changed)
- Q_PROPERTY(int ascrate50 READ ascrate50 WRITE setAscrate50 NOTIFY ascrate50Changed)
- Q_PROPERTY(int ascratestops READ ascratestops WRITE setAscratestops NOTIFY ascratestopsChanged)
- Q_PROPERTY(int ascratelast6m READ ascratelast6m WRITE setAscratelast6m NOTIFY ascratelast6mChanged)
- Q_PROPERTY(int descrate READ descrate WRITE setDescrate NOTIFY descrateChanged)
- Q_PROPERTY(int sacfactor READ sacfactor WRITE setSacFactor NOTIFY sacFactorChanged)
- Q_PROPERTY(int problemsolvingtime READ problemsolvingtime WRITE setProblemSolvingTime NOTIFY problemSolvingTimeChanged)
- Q_PROPERTY(int bottompo2 READ bottompo2 WRITE setBottompo2 NOTIFY bottompo2Changed)
- Q_PROPERTY(int decopo2 READ decopo2 WRITE setDecopo2 NOTIFY decopo2Changed)
- Q_PROPERTY(int bestmixend READ bestmixend WRITE setBestmixend NOTIFY bestmixendChanged)
- Q_PROPERTY(int reserve_gas READ reserveGas WRITE setReserveGas NOTIFY reserveGasChanged)
- Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged)
- Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged)
- Q_PROPERTY(int decosac READ decoSac WRITE setDecoSac NOTIFY decoSacChanged)
- Q_PROPERTY(deco_mode decoMode READ decoMode WRITE setDecoMode NOTIFY decoModeChanged)
-
-public:
- DivePlannerSettings(QObject *parent = 0);
- bool lastStop() const;
- bool verbatimPlan() const;
- bool displayRuntime() const;
- bool displayDuration() const;
- bool displayTransitions() const;
- bool displayVariations() const;
- bool doo2breaks() const;
- bool dropStoneMode() const;
- bool safetyStop() const;
- bool switchAtRequiredStop() const;
- int ascrate75() const;
- int ascrate50() const;
- int ascratestops() const;
- int ascratelast6m() const;
- int descrate() const;
- int sacfactor() const;
- int problemsolvingtime() const;
- int bottompo2() const;
- int decopo2() const;
- int bestmixend() const;
- int reserveGas() const;
- int minSwitchDuration() const;
- int bottomSac() const;
- int decoSac() const;
- deco_mode decoMode() const;
-
-public slots:
- void setLastStop(bool value);
- void setVerbatimPlan(bool value);
- void setDisplayRuntime(bool value);
- void setDisplayDuration(bool value);
- void setDisplayTransitions(bool value);
- void setDisplayVariations(bool value);
- void setDoo2breaks(bool value);
- void setDropStoneMode(bool value);
- void setSafetyStop(bool value);
- void setSwitchAtRequiredStop(bool value);
- void setAscrate75(int value);
- void setAscrate50(int value);
- void setAscratestops(int value);
- void setAscratelast6m(int value);
- void setDescrate(int value);
- void setSacFactor(int value);
- void setProblemSolvingTime(int value);
- void setBottompo2(int value);
- void setDecopo2(int value);
- void setBestmixend(int value);
- void setReserveGas(int value);
- void setMinSwitchDuration(int value);
- void setBottomSac(int value);
- void setDecoSac(int value);
- void setDecoMode(deco_mode value);
-
-signals:
- void lastStopChanged(bool value);
- void verbatimPlanChanged(bool value);
- void displayRuntimeChanged(bool value);
- void displayDurationChanged(bool value);
- void displayTransitionsChanged(bool value);
- void displayVariationsChanged(bool value);
- void doo2breaksChanged(bool value);
- void dropStoneModeChanged(bool value);
- void safetyStopChanged(bool value);
- void switchAtRequiredStopChanged(bool value);
- void ascrate75Changed(int value);
- void ascrate50Changed(int value);
- void ascratestopsChanged(int value);
- void ascratelast6mChanged(int value);
- void descrateChanged(int value);
- void sacFactorChanged(int value);
- void problemSolvingTimeChanged(int value);
- void bottompo2Changed(int value);
- void decopo2Changed(int value);
- void bestmixendChanged(int value);
- void reserveGasChanged(int value);
- void minSwitchDurationChanged(int value);
- void bottomSacChanged(int value);
- void decoSacChanged(int value);
- void decoModeChanged(deco_mode value);
-
-private:
- const QString group = QStringLiteral("Planner");
-};
-
class GeneralSettingsObjectWrapper : public QObject {
Q_OBJECT
Q_PROPERTY(QString default_filename READ defaultFilename WRITE setDefaultFilename NOTIFY defaultFilenameChanged)
@@ -472,9 +358,8 @@ class SettingsObjectWrapper : public QObject {
Q_PROPERTY(GeocodingPreferences* geocoding MEMBER geocoding CONSTANT)
Q_PROPERTY(qPrefProxy* proxy MEMBER proxy CONSTANT)
Q_PROPERTY(qPrefCloudStorage* cloud_storage MEMBER cloud_storage CONSTANT)
- Q_PROPERTY(DivePlannerSettings* planner MEMBER planner_settings CONSTANT)
+ Q_PROPERTY(qPrefDivePlanner* planner MEMBER planner_settings CONSTANT)
Q_PROPERTY(qPrefUnits* units MEMBER unit_settings CONSTANT)
-
Q_PROPERTY(GeneralSettingsObjectWrapper* general MEMBER general_settings CONSTANT)
Q_PROPERTY(qPrefDisplay* display MEMBER display_settings CONSTANT)
Q_PROPERTY(LanguageSettingsObjectWrapper* language MEMBER language_settings CONSTANT)
@@ -492,7 +377,7 @@ public:
GeocodingPreferences *geocoding;
qPrefProxy *proxy;
qPrefCloudStorage *cloud_storage;
- DivePlannerSettings *planner_settings;
+ qPrefDivePlanner *planner_settings;
qPrefUnits *unit_settings;
GeneralSettingsObjectWrapper *general_settings;
qPrefDisplay *display_settings;