diff options
-rw-r--r-- | profile-widget/diveprofileitem.cpp | 28 | ||||
-rw-r--r-- | profile-widget/diveprofileitem.h | 3 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 1 |
3 files changed, 2 insertions, 30 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp index b1524446e..c69e08489 100644 --- a/profile-widget/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -9,7 +9,6 @@ #include "core/qthelper.h" #include "core/settings/qPrefTechnicalDetails.h" #include "core/settings/qPrefLog.h" -#include "core/subsurface-qt/divelistnotifier.h" #include "libdivecomputer/parser.h" #include "profile-widget/profilewidget2.h" @@ -18,7 +17,6 @@ AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel & hAxis(horizontal), vAxis(vertical), dataModel(model), hDataColumn(hColumn), vDataColumn(vColumn) { setCacheMode(DeviceCoordinateCache); - connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &AbstractProfilePolygonItem::settingsChanged); connect(&dataModel, &DivePlotDataModel::dataChanged, this, &AbstractProfilePolygonItem::modelDataChanged); connect(&dataModel, &DivePlotDataModel::rowsAboutToBeRemoved, this, &AbstractProfilePolygonItem::modelDataRemoved); connect(&hAxis, &DiveCartesianAxis::sizeChanged, this, &AbstractProfilePolygonItem::replot); @@ -31,10 +29,6 @@ void AbstractProfilePolygonItem::replot() modelDataChanged(); } -void AbstractProfilePolygonItem::settingsChanged() -{ -} - void AbstractProfilePolygonItem::setVisible(bool visible) { QGraphicsPolygonItem::setVisible(visible); @@ -92,7 +86,7 @@ DiveProfileItem::DiveProfileItem(const DivePlotDataModel &model, const DiveCarte void DiveProfileItem::settingsToggled(bool) { - settingsChanged(); + replot(); } void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) @@ -216,14 +210,6 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI } } -void DiveProfileItem::settingsChanged() -{ - //TODO: Only modelDataChanged() here if we need to rebuild the graph ( for instance, - // if the prefs.dcceiling are enabled, but prefs.redceiling is disabled - // and only if it changed something. let's not waste cpu cycles repoloting something we don't need to. - modelDataChanged(); -} - void DiveProfileItem::plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color) { DiveTextItem *item = new DiveTextItem(this); @@ -326,7 +312,6 @@ DivePercentageItem::DivePercentageItem(const DivePlotDataModel &model, const Div tissueIndex(i) { connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraphChanged, this, &DivePercentageItem::setVisible); - settingsChanged(); } void DivePercentageItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) @@ -407,7 +392,6 @@ DiveAmbPressureItem::DiveAmbPressureItem(const DivePlotDataModel &model, const D pen.setCosmetic(true); pen.setWidth(2); setPen(pen); - settingsChanged(); } void DiveAmbPressureItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) @@ -453,7 +437,6 @@ DiveGFLineItem::DiveGFLineItem(const DivePlotDataModel &model, const DiveCartesi pen.setCosmetic(true); pen.setWidth(2); setPen(pen); - settingsChanged(); } void DiveGFLineItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) @@ -580,7 +563,6 @@ DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveC pen.setWidth(2); setPen(pen); lastRunningSum = 0.0; - settingsChanged(); } void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) @@ -844,18 +826,13 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI DiveCalculatedTissue::DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, ProfileWidget2 *widget) : DiveCalculatedCeiling(model, hAxis, hColumn, vAxis, vColumn, widget) { - settingsChanged(); + setVisible(true); connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::calcalltissuesChanged, this, &DiveCalculatedTissue::setVisible); connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::calcceilingChanged, this, &DiveCalculatedTissue::setVisible); } void DiveCalculatedTissue::setVisible(bool) { - settingsChanged(); -} - -void DiveCalculatedTissue::settingsChanged() -{ DiveCalculatedCeiling::setVisible(prefs.calcalltissues && prefs.calcceiling); } @@ -864,7 +841,6 @@ DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const D { connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::dcceilingChanged, this, &DiveReportedCeiling::setVisible); setVisible(prefs.dcceiling); - settingsChanged(); } void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) diff --git a/profile-widget/diveprofileitem.h b/profile-widget/diveprofileitem.h index e66f337af..0b928514c 100644 --- a/profile-widget/diveprofileitem.h +++ b/profile-widget/diveprofileitem.h @@ -39,7 +39,6 @@ public: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0; public 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 replot(); @@ -71,7 +70,6 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()) override; void settingsToggled(bool toggled); - void settingsChanged() override; void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color); int maxCeiling(int row); @@ -195,7 +193,6 @@ public: DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, ProfileWidget2 *profileWidget); void setVisible(bool visible); - void settingsChanged() override; }; class PartialPressureGasItem : public AbstractProfilePolygonItem { diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index cf9e3e997..05a1fcff1 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -375,7 +375,6 @@ PartialPressureGasItem *ProfileWidget2::createPPGas(int column, color_index_t co PartialPressureGasItem *item = createItem<PartialPressureGasItem>(*gasYAxis, column, 99); item->setThresholdSettingsKey(thresholdSettingsMin, thresholdSettingsMax); item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale)); - item->settingsChanged(); return item; } |