From bb44908507ce86072312c75b1223539deb67c5af Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 20 Jun 2014 13:43:09 +0200 Subject: [PATCH] planner: Switch to QSpinBox for SAC QSpinBox is nice to see how different sac rate would affect our dive plan. "Hey, What would happen if I would be stressed and my sac goes up by 50%?" Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 20 ++++++++++---------- qt-ui/diveplanner.h | 8 ++++---- qt-ui/diveplanner.ui | 13 ++++++++++--- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 29cefddd2..654a58031 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -269,8 +269,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg ui.tableWidget->setBtnToolTip(tr("add dive data point")); connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime))); connect(ui.ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString))); - connect(ui.bottomSAC, SIGNAL(textChanged(QString)), this, SLOT(bottomSacChanged(QString))); - connect(ui.decoStopSAC, SIGNAL(textChanged(QString)), this, SLOT(decoSacChanged(QString))); + 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(editingFinished()), plannerModel, SLOT(emitDataChanged())); connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); @@ -286,8 +286,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg /* set defaults. */ ui.startTime->setTime(QTime(1, 0)); ui.ATMPressure->setText("1013"); - ui.bottomSAC->setText("20"); - ui.decoStopSAC->setText("17"); + ui.bottomSAC->setValue(20); + ui.decoStopSAC->setValue(17); ui.gflow->setValue(prefs.gflow); ui.gfhigh->setValue(prefs.gfhigh); @@ -310,14 +310,14 @@ void DivePlannerWidget::atmPressureChanged(const QString &pressure) plannerModel->setSurfacePressure(pressure.toInt()); } -void DivePlannerWidget::bottomSacChanged(const QString &bottomSac) +void DivePlannerWidget::bottomSacChanged(const int bottomSac) { - plannerModel->setBottomSac(bottomSac.toInt()); + plannerModel->setBottomSac(bottomSac); } -void DivePlannerWidget::decoSacChanged(const QString &decosac) +void DivePlannerWidget::decoSacChanged(const int decosac) { - plannerModel->setDecoSac(decosac.toInt()); + plannerModel->setDecoSac(decosac); } void DivePlannerWidget::printDecoPlan() @@ -347,11 +347,11 @@ void PlannerSettingsWidget::atmPressureChanged(const QString &pressure) { } -void PlannerSettingsWidget::bottomSacChanged(const QString &bottomSac) +void PlannerSettingsWidget::bottomSacChanged(const int bottomSac) { } -void PlannerSettingsWidget::decoSacChanged(const QString &decosac) +void PlannerSettingsWidget::decoSacChanged(const int decosac) { } diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 4a504ead7..96725550b 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -135,8 +135,8 @@ public slots: void settingsChanged(); void atmPressureChanged(const QString &pressure); - void bottomSacChanged(const QString &bottomSac); - void decoSacChanged(const QString &decosac); + void bottomSacChanged(const int bottomSac); + void decoSacChanged(const int decosac); void printDecoPlan(); private: @@ -154,8 +154,8 @@ public slots: void settingsChanged(); void atmPressureChanged(const QString &pressure); - void bottomSacChanged(const QString &bottomSac); - void decoSacChanged(const QString &decosac); + void bottomSacChanged(const int bottomSac); + void decoSacChanged(const int decosac); void printDecoPlan(); private: diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui index d6c534c06..1aa4376dc 100644 --- a/qt-ui/diveplanner.ui +++ b/qt-ui/diveplanner.ui @@ -98,7 +98,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -176,7 +176,14 @@ - + + + + 0 + 0 + + +