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>
This commit is contained in:
Tomaz Canabrava 2016-01-25 16:49:51 -02:00 committed by Dirk Hohndel
parent 2c5fad73e8
commit 2d96139566
5 changed files with 130 additions and 139 deletions

View file

@ -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()