mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7dc8a9850d
commit
4e86dd3a52
3 changed files with 217 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -34,6 +34,7 @@ private:
|
|||
void updateMode(struct dive *d);
|
||||
void divesEdited(int);
|
||||
void closeWarning();
|
||||
void showCurrentWidget(bool show, int position);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -499,6 +499,55 @@
|
|||
</layout>
|
||||
</item>
|
||||
|
||||
<item row="6" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_wavesize">
|
||||
<property name="title">
|
||||
<string>Surface waves</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="surfaceWavesLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="StarWidget" name="wavesize" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="waveLabel1">
|
||||
<property name="text">
|
||||
<string>Large</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="waveLabel2">
|
||||
<property name="text">
|
||||
<string>Small</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="6" column="1" alignment="Qt::AlignVCenter">
|
||||
<widget class="QGroupBox" name="groupBox_visibility">
|
||||
<property name="title">
|
||||
|
@ -548,6 +597,153 @@
|
|||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="6" column="2" alignment="Qt::AlignVCenter">
|
||||
<widget class="QGroupBox" name="groupBox_current">
|
||||
<property name="title">
|
||||
<string>Current</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="currentLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="StarWidget" name="current" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="curLabel1">
|
||||
<property name="text">
|
||||
<string>Strong</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="curLabel2">
|
||||
<property name="text">
|
||||
<string>Weak</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="6" column="3" alignment="Qt::AlignVCenter">
|
||||
<widget class="QGroupBox" name="groupBox_surge">
|
||||
<property name="title">
|
||||
<string>Surge</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="surgeLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="StarWidget" name="surge" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="surgeLabel1">
|
||||
<property name="text">
|
||||
<string>Strong</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="surgeLabel2">
|
||||
<property name="text">
|
||||
<string>Weak</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="6" column="4" alignment="Qt::AlignVCenter">
|
||||
<widget class="QGroupBox" name="groupBox_chill">
|
||||
<property name="title">
|
||||
<string>Chill</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="cLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="StarWidget" name="chill" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="chillLabel1">
|
||||
<property name="text">
|
||||
<string>Freezing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="chillLabel2">
|
||||
<property name="text">
|
||||
<string>Comfy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="7" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Add table
Reference in a new issue