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:
committed by
Dirk Hohndel
parent
2c5fad73e8
commit
2d96139566
@@ -1,6 +1,7 @@
|
||||
#include "divecartesianaxis.h"
|
||||
#include "divetextitem.h"
|
||||
#include "helpers.h"
|
||||
#include <subsurface-qt/SettingsObjectWrapper.h>
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
#include "preferences/preferencesdialog.h"
|
||||
#endif
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -49,6 +49,7 @@ slots:
|
||||
virtual void settingsChanged();
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
virtual void modelDataRemoved(const QModelIndex &parent, int from, int to);
|
||||
void setVisible(bool visible);
|
||||
|
||||
protected:
|
||||
/* when the model emits a 'datachanged' signal, this method below should be used to check if the
|
||||
@@ -91,7 +92,6 @@ public:
|
||||
DiveMeanDepthItem();
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
virtual void settingsChanged();
|
||||
|
||||
private:
|
||||
void createTextItem();
|
||||
@@ -116,7 +116,6 @@ public:
|
||||
DiveHeartrateItem();
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void settingsChanged();
|
||||
|
||||
private:
|
||||
void createTextItem(int seconds, int hr);
|
||||
@@ -129,7 +128,6 @@ public:
|
||||
DivePercentageItem(int i);
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void settingsChanged();
|
||||
|
||||
private:
|
||||
QString visibilityKey;
|
||||
@@ -141,7 +139,6 @@ public:
|
||||
DiveAmbPressureItem();
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void settingsChanged();
|
||||
|
||||
private:
|
||||
QString visibilityKey;
|
||||
@@ -153,7 +150,6 @@ public:
|
||||
DiveGFLineItem();
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void settingsChanged();
|
||||
|
||||
private:
|
||||
QString visibilityKey;
|
||||
@@ -205,6 +201,7 @@ class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveCalculatedTissue(ProfileWidget2 *profileWidget);
|
||||
void setVisible(bool visible);
|
||||
virtual void settingsChanged();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user