summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/diveplanner.cpp35
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/mainwindow.ui4
3 files changed, 27 insertions, 14 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)
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 2cde8d992..ab01794af 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -79,6 +79,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(reloadHeaderActions()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.InfoWidget, SLOT(updateDiveInfo()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlannerWidget, SLOT(settingsChanged()));
+ connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.plannerSettingsWidget, SLOT(settingsChanged()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update()));
connect(ui.actionRecent1, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent2, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
@@ -102,6 +103,7 @@ MainWindow::MainWindow() : QMainWindow(),
ui.ListWidget->expand(ui.ListWidget->model()->index(0, 0));
ui.ListWidget->scrollTo(ui.ListWidget->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
ui.divePlannerWidget->settingsChanged();
+ ui.plannerSettingsWidget->settingsChanged();
#ifdef NO_MARBLE
ui.globePane->hide();
ui.menuView->removeAction(ui.actionViewGlobe);
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 0ff1ef1d4..78565ae25 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -526,7 +526,7 @@
<bool>true</bool>
</property>
</widget>
- <widget class="PlannerSettingsWidget" name="fullPlan">
+ <widget class="PlannerSettingsWidget" name="plannerSettingsWidget">
<layout class="QVBoxLayout" name="horizontalLayout_p4">
<property name="spacing">
<number>0</number>
@@ -656,7 +656,7 @@ p, li { white-space: pre-wrap; }
<x>0</x>
<y>0</y>
<width>1682</width>
- <height>27</height>
+ <height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">