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 <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-06-20 13:43:09 +02:00 committed by Dirk Hohndel
parent 3f74389b88
commit bb44908507
3 changed files with 24 additions and 17 deletions

View file

@ -269,8 +269,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
ui.tableWidget->setBtnToolTip(tr("add dive data point")); ui.tableWidget->setBtnToolTip(tr("add dive data point"));
connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime))); connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime)));
connect(ui.ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString))); connect(ui.ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString)));
connect(ui.bottomSAC, SIGNAL(textChanged(QString)), this, SLOT(bottomSacChanged(QString))); connect(ui.bottomSAC, SIGNAL(valueChanged(int)), this, SLOT(bottomSacChanged(int)));
connect(ui.decoStopSAC, SIGNAL(textChanged(QString)), this, SLOT(decoSacChanged(QString))); 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(int)), plannerModel, SLOT(setGFHigh(int)));
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged())); connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
@ -286,8 +286,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
/* set defaults. */ /* set defaults. */
ui.startTime->setTime(QTime(1, 0)); ui.startTime->setTime(QTime(1, 0));
ui.ATMPressure->setText("1013"); ui.ATMPressure->setText("1013");
ui.bottomSAC->setText("20"); ui.bottomSAC->setValue(20);
ui.decoStopSAC->setText("17"); ui.decoStopSAC->setValue(17);
ui.gflow->setValue(prefs.gflow); ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh); ui.gfhigh->setValue(prefs.gfhigh);
@ -310,14 +310,14 @@ void DivePlannerWidget::atmPressureChanged(const QString &pressure)
plannerModel->setSurfacePressure(pressure.toInt()); 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() 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)
{ {
} }

View file

@ -135,8 +135,8 @@ public
slots: slots:
void settingsChanged(); void settingsChanged();
void atmPressureChanged(const QString &pressure); void atmPressureChanged(const QString &pressure);
void bottomSacChanged(const QString &bottomSac); void bottomSacChanged(const int bottomSac);
void decoSacChanged(const QString &decosac); void decoSacChanged(const int decosac);
void printDecoPlan(); void printDecoPlan();
private: private:
@ -154,8 +154,8 @@ public
slots: slots:
void settingsChanged(); void settingsChanged();
void atmPressureChanged(const QString &pressure); void atmPressureChanged(const QString &pressure);
void bottomSacChanged(const QString &bottomSac); void bottomSacChanged(const int bottomSac);
void decoSacChanged(const QString &decosac); void decoSacChanged(const int decosac);
void printDecoPlan(); void printDecoPlan();
private: private:

View file

@ -98,7 +98,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="decoStopSAC"/> <widget class="QSpinBox" name="decoStopSAC"/>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QSpinBox" name="gflow"> <widget class="QSpinBox" name="gflow">
@ -135,7 +135,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLineEdit" name="bottomSAC"/> <widget class="QSpinBox" name="bottomSAC"/>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<widget class="QSpinBox" name="gfhigh"> <widget class="QSpinBox" name="gfhigh">
@ -176,7 +176,14 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="ATMPressure"/> <widget class="QLineEdit" name="ATMPressure">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QPushButton" name="printPlan"> <widget class="QPushButton" name="printPlan">