aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gaetan Bisson <bisson@archlinux.org>2014-07-16 17:32:06 -1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-16 23:09:56 -0700
commite69bb1879eaee2cb9119ee5e46204f5ecef6d157 (patch)
treea3fff0ae0217cdbb99850c5e1c5b279e5bc0e87c
parentd73d98c0322e71171796a5b2e27739a0d7ac96c3 (diff)
downloadsubsurface-e69bb1879eaee2cb9119ee5e46204f5ecef6d157.tar.gz
Store drop_stone_mode, bottomsac, decosac in prefs
The values for drop_stone_mode, bottomsac, and decosac are typically the kind of personal data specific to a diver that is unlikely to change from one dive plan to the next. This patch stores/restores them to/from the preferences file. For this, it adds bottomsac and decosac to the prefs structure; drop_stone_mode was already there, though not stored/restored. Signed-off-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--pref.h2
-rw-r--r--qt-ui/diveplanner.cpp13
-rw-r--r--subsurfacestartup.c2
3 files changed, 15 insertions, 2 deletions
diff --git a/pref.h b/pref.h
index 3efe0a5ca..bf153f538 100644
--- a/pref.h
+++ b/pref.h
@@ -63,6 +63,8 @@ struct preferences {
char *proxy_pass;
bool doo2breaks;
bool drop_stone_mode;
+ int bottomsac;
+ int decosac;
bool show_pictures_in_profile;
bool use_default_file;
};
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 89c7fccdf..bf124614a 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -375,6 +375,9 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
prefs.bottompo2 = s.value("bottompo2", 1400).toInt();
prefs.decopo2 = s.value("decopo2",1600).toInt();
prefs.doo2breaks = s.value("doo2breaks", false).toBool();
+ prefs.drop_stone_mode = s.value("drop_stone_mode", false).toBool();
+ prefs.bottomsac = s.value("bottomsac", 20000).toInt();
+ prefs.decosac = s.value("decosac", 17000).toInt();
s.endGroup();
ui.ascRate75->setValue(prefs.ascrate75 / UNIT_FACTOR);
@@ -385,6 +388,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
ui.backgasBreaks->setChecked(prefs.doo2breaks);
+ ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
@@ -410,8 +414,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
- ui.bottomSAC->setValue(20);
- ui.decoStopSAC->setValue(17);
+ ui.bottomSAC->setValue(prefs.bottomsac / 1000.0);
+ ui.decoStopSAC->setValue(prefs.decosac / 1000.0);
ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh);
@@ -431,6 +435,9 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
s.setValue("bottompo2", prefs.bottompo2);
s.setValue("decopo2", prefs.decopo2);
s.setValue("doo2breaks", prefs.doo2breaks);
+ s.setValue("drop_stone_mode", prefs.drop_stone_mode);
+ s.setValue("bottomsac", prefs.bottomsac);
+ s.setValue("decosac", prefs.decosac);
s.endGroup();
}
@@ -666,12 +673,14 @@ void DivePlannerPointsModel::emitDataChanged()
void DivePlannerPointsModel::setBottomSac(int sac)
{
diveplan.bottomsac = sac * 1000;
+ prefs.bottomsac = diveplan.bottomsac;
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
void DivePlannerPointsModel::setDecoSac(int sac)
{
diveplan.decosac = sac * 1000;
+ prefs.decosac = diveplan.decosac;
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 1af68510e..29d3ddd11 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -42,6 +42,8 @@ struct preferences default_prefs = {
.decopo2 = 1600,
.doo2breaks = false,
.drop_stone_mode = false,
+ .bottomsac = 20,
+ .decosac = 17,
.show_pictures_in_profile = true
};