From 6d7f26f4bf794c0faa79370dd788d90391542d30 Mon Sep 17 00:00:00 2001 From: willemferguson Date: Thu, 28 Nov 2019 21:04:52 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'desktop-widgets/tab-widgets/TabDiveInformation.cpp') 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 &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); -- cgit v1.2.3-70-g09d2