mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d73d98c032
commit
e69bb1879e
3 changed files with 15 additions and 2 deletions
2
pref.h
2
pref.h
|
@ -63,6 +63,8 @@ struct preferences {
|
||||||
char *proxy_pass;
|
char *proxy_pass;
|
||||||
bool doo2breaks;
|
bool doo2breaks;
|
||||||
bool drop_stone_mode;
|
bool drop_stone_mode;
|
||||||
|
int bottomsac;
|
||||||
|
int decosac;
|
||||||
bool show_pictures_in_profile;
|
bool show_pictures_in_profile;
|
||||||
bool use_default_file;
|
bool use_default_file;
|
||||||
};
|
};
|
||||||
|
|
|
@ -375,6 +375,9 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
prefs.bottompo2 = s.value("bottompo2", 1400).toInt();
|
prefs.bottompo2 = s.value("bottompo2", 1400).toInt();
|
||||||
prefs.decopo2 = s.value("decopo2",1600).toInt();
|
prefs.decopo2 = s.value("decopo2",1600).toInt();
|
||||||
prefs.doo2breaks = s.value("doo2breaks", false).toBool();
|
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();
|
s.endGroup();
|
||||||
|
|
||||||
ui.ascRate75->setValue(prefs.ascrate75 / UNIT_FACTOR);
|
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.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
||||||
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
||||||
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
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.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
|
||||||
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(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.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
|
||||||
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
||||||
|
|
||||||
ui.bottomSAC->setValue(20);
|
ui.bottomSAC->setValue(prefs.bottomsac / 1000.0);
|
||||||
ui.decoStopSAC->setValue(17);
|
ui.decoStopSAC->setValue(prefs.decosac / 1000.0);
|
||||||
ui.gflow->setValue(prefs.gflow);
|
ui.gflow->setValue(prefs.gflow);
|
||||||
ui.gfhigh->setValue(prefs.gfhigh);
|
ui.gfhigh->setValue(prefs.gfhigh);
|
||||||
|
|
||||||
|
@ -431,6 +435,9 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
||||||
s.setValue("bottompo2", prefs.bottompo2);
|
s.setValue("bottompo2", prefs.bottompo2);
|
||||||
s.setValue("decopo2", prefs.decopo2);
|
s.setValue("decopo2", prefs.decopo2);
|
||||||
s.setValue("doo2breaks", prefs.doo2breaks);
|
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();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,12 +673,14 @@ void DivePlannerPointsModel::emitDataChanged()
|
||||||
void DivePlannerPointsModel::setBottomSac(int sac)
|
void DivePlannerPointsModel::setBottomSac(int sac)
|
||||||
{
|
{
|
||||||
diveplan.bottomsac = sac * 1000;
|
diveplan.bottomsac = sac * 1000;
|
||||||
|
prefs.bottomsac = diveplan.bottomsac;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDecoSac(int sac)
|
void DivePlannerPointsModel::setDecoSac(int sac)
|
||||||
{
|
{
|
||||||
diveplan.decosac = sac * 1000;
|
diveplan.decosac = sac * 1000;
|
||||||
|
prefs.decosac = diveplan.decosac;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ struct preferences default_prefs = {
|
||||||
.decopo2 = 1600,
|
.decopo2 = 1600,
|
||||||
.doo2breaks = false,
|
.doo2breaks = false,
|
||||||
.drop_stone_mode = false,
|
.drop_stone_mode = false,
|
||||||
|
.bottomsac = 20,
|
||||||
|
.decosac = 17,
|
||||||
.show_pictures_in_profile = true
|
.show_pictures_in_profile = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue