summaryrefslogtreecommitdiffstats
path: root/profile-widget/diveprofileitem.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-25 16:49:51 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-25 13:04:16 -0800
commit2d9613956618105030611f7c785d7dbdd5c5c672 (patch)
tree134c6d07daf9b37244ce06ff194f83c74d8cead6 /profile-widget/diveprofileitem.cpp
parent2c5fad73e8939409639548571dcb942e6b2cb792 (diff)
downloadsubsurface-2d9613956618105030611f7c785d7dbdd5c5c672.tar.gz
Changed quite a few shorts to bool on the c++ implementtion
The shorts where being used on the preferences since a long while and we cannot just simply change them to bool since this could break the preferences files, so work around that by changing them to booleans, since it's the correct type for a true / false answer. Also, move some plot curves to the new settings style Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/diveprofileitem.cpp')
-rw-r--r--profile-widget/diveprofileitem.cpp45
1 files changed, 19 insertions, 26 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index b7729bda1..f567801ce 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -10,6 +10,7 @@
#endif
#include "diveplannermodel.h"
#include "helpers.h"
+#include <subsurface-qt/SettingsObjectWrapper.h>
#include "libdivecomputer/parser.h"
#include "profilewidget2.h"
@@ -27,6 +28,11 @@ void AbstractProfilePolygonItem::settingsChanged()
{
}
+void AbstractProfilePolygonItem::setVisible(bool visible)
+{
+ QGraphicsPolygonItem::setVisible(visible);
+}
+
void AbstractProfilePolygonItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
hAxis = horizontal;
@@ -255,7 +261,7 @@ DiveHeartrateItem::DiveHeartrateItem()
pen.setCosmetic(true);
pen.setWidth(1);
setPen(pen);
- settingsChanged();
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::hrgraphChanged, this, &DiveHeartrateItem::setVisible);
}
void DiveHeartrateItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
@@ -334,11 +340,6 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->restore();
}
-void DiveHeartrateItem::settingsChanged()
-{
- setVisible(prefs.hrgraph);
-}
-
DivePercentageItem::DivePercentageItem(int i)
{
QPen pen;
@@ -383,11 +384,7 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
-}
-
-void DivePercentageItem::settingsChanged()
-{
- setVisible(prefs.percentagegraph);
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::percentageGraphChanged, this, &DivePercentageItem::setVisible);
}
DiveAmbPressureItem::DiveAmbPressureItem()
@@ -432,11 +429,7 @@ void DiveAmbPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
-}
-
-void DiveAmbPressureItem::settingsChanged()
-{
- setVisible(prefs.percentagegraph);
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::percentageGraphChanged, this, &DiveAmbPressureItem::setVisible);
}
DiveGFLineItem::DiveGFLineItem()
@@ -481,11 +474,7 @@ void DiveGFLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
-}
-
-void DiveGFLineItem::settingsChanged()
-{
- setVisible(prefs.percentagegraph);
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::percentageGraphChanged, this, &DiveAmbPressureItem::setVisible);
}
DiveTemperatureItem::DiveTemperatureItem()
@@ -610,11 +599,7 @@ void DiveMeanDepthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
-}
-
-void DiveMeanDepthItem::settingsChanged()
-{
- setVisible(prefs.show_average_depth);
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showAverageDepthChanged, this, &DiveAmbPressureItem::setVisible);
}
void DiveMeanDepthItem::createTextItem() {
@@ -838,6 +823,14 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI
DiveCalculatedTissue::DiveCalculatedTissue(ProfileWidget2 *widget) : DiveCalculatedCeiling(widget)
{
settingsChanged();
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::calcalltissuesChanged, this, &DiveCalculatedTissue::setVisible);
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::calcceilingChanged, this, &DiveCalculatedTissue::setVisible);
+}
+
+void DiveCalculatedTissue::setVisible(bool visible)
+{
+ Q_UNUSED(visible);
+ settingsChanged();
}
void DiveCalculatedTissue::settingsChanged()