summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-11-01 17:00:06 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-11-01 09:41:17 -0700
commit37e3e7e69a289db8c435a9d87188267c06703e11 (patch)
treeaf124abd81fbc9a45f01517c40046a34bf7e7f22 /core
parentc110b4a23809ef7702653383d666bdd7a48ee775 (diff)
downloadsubsurface-37e3e7e69a289db8c435a9d87188267c06703e11.tar.gz
Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that should differentiate the different deco_modes, you could plan your dive in buelhman and see it in vpm-b, for instance but both of them accessed the same pref. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/pref.h1
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp24
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h5
3 files changed, 25 insertions, 5 deletions
diff --git a/core/pref.h b/core/pref.h
index c12a04078..78d49b11a 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -107,6 +107,7 @@ struct preferences {
int descrate;
int bottompo2;
int decopo2;
+ enum deco_mode display_deco_mode;
depth_t bestmixend;
int proxy_type;
char *proxy_host;
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 60efe9afb..34fe3dd45 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -259,6 +259,24 @@ TechnicalDetailsSettings::TechnicalDetailsSettings(QObject* parent): QObject(par
}
+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:: modp02() const
{
return prefs.modpO2;
@@ -2131,11 +2149,6 @@ void SettingsObjectWrapper::load()
GET_BOOL("tankbar", tankbar);
GET_BOOL("RulerBar", rulergraph);
GET_BOOL("percentagegraph", percentagegraph);
- v = s.value("buehlmann");
- if (v.isValid())
- prefs.deco_mode = v.toBool() ? BUEHLMANN : VPMB;
- else
- prefs.deco_mode = BUEHLMANN;
GET_INT("gflow", gflow);
GET_INT("gfhigh", gfhigh);
GET_INT("vpmb_conservatism", vpmb_conservatism);
@@ -2149,6 +2162,7 @@ void SettingsObjectWrapper::load()
GET_BOOL("display_unused_tanks", display_unused_tanks);
GET_BOOL("show_average_depth", show_average_depth);
GET_BOOL("show_pictures_in_profile", show_pictures_in_profile);
+ prefs.display_deco_mode = (deco_mode) s.value("display_deco_mode").toInt();
s.endGroup();
s.beginGroup("GeneralSettings");
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index bd12da5f5..7fdd10498 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -132,6 +132,8 @@ class TechnicalDetailsSettings : public QObject {
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_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged)
+ Q_PROPERTY(deco_mode deco READ deco WRITE setDecoMode NOTIFY decoModeChanged)
+
public:
TechnicalDetailsSettings(QObject *parent);
@@ -160,6 +162,7 @@ public:
bool displayUnusedTanks() const;
bool showAverageDepth() const;
bool showPicturesInProfile() const;
+ deco_mode deco() const;
public slots:
void setMod(bool value);
@@ -187,6 +190,7 @@ public slots:
void setDisplayUnusedTanks(bool value);
void setShowAverageDepth(bool value);
void setShowPicturesInProfile(bool value);
+ void setDecoMode(deco_mode d);
signals:
void modpO2Changed(double value);
@@ -214,6 +218,7 @@ signals:
void displayUnusedTanksChanged(bool value);
void showAverageDepthChanged(bool value);
void showPicturesInProfileChanged(bool value);
+ void decoModeChanged(deco_mode m);
private:
const QString group = QStringLiteral("TecDetails");