mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
bbfe20a412
commit
b438158693
3 changed files with 27 additions and 14 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Add table
Reference in a new issue