summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-07-09 23:37:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-09 14:40:36 -0700
commit2ff2daebd70907dcd6323371d5842d2bd064d28e (patch)
tree157d91a70661913bfc16b4842286bb4730ebd7e0
parentf940ebcf74a7a398fb991796c56b831fa39959d1 (diff)
downloadsubsurface-2ff2daebd70907dcd6323371d5842d2bd064d28e.tar.gz
Move drop_stone_mode setting to prefs
There is no reason to treat drop_stone_mode different from the rest of the planner settings, so move it to our prefs structure. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--pref.h1
-rw-r--r--qt-ui/diveplanner.cpp10
-rw-r--r--qt-ui/diveplanner.h1
-rw-r--r--subsurfacestartup.c3
4 files changed, 8 insertions, 7 deletions
diff --git a/pref.h b/pref.h
index 19830a920..ebe5ecd1d 100644
--- a/pref.h
+++ b/pref.h
@@ -62,6 +62,7 @@ struct preferences {
char *proxy_user;
char *proxy_pass;
bool doo2breaks;
+ bool drop_stone_mode;
};
enum unit_system_values {
METRIC,
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 4abddd8e2..dded7cb44 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -76,7 +76,7 @@ void DivePlannerPointsModel::createSimpleDive()
// If we're in drop_stone_mode, don't add a first point.
// It will be added implicit.
- if (!drop_stone_mode)
+ if (!prefs.drop_stone_mode)
plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, &gas, 0, true);
plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, &gas, 0, true);
@@ -612,7 +612,7 @@ int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const
return divepoints.count();
}
-DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent), mode(NOTHING), drop_stone_mode(false)
+DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent), mode(NOTHING)
{
memset(&diveplan, 0, sizeof(diveplan));
startTime = QDateTime::currentDateTimeUtc();
@@ -691,8 +691,8 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value)
void DivePlannerPointsModel::setDropStoneMode(bool value)
{
- drop_stone_mode = value;
- if (drop_stone_mode) {
+ prefs.drop_stone_mode = value;
+ if (prefs.drop_stone_mode) {
/* Remove the first entry if we enable drop_stone_mode */
if (rowCount() >= 2) {
beginRemoveRows(QModelIndex(), 0, 0);
@@ -986,7 +986,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
divedatapoint p = at(i);
int deltaT = lastIndex != -1 ? p.time - at(lastIndex).time : p.time;
lastIndex = i;
- if (i == 0 && drop_stone_mode) {
+ if (i == 0 && prefs.drop_stone_mode) {
/* Okay, we add a fist segment where we go down to depth */
plan_add_segment(&diveplan, p.depth / prefs.descrate, p.depth, p.gasmix, p.po2, false);
deltaT -= p.depth / prefs.descrate;
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 873ee8d66..a2c33f8c9 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -101,7 +101,6 @@ private:
void deleteTemporaryPlan(struct divedatapoint *dp);
QVector<sample> backupSamples; // For editing added dives.
QVector<QPair<int, int> > oldGases;
- bool drop_stone_mode;
QDateTime startTime;
};
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index a451c2ba3..58291d272 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -40,7 +40,8 @@ struct preferences default_prefs = {
.descrate = 18000 / 60,
.bottompo2 = 1400,
.decopo2 = 1600,
- .doo2breaks = false
+ .doo2breaks = false,
+ .drop_stone_mode = false
};
int run_survey;