diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-01-08 14:42:07 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-10 17:27:24 -0800 |
commit | 0f7f2195d56effff234430cc4314c5216d518a8d (patch) | |
tree | 423c07dd727b7dc06f973b698e7a395a3ae44b3c /qt-ui | |
parent | a478eb5711db6a1950cf810ca0b67414b6910030 (diff) | |
download | subsurface-0f7f2195d56effff234430cc4314c5216d518a8d.tar.gz |
Add setpoint events according to divetype
When changing to a CCR dive, add a setpoint change to the default setpoint
at the beginning of the dive. Otherwise add an explicit setpoint change to 0
.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 9 | ||||
-rw-r--r-- | qt-ui/maintab.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 1a25f19e4..2c92447e7 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -103,7 +103,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), // This needs to be the same order as enum dive_comp_type in dive.h! ui.DiveType->insertItems(0, QStringList() << "OC" << "CCR" << "pSCR" << "Freedive"); - connect(ui.DiveType, SIGNAL(currentIndexChanged(int)), this, SLOT(on_divetype_Changed(int))); + connect(ui.DiveType, SIGNAL(currentIndexChanged(int)), this, SLOT(divetype_Changed(int))); connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(QModelIndex))); @@ -772,8 +772,10 @@ void MainTab::acceptChanges() MODIFY_SELECTED_DIVES(EDIT_VALUE(visibility)); if (displayed_dive.airtemp.mkelvin != cd->airtemp.mkelvin) MODIFY_SELECTED_DIVES(EDIT_VALUE(airtemp.mkelvin)); - if (displayed_dive.dc.dctype != cd->dc.dctype) + if (displayed_dive.dc.dctype != cd->dc.dctype) { MODIFY_SELECTED_DIVES(EDIT_VALUE(dc.dctype)); + MODIFY_SELECTED_DIVES(update_setpoint_events(&mydive->dc)); + } if (displayed_dive.watertemp.mkelvin != cd->watertemp.mkelvin) MODIFY_SELECTED_DIVES(EDIT_VALUE(watertemp.mkelvin)); if (displayed_dive.when != cd->when) { @@ -1012,10 +1014,11 @@ void MainTab::on_airtemp_textChanged(const QString &text) validate_temp_field(ui.airtemp, text); } -void MainTab::on_divetype_Changed(const int &index) +void MainTab::divetype_Changed(int index) { if (editMode == IGNORE) return; + qDebug() << "Changing divetype to " << dctype_text[index]; displayed_dive.dc.dctype = (enum dive_comp_type) index; update_setpoint_events(&displayed_dive.dc); markChangedWidget(ui.DiveType); diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 8b98119f4..2f7277bbd 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -71,7 +71,7 @@ slots: void on_suit_textChanged(const QString &text); void on_notes_textChanged(); void on_airtemp_textChanged(const QString &text); - void on_divetype_Changed(const int &index); + void divetype_Changed(int); void on_watertemp_textChanged(const QString &text); void validate_temp_field(QLineEdit *tempField, const QString &text); void on_dateEdit_dateChanged(const QDate &date); |