aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--icons/average.svg66
-rw-r--r--icons/maximum.svg66
-rw-r--r--icons/minimum.svg66
-rw-r--r--qt-ui/maintab.cpp56
-rw-r--r--qt-ui/maintab.ui230
-rw-r--r--qt-ui/simplewidgets.cpp92
-rw-r--r--qt-ui/simplewidgets.h28
-rw-r--r--subsurface.qrc3
9 files changed, 370 insertions, 239 deletions
diff --git a/Makefile b/Makefile
index 4ada94bc2..e870fa3b9 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,7 @@ HEADERS = \
qt-ui/kmessagewidget.h \
qt-ui/downloadfromdivecomputer.h \
qt-ui/preferences.h \
+ qt-ui/simplewidgets.h \
SOURCES = \
@@ -78,6 +79,7 @@ SOURCES = \
qt-ui/kmessagewidget.cpp \
qt-ui/downloadfromdivecomputer.cpp \
qt-ui/preferences.cpp \
+ qt-ui/simplewidgets.cpp \
$(RESFILE)
diff --git a/icons/average.svg b/icons/average.svg
new file mode 100644
index 000000000..5eb21fae2
--- /dev/null
+++ b/icons/average.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="24"
+ height="24"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="minimum.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="23.708333"
+ inkscape:cx="12"
+ inkscape:cy="12"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="748"
+ inkscape:window-x="-2"
+ inkscape:window-y="-3"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Camada 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1028.3622)">
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.6122756,1043.36 c -0.6609274,0.6609 -0.6609274,1.7256 0,2.3865 l 0.088388,0.088 c 0.6609274,0.6609 1.725558,0.6609 2.3864854,0 l 7.093166,-7.0932 7.181553,7.1816 c 0.660927,0.6609 1.725558,0.6609 2.386485,0 l 0.110485,-0.1105 c 0.660928,-0.6609 0.660928,-1.7256 0,-2.3865 l -8.374795,-8.3748 -0.0442,-0.044 c -0.01589,-0.016 -0.02785,-0.029 -0.04419,-0.044 -0.660927,-0.6609 -1.725558,-0.6609 -2.386485,0 l -8.3968938,8.3969 z"
+ id="rect2985"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.6508842,1037.4777 c -0.6609274,-0.6609 -0.6609274,-1.7256 0,-2.3865 l 0.088388,-0.088 c 0.6609274,-0.6609 1.7255583,-0.6609 2.3864853,0 l 7.0931655,7.0932 7.181553,-7.1816 c 0.660927,-0.6609 1.725558,-0.6609 2.386485,0 l 0.110485,0.1105 c 0.660928,0.6609 0.660928,1.7256 0,2.3865 l -8.374795,8.3748 -0.0442,0.044 c -0.01589,0.016 -0.02785,0.029 -0.04419,0.044 -0.660927,0.6609 -1.725558,0.6609 -2.386484,0 l -8.3968942,-8.3969 z"
+ id="rect2985-6"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/icons/maximum.svg b/icons/maximum.svg
new file mode 100644
index 000000000..7c21360d5
--- /dev/null
+++ b/icons/maximum.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="24"
+ height="24"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="Novo documento 1">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="23.708333"
+ inkscape:cx="12"
+ inkscape:cy="12.02109"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="748"
+ inkscape:window-x="-2"
+ inkscape:window-y="-3"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Camada 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1028.3622)">
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.4435586,1039.0094 c -0.6609274,0.6609 -0.6609274,1.7256 0,2.3865 l 0.088388,0.088 c 0.6609274,0.6609 1.725558,0.6609 2.3864854,0 l 7.093166,-7.0932 7.181553,7.1816 c 0.660927,0.6609 1.725558,0.6609 2.386485,0 l 0.110485,-0.1105 c 0.660928,-0.6609 0.660928,-1.7256 0,-2.3865 l -8.374795,-8.3748 -0.0442,-0.044 c -0.01589,-0.016 -0.02785,-0.029 -0.04419,-0.044 -0.660927,-0.6609 -1.725558,-0.6609 -2.386485,0 l -8.3968938,8.3969 z"
+ id="rect2985"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.6508842,1047.0718 c -0.6609274,0.6609 -0.6609274,1.7256 0,2.3865 l 0.088388,0.088 c 0.6609274,0.6609 1.7255583,0.6609 2.3864853,0 l 7.0931655,-7.0932 7.181553,7.1816 c 0.660927,0.6609 1.725558,0.6609 2.386485,0 l 0.110485,-0.1105 c 0.660928,-0.6609 0.660928,-1.7256 0,-2.3865 l -8.374795,-8.3748 -0.0442,-0.044 c -0.01589,-0.016 -0.02785,-0.029 -0.04419,-0.044 -0.660927,-0.6609 -1.725558,-0.6609 -2.386484,0 l -8.3968942,8.3969 z"
+ id="rect2985-6"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/icons/minimum.svg b/icons/minimum.svg
new file mode 100644
index 000000000..c0fce4b65
--- /dev/null
+++ b/icons/minimum.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="24"
+ height="24"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="maximum.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="23.708333"
+ inkscape:cx="12"
+ inkscape:cy="12.02109"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="748"
+ inkscape:window-x="-2"
+ inkscape:window-y="-3"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Camada 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1028.3622)">
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.4435586,1041.2378 c -0.6609274,-0.6609 -0.6609274,-1.7256 0,-2.3865 l 0.088388,-0.088 c 0.6609274,-0.6609 1.725558,-0.6609 2.3864854,0 l 7.093166,7.0932 7.181553,-7.1816 c 0.660927,-0.6609 1.725558,-0.6609 2.386485,0 l 0.110485,0.1105 c 0.660928,0.6609 0.660928,1.7256 0,2.3865 l -8.374795,8.3748 -0.0442,0.044 c -0.01589,0.016 -0.02785,0.029 -0.04419,0.044 -0.660927,0.6609 -1.725558,0.6609 -2.386485,0 l -8.3968938,-8.3969 z"
+ id="rect2985"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#1a1a1a;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.6508842,1033.1754 c -0.6609274,-0.6609 -0.6609274,-1.7256 0,-2.3865 l 0.088388,-0.088 c 0.6609274,-0.6609 1.7255583,-0.6609 2.3864853,0 l 7.0931655,7.0932 7.181553,-7.1816 c 0.660927,-0.6609 1.725558,-0.6609 2.386485,0 l 0.110485,0.1105 c 0.660928,0.6609 0.660928,1.7256 0,2.3865 l -8.374795,8.3748 -0.0442,0.044 c -0.01589,0.016 -0.02785,0.029 -0.04419,0.044 -0.660927,0.6609 -1.725558,0.6609 -2.386484,0 l -8.3968942,-8.3969 z"
+ id="rect2985-6"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 55f11789f..07e1d9749 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -137,20 +137,12 @@ void MainTab::clearInfo()
void MainTab::clearStats()
{
- ui->maximumDepthAllText->clear();
- ui->minimumDepthAllText->clear();
- ui->averageDepthAllText->clear();
- ui->maximumSacAllText->clear();
- ui->minimumSacAllText->clear();
- ui->averageSacAllText->clear();
+ ui->depthLimits->clear();
+ ui->sacLimits->clear();
ui->divesAllText->clear();
- ui->maximumTemperatureAllText->clear();
- ui->minimumTemperatureAllText->clear();
- ui->averageTemperatureAllText->clear();
+ ui->tempLimits->clear();
ui->totalTimeAllText->clear();
- ui->averageTimeAllText->clear();
- ui->longestAllText->clear();
- ui->shortestAllText->clear();
+ ui->timeLimits->clear();
}
#define UPDATE_TEXT(d, field) \
@@ -217,29 +209,29 @@ void MainTab::updateDiveInfo(int dive)
else
ui->airPressureText->clear();
ui->visibility->setCurrentStars(d->visibility);
- ui->maximumDepthAllText->setText(get_depth_string(stats_selection.max_depth, TRUE));
- ui->minimumDepthAllText->setText(get_depth_string(stats_selection.min_depth, TRUE));
- ui->averageDepthAllText->setText(get_depth_string(stats_selection.avg_depth, TRUE));
- ui->maximumSacAllText->setText(get_volume_string(stats_selection.max_sac, TRUE).append(tr("/min")));
- ui->minimumSacAllText->setText(get_volume_string(stats_selection.min_sac, TRUE).append(tr("/min")));
- ui->averageSacAllText->setText(get_volume_string(stats_selection.avg_sac, TRUE).append(tr("/min")));
+ ui->depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, TRUE));
+ ui->depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, TRUE));
+ ui->depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, TRUE));
+ ui->sacLimits->setMaximum(get_volume_string(stats_selection.max_sac, TRUE).append(tr("/min")));
+ ui->sacLimits->setMinimum(get_volume_string(stats_selection.min_sac, TRUE).append(tr("/min")));
+ ui->sacLimits->setAverage(get_volume_string(stats_selection.avg_sac, TRUE).append(tr("/min")));
ui->divesAllText->setText(QString::number(stats_selection.selection_size));
temp.mkelvin = stats_selection.max_temp;
- ui->maximumTemperatureAllText->setText(get_temperature_string(temp, TRUE));
+ ui->tempLimits->setMaximum(get_temperature_string(temp, TRUE));
temp.mkelvin = stats_selection.min_temp;
- ui->minimumTemperatureAllText->setText(get_temperature_string(temp, TRUE));
+ ui->tempLimits->setMinimum(get_temperature_string(temp, TRUE));
if (stats_selection.combined_temp && stats_selection.combined_count) {
const char *unit;
get_temp_units(0, &unit);
- ui->averageTemperatureAllText->setText(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit));
+ ui->tempLimits->setAverage(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit));
}
ui->totalTimeAllText->setText(get_time_string(stats_selection.total_time.seconds, 0));
int seconds = stats_selection.total_time.seconds;
if (stats_selection.selection_size)
seconds /= stats_selection.selection_size;
- ui->averageTimeAllText->setText(get_time_string(seconds, 0));
- ui->longestAllText->setText(get_time_string(stats_selection.longest_time.seconds, 0));
- ui->shortestAllText->setText(get_time_string(stats_selection.shortest_time.seconds, 0));
+ ui->timeLimits->setAverage(get_time_string(seconds, 0));
+ ui->timeLimits->setMaximum(get_time_string(stats_selection.longest_time.seconds, 0));
+ ui->timeLimits->setMinimum(get_time_string(stats_selection.shortest_time.seconds, 0));
cylindersModel->setDive(d);
weightModel->setDive(d);
addCylinder->setEnabled(true);
@@ -272,20 +264,12 @@ void MainTab::updateDiveInfo(int dive)
weightModel->clear();
addCylinder->setEnabled(false);
addWeight->setEnabled(false);
- ui->maximumDepthAllText->clear();
- ui->minimumDepthAllText->clear();
- ui->averageDepthAllText->clear();
- ui->maximumSacAllText->clear();
- ui->minimumSacAllText->clear();
- ui->averageSacAllText->clear();
+ ui->depthLimits->clear();
+ ui->sacLimits->clear();
ui->divesAllText->clear();
- ui->maximumTemperatureAllText->clear();
- ui->minimumTemperatureAllText->clear();
- ui->averageTemperatureAllText->clear();
+ ui->tempLimits->clear();
ui->totalTimeAllText->clear();
- ui->averageTimeAllText->clear();
- ui->longestAllText->clear();
- ui->shortestAllText->clear();
+ ui->timeLimits->clear();
}
/* statisticsTab*/
/* we can access the stats_selection struct, but how do we ensure the relevant dives are selected
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index 854e67940..55d4f3a54 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -14,7 +14,7 @@
<string>TabWidget</string>
</property>
<property name="currentIndex">
- <number>2</number>
+ <number>3</number>
</property>
<property name="documentMode">
<bool>true</bool>
@@ -453,40 +453,26 @@
<string>Stats</string>
</attribute>
<layout class="QGridLayout" name="gridLayout1">
- <item row="2" column="0">
- <widget class="QGroupBox" name="groupBox_8b">
+ <item row="0" column="2">
+ <widget class="QGroupBox" name="groupBox_4b">
<property name="title">
- <string>Max. Temp.</string>
+ <string>SAC</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_5b">
+ <layout class="QHBoxLayout" name="horizontalLayout_10b">
<item>
- <widget class="QLabel" name="maximumTemperatureAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
+ <widget class="MinMaxAvgWidget" name="sacLimits" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
- <widget class="QGroupBox" name="groupBox_2b">
+ <widget class="QGroupBox" name="groupBox_8b">
<property name="title">
- <string>Min Depth</string>
+ <string>Temperature</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_3b">
+ <layout class="QHBoxLayout" name="horizontalLayout_5b">
<item>
- <widget class="QLabel" name="minimumDepthAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
+ <widget class="MinMaxAvgWidget" name="tempLimits" native="true"/>
</item>
</layout>
</widget>
@@ -494,196 +480,28 @@
<item row="0" column="0">
<widget class="QGroupBox" name="groupBoxb">
<property name="title">
- <string>Max. Depth</string>
+ <string>Depth</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2b">
<item>
- <widget class="QLabel" name="maximumDepthAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- <zorder>maximumDepthAllText</zorder>
- <zorder>minimumDepthAllText</zorder>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QGroupBox" name="groupBox_10b">
- <property name="title">
- <string>Ave. Temp.</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_7b">
- <item>
- <widget class="QLabel" name="averageTemperatureAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QGroupBox" name="groupBox_12b">
- <property name="title">
- <string>Ave. Time</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_13b">
- <item>
- <widget class="QLabel" name="averageTimeAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QGroupBox" name="groupBox_9b">
- <property name="title">
- <string>Min. Temp.</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_6b">
- <item>
- <widget class="QLabel" name="minimumTemperatureAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QGroupBox" name="groupBox_3b">
- <property name="title">
- <string>Ave. Depth</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_4b">
- <item>
- <widget class="QLabel" name="averageDepthAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QGroupBox" name="groupBox_4b">
- <property name="title">
- <string>Max. SAC</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_10b">
- <item>
- <widget class="QLabel" name="maximumSacAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QGroupBox" name="groupBox_5b">
- <property name="title">
- <string>Min. SAC</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_9b">
- <item>
- <widget class="QLabel" name="minimumSacAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
+ <widget class="MinMaxAvgWidget" name="depthLimits" native="true"/>
</item>
</layout>
</widget>
</item>
- <item row="3" column="2">
- <widget class="QGroupBox" name="groupBox_6b">
- <property name="title">
- <string>Ave. SAC</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_8b">
- <item>
- <widget class="QLabel" name="averageSacAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QGroupBox" name="groupBox_7b">
- <property name="title">
- <string>Dives</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_15">
- <item>
- <widget class="QLabel" name="divesAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="1">
+ <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_13">
<property name="title">
- <string>Longest</string>
+ <string>Duration</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_12b">
<item>
- <widget class="QLabel" name="longestAllText">
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
+ <widget class="MinMaxAvgWidget" name="timeLimits" native="true"/>
</item>
</layout>
</widget>
</item>
- <item row="4" column="0">
+ <item row="1" column="1">
<widget class="QGroupBox" name="groupBox_11b">
<property name="title">
<string>Total Time</string>
@@ -702,14 +520,14 @@
</layout>
</widget>
</item>
- <item row="7" column="1">
- <widget class="QGroupBox" name="groupBox_14">
+ <item row="1" column="2">
+ <widget class="QGroupBox" name="groupBox_7b">
<property name="title">
- <string>Shortest</string>
+ <string>Dives</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_14">
+ <layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
- <widget class="QLabel" name="shortestAllText">
+ <widget class="QLabel" name="divesAllText">
<property name="text">
<string>TextLabel</string>
</property>
@@ -737,6 +555,12 @@
<header>starwidget.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>MinMaxAvgWidget</class>
+ <extends>QWidget</extends>
+ <header>simplewidgets.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
new file mode 100644
index 000000000..c389a34c3
--- /dev/null
+++ b/qt-ui/simplewidgets.cpp
@@ -0,0 +1,92 @@
+#include "simplewidgets.h"
+
+#include <QLabel>
+#include <QLabel>
+#include <QFormLayout>
+#include <QIcon>
+
+class MinMaxAvgWidgetPrivate{
+public:
+ QLabel *avgIco, *avgValue;
+ QLabel *minIco, *minValue;
+ QLabel *maxIco, *maxValue;
+
+ MinMaxAvgWidgetPrivate(MinMaxAvgWidget *owner){
+ avgIco = new QLabel(owner);
+ avgIco->setPixmap(QIcon(":/average").pixmap(16,16));
+ avgIco->setToolTip(QObject::tr("Average"));
+ minIco = new QLabel(owner);
+ minIco->setPixmap(QIcon(":/minimum").pixmap(16,16));
+ minIco->setToolTip(QObject::tr("Minimum"));
+ maxIco = new QLabel(owner);
+ maxIco->setPixmap(QIcon(":/maximum").pixmap(16,16));
+ maxIco->setToolTip(QObject::tr("Maximum"));
+ avgValue = new QLabel(owner);
+ minValue = new QLabel(owner);
+ maxValue = new QLabel(owner);
+
+ QGridLayout *formLayout = new QGridLayout();
+ formLayout->addWidget(maxIco, 0, 0);
+ formLayout->addWidget(maxValue, 0, 1);
+ formLayout->addWidget(avgIco, 1, 0);
+ formLayout->addWidget(avgValue, 1, 1);
+ formLayout->addWidget(minIco, 2, 0);
+ formLayout->addWidget(minValue, 2, 1);
+ owner->setLayout(formLayout);
+ }
+};
+
+double MinMaxAvgWidget::average() const
+{
+ return d->avgValue->text().toDouble();
+}
+
+double MinMaxAvgWidget::maximum() const
+{
+ return d->maxValue->text().toDouble();
+}
+double MinMaxAvgWidget::minimum() const
+{
+ return d->minValue->text().toDouble();
+}
+
+MinMaxAvgWidget::MinMaxAvgWidget(QWidget* parent)
+: d(new MinMaxAvgWidgetPrivate(this)){
+
+}
+
+void MinMaxAvgWidget::clear()
+{
+ d->avgValue->setText(QString());
+ d->maxValue->setText(QString());
+ d->minValue->setText(QString());
+}
+
+void MinMaxAvgWidget::setAverage(double average)
+{
+ d->avgValue->setText(QString::number(average));
+}
+
+void MinMaxAvgWidget::setMaximum(double maximum)
+{
+ d->maxValue->setText(QString::number(maximum));
+}
+void MinMaxAvgWidget::setMinimum(double minimum)
+{
+ d->minValue->setText(QString::number(minimum));
+}
+
+void MinMaxAvgWidget::setAverage(const QString& average)
+{
+ d->avgValue->setText(average);
+}
+
+void MinMaxAvgWidget::setMaximum(const QString& maximum)
+{
+ d->maxValue->setText(maximum);
+}
+
+void MinMaxAvgWidget::setMinimum(const QString& minimum)
+{
+ d->minValue->setText(minimum);
+}
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
new file mode 100644
index 000000000..b05dd8f0e
--- /dev/null
+++ b/qt-ui/simplewidgets.h
@@ -0,0 +1,28 @@
+#ifndef SIMPLEWIDGETS_H
+#define SIMPLEWIDGETS_H
+
+class MinMaxAvgWidgetPrivate;
+#include <QWidget>
+
+class MinMaxAvgWidget : public QWidget{
+ Q_OBJECT
+ Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
+ Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
+ Q_PROPERTY(double average READ average WRITE setAverage)
+public:
+ MinMaxAvgWidget(QWidget *parent);
+ double minimum() const;
+ double maximum() const;
+ double average() const;
+ void setMinimum(double minimum);
+ void setMaximum(double maximum);
+ void setAverage(double average);
+ void setMinimum(const QString& minimum);
+ void setMaximum(const QString& maximum);
+ void setAverage(const QString& average);
+ void clear();
+private:
+ MinMaxAvgWidgetPrivate *d;
+};
+
+#endif \ No newline at end of file
diff --git a/subsurface.qrc b/subsurface.qrc
index fa514cb94..e94505cea 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -7,5 +7,8 @@
<file alias="units">icons/units.png</file>
<file alias="advanced">icons/advanced.png</file>
<file alias="graph">icons/graph.png</file>
+ <file alias="minimum">icons/minimum.svg</file>
+ <file alias="maximum">icons/maximum.svg</file>
+ <file alias="average">icons/average.svg</file>
</qresource>
</RCC>