diff options
author | willemferguson <willemferguson@zoology.up.ac.za> | 2019-11-28 21:04:52 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-03 20:37:57 -0800 |
commit | 6d7f26f4bf794c0faa79370dd788d90391542d30 (patch) | |
tree | 3963059d648eeb8acf8a31a0eab0807e59308de9 /desktop-widgets | |
parent | 4e86dd3a5221ca37545cba9950a712f938367113 (diff) | |
download | subsurface-6d7f26f4bf794c0faa79370dd788d90391542d30.tar.gz |
Desktop: add additional star widgets to Information tab
Connect the UI to the underlying dive structure. Enable proper initialisation
and management of star widgets while Information tab is active. Enable undo for
the addtional star widgets.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.cpp | 36 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.h | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index a00913086..5edb4811c 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -192,6 +192,10 @@ void TabDiveInformation::updateData() updateMode(current_dive); updateSalinity(); ui->visibility->setCurrentStars(current_dive->visibility); + ui->wavesize->setCurrentStars(current_dive->wavesize); + ui->current->setCurrentStars(current_dive->current); + ui->surge->setCurrentStars(current_dive->surge); + ui->chill->setCurrentStars(current_dive->chill); if (prefs.extraEnvironmentalDefault) showCurrentWidget(true, 2); // Show current star widget at 3rd position else @@ -208,6 +212,14 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi if (field.visibility) ui->visibility->setCurrentStars(current_dive->visibility); + if (field.wavesize) + ui->wavesize->setCurrentStars(current_dive->wavesize); + if (field.current) + ui->current->setCurrentStars(current_dive->current); + if (field.surge) + ui->surge->setCurrentStars(current_dive->surge); + if (field.chill) + ui->chill->setCurrentStars(current_dive->chill); if (field.mode) updateMode(current_dive); if (field.duration || field.depth || field.mode) @@ -229,6 +241,30 @@ void TabDiveInformation::on_visibility_valueChanged(int value) divesEdited(Command::editVisibility(value, false)); } +void TabDiveInformation::on_wavesize_valueChanged(int value) +{ + if (current_dive) + divesEdited(Command::editWaveSize(value, false)); +} + +void TabDiveInformation::on_current_valueChanged(int value) +{ + if (current_dive) + divesEdited(Command::editCurrent(value, false)); +} + +void TabDiveInformation::on_surge_valueChanged(int value) +{ + if (current_dive) + divesEdited(Command::editSurge(value, false)); +} + +void TabDiveInformation::on_chill_valueChanged(int value) +{ + if (current_dive) + divesEdited(Command::editChill(value, false)); +} + void TabDiveInformation::updateMode(struct dive *d) { ui->diveType->setCurrentIndex(get_dive_dc(d, dc_number)->divemode); diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.h b/desktop-widgets/tab-widgets/TabDiveInformation.h index 51ec2381a..e851fe2d3 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.h +++ b/desktop-widgets/tab-widgets/TabDiveInformation.h @@ -22,6 +22,10 @@ private slots: void on_atmPressVal_editingFinished(); void on_atmPressType_currentIndexChanged(int index); void on_visibility_valueChanged(int value); + void on_wavesize_valueChanged(int value); + void on_current_valueChanged(int value); + void on_surge_valueChanged(int value); + void on_chill_valueChanged(int value); void on_airtemp_editingFinished(); void on_watertemp_editingFinished(); private: |