summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Lakshman <acrlakshman@gmail.com>2014-04-08 00:00:50 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-10 09:21:43 -0700
commit6a8d929876f5a8d0279d2a83248a5d7b59e0ae39 (patch)
tree97ce70f6851a4e2d756a946607298f6325edf9d3 /qt-ui/profile/profilewidget2.cpp
parent20bde81023938a64fd417e75af3b85f19789f9ac (diff)
downloadsubsurface-6a8d929876f5a8d0279d2a83248a5d7b59e0ae39.tar.gz
Feature to show or hide heart rate graph
Adds new push button "HR" to the button bar on the dive profile to toggle display of heart rate. TODO: New icon for the heart rate button is needed. Fixes #485 Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 047634e15..95f8f49ee 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -193,6 +193,8 @@ void ProfileWidget2::setupItemOnScene()
setupItem(gasPressureItem, timeAxis, cylinderPressureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
setupItem(temperatureItem, timeAxis, temperatureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
setupItem(heartBeatItem, timeAxis, heartBeatAxis, dataModel, DivePlotDataModel::HEARTBEAT, DivePlotDataModel::TIME, 1);
+ heartBeatItem->setVisibilitySettingsKey("hrgraph");
+ heartBeatItem->preferencesChanged();
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
@@ -400,11 +402,15 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
temperatureAxis->setMinimum(pInfo.mintemp);
temperatureAxis->setMaximum(pInfo.maxtemp);
- if (pInfo.maxhr) {
- heartBeatAxis->setMinimum(pInfo.minhr);
- heartBeatAxis->setMaximum(pInfo.maxhr);
- heartBeatAxis->updateTicks(); // this shows the ticks
- heartBeatAxis->setVisible(true);
+ if (heartBeatItem->isVisible()) {
+ if (pInfo.maxhr) {
+ heartBeatAxis->setMinimum(pInfo.minhr);
+ heartBeatAxis->setMaximum(pInfo.maxhr);
+ heartBeatAxis->updateTicks(); // this shows the ticks
+ heartBeatAxis->setVisible(true);
+ } else {
+ heartBeatAxis->setVisible(false);
+ }
} else {
heartBeatAxis->setVisible(false);
}
@@ -656,6 +662,7 @@ void ProfileWidget2::setProfileState()
temperatureAxis->setPos(itemPos.temperature.pos.on);
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
+ heartBeatItem->setVisible(s.value("hrgraph").toBool());
meanDepth->setVisible(true);
diveComputerText->setVisible(true);