summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveInformation.cpp
diff options
context:
space:
mode:
authorGravatar willemferguson <willemferguson@zoology.up.ac.za>2019-11-28 12:35:39 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-03 20:37:57 -0800
commit4e86dd3a5221ca37545cba9950a712f938367113 (patch)
tree36f3b819d7f2227162c52d41f735a6d81719ee80 /desktop-widgets/tab-widgets/TabDiveInformation.cpp
parent7dc8a9850db1f33fcccdfec393b431c50ff05b42 (diff)
downloadsubsurface-4e86dd3a5221ca37545cba9950a712f938367113.tar.gz
Desktop: enable additional environmental star widgets
Implement the UI features related to the additonal star widgets. Create the additonal star widgets and connect them to the preferences settings. By default only the current and visibility widgets are shown. In this case the current widget is on the left hand side of the tab. If the additional widgets are enabled the horizontal order of the widegts are changed to reflect attributes roughly from the start of the dive on the left to those towards the end of the dive on the right. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveInformation.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index 34aa159e6..a00913086 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -36,6 +36,12 @@ TabDiveInformation::TabDiveInformation(QWidget *parent) : TabBase(parent), ui(ne
ui->gasHeadingLabel->setStyleSheet(CSS_SET_HEADING_BLUE);
ui->environmentHeadingLabel->setStyleSheet(CSS_SET_HEADING_BLUE);
ui->groupBox_visibility->setStyleSheet(CSSSetSmallLabel);
+ ui->groupBox_current->setStyleSheet(CSSSetSmallLabel);
+ ui->groupBox_wavesize->setStyleSheet(CSSSetSmallLabel);
+ ui->groupBox_surge->setStyleSheet(CSSSetSmallLabel);
+ ui->groupBox_chill->setStyleSheet(CSSSetSmallLabel);
+ if (!prefs.extraEnvironmentalDefault) // if extraEnvironmental preference is turned off
+ showCurrentWidget(false, 0); // Show current star widget at lefthand side
QAction *action = new QAction(tr("OK"), this);
connect(action, &QAction::triggered, this, &TabDiveInformation::closeWarning);
ui->multiDiveWarningMessage->addAction(action);
@@ -160,6 +166,16 @@ void TabDiveInformation::updateSalinity()
}
}
+void TabDiveInformation::showCurrentWidget(bool show, int position)
+{
+ ui->groupBox_wavesize->setVisible(show);
+ ui->groupBox_surge->setVisible(show);
+ ui->groupBox_chill->setVisible(show);
+ int layoutPosition = ui->diveInfoScrollAreaLayout->indexOf(ui->groupBox_current);
+ ui->diveInfoScrollAreaLayout->takeAt(layoutPosition);
+ ui->diveInfoScrollAreaLayout->addWidget(ui->groupBox_current, 6, position, 1, 1);
+}
+
void TabDiveInformation::updateData()
{
if (!current_dive) {
@@ -176,6 +192,10 @@ void TabDiveInformation::updateData()
updateMode(current_dive);
updateSalinity();
ui->visibility->setCurrentStars(current_dive->visibility);
+ if (prefs.extraEnvironmentalDefault)
+ showCurrentWidget(true, 2); // Show current star widget at 3rd position
+ else
+ showCurrentWidget(false, 0); // Show current star widget at lefthand side
}
// This function gets called if a field gets updated by an undo command.