summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-06-27 11:43:11 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-30 07:27:17 -0700
commitb438158693b54ed0e9359184a075947dcd602790 (patch)
treedb76713bdef84c3ee65974b65121a79bd800c8cf /qt-ui/diveplanner.cpp
parentbbfe20a4120dca22228287cea52301623bb95764 (diff)
downloadsubsurface-b438158693b54ed0e9359184a075947dcd602790.tar.gz
Make the planner settings respond well to unit system changes.
[Dirk Hohndel: removed printf/qDebug() debug output] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 925f6d00c..e6c1889d5 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -261,8 +261,6 @@ void DiveHandler::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
ui.setupUi(this);
- if (prefs.units.METERS == units::FEET)
- ui.atmHeight->setSuffix("ft");
ui.tableWidget->setTitle(tr("Dive Planner Points"));
ui.tableWidget->setModel(DivePlannerPointsModel::instance());
DivePlannerPointsModel::instance()->setRecalc(true);
@@ -319,7 +317,13 @@ void DivePlannerWidget::setupStartTime(QDateTime startTime)
void DivePlannerWidget::settingsChanged()
{
- // right now there's nothing special we do when settings change
+ // Adopt units
+ if (get_units()->length == units::FEET) {
+ ui.atmHeight->setSuffix("ft");
+ } else {
+ ui.atmHeight->setSuffix(("m"));
+ }
+
}
void DivePlannerPointsModel::addCylinder_clicked()
@@ -363,13 +367,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
{
ui.setupUi(this);
- if (prefs.units.METERS == units::FEET) {
- ui.ascRate75->setSuffix("ft/min");
- ui.ascRate50->setSuffix("ft/min");
- ui.ascRateStops->setSuffix("ft/min");
- ui.ascRateLast6m->setSuffix("ft/min");
- ui.descRate->setSuffix("ft/min");
- }
ui.ascRate75->setValue(prefs.ascrate75 / UNIT_FACTOR);
ui.ascRate50->setValue(prefs.ascrate50 / UNIT_FACTOR);
ui.ascRateStops->setValue(prefs.ascratestops / UNIT_FACTOR);
@@ -400,9 +397,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.bottomSAC, SIGNAL(valueChanged(int)), this, SLOT(bottomSacChanged(int)));
connect(ui.decoStopSAC, SIGNAL(valueChanged(int)), this, SLOT(decoSacChanged(int)));
connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
-// connect(ui.gfhigh, SIGNAL(valueChanged()), plannerModel, SLOT(emitDataChanged()));
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
-// connect(ui.gflow, SIGNAL(valueChanged()), plannerModel, SLOT(emitDataChanged()));
ui.bottomSAC->setValue(20);
ui.decoStopSAC->setValue(17);
@@ -415,6 +410,22 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
void PlannerSettingsWidget::settingsChanged()
{
+ if (get_units()->length == units::FEET) {
+ ui.ascRate75->setSuffix("ft/min");
+ ui.ascRate50->setSuffix("ft/min");
+ ui.ascRateStops->setSuffix("ft/min");
+ ui.ascRateLast6m->setSuffix("ft/min");
+ ui.descRate->setSuffix("ft/min");
+ ui.lastStop->setText(tr("Last stop at 20ft"));
+ } else {
+ ui.ascRate75->setSuffix("m/min");
+ ui.ascRate50->setSuffix("m/min");
+ ui.ascRateStops->setSuffix("m/min");
+ ui.ascRateLast6m->setSuffix("m/min");
+ ui.descRate->setSuffix("m/min");
+ ui.lastStop->setText(tr("Last stop at 6m"));
+
+ }
}
void PlannerSettingsWidget::atmPressureChanged(const QString &pressure)