profile: remove ProfileScene::dataModel

All data access is now directly via the plot_info structure
owned by the ProfileScene itself.

Also removes DivePercentageItem::hColumn, which was an
artifact from the DivePlotDataModel.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-12-03 19:09:39 +01:00 committed by Dirk Hohndel
parent bdbcb1b7e3
commit 7aacde3169
6 changed files with 2 additions and 15 deletions

View file

@ -854,7 +854,7 @@ void ReplanDive::undo()
QVector<dive *> divesToNotify = { d }; QVector<dive *> divesToNotify = { d };
// Note that we have to emit cylindersReset before divesChanged, because the divesChanged // Note that we have to emit cylindersReset before divesChanged, because the divesChanged
// updates the DivePlotDataModel, which is out-of-sync and gets confused. // updates the profile, which is out-of-sync and gets confused.
emit diveListNotifier.cylindersReset(divesToNotify); emit diveListNotifier.cylindersReset(divesToNotify);
emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE | emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE |
DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS); DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS);

View file

@ -3,7 +3,6 @@
#include "profile-widget/divetextitem.h" #include "profile-widget/divetextitem.h"
#include "core/qthelper.h" #include "core/qthelper.h"
#include "core/subsurface-string.h" #include "core/subsurface-string.h"
#include "qt-models/diveplotdatamodel.h"
#include "profile-widget/animationfunctions.h" #include "profile-widget/animationfunctions.h"
#include "profile-widget/divelineitem.h" #include "profile-widget/divelineitem.h"
#include "profile-widget/profilescene.h" #include "profile-widget/profilescene.h"

View file

@ -6,7 +6,6 @@
struct dive; struct dive;
struct divecomputer; struct divecomputer;
struct plot_info; struct plot_info;
class DivePlotDataModel;
class DiveCartesianAxis; class DiveCartesianAxis;
class DivePercentageItem : public QGraphicsPixmapItem { class DivePercentageItem : public QGraphicsPixmapItem {
@ -16,7 +15,6 @@ public:
private: private:
const DiveCartesianAxis &hAxis; const DiveCartesianAxis &hAxis;
const DiveCartesianAxis &vAxis; const DiveCartesianAxis &vAxis;
int hDataColumn;
double dpr; double dpr;
}; };

View file

@ -14,7 +14,6 @@
#include "core/qthelper.h" // for decoMode() #include "core/qthelper.h" // for decoMode()
#include "core/subsurface-string.h" #include "core/subsurface-string.h"
#include "core/settings/qPrefDisplay.h" #include "core/settings/qPrefDisplay.h"
#include "qt-models/diveplotdatamodel.h"
#include "qt-models/diveplannermodel.h" #include "qt-models/diveplannermodel.h"
#include <QAbstractAnimation> #include <QAbstractAnimation>
@ -92,7 +91,6 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
isGrayscale(isGrayscale), isGrayscale(isGrayscale),
maxtime(-1), maxtime(-1),
maxdepth(-1), maxdepth(-1),
dataModel(new DivePlotDataModel(this)),
profileYAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, true, 3, 0, TIME_GRID, Qt::red, true, true, profileYAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, true, 3, 0, TIME_GRID, Qt::red, true, true,
dpr, 1.0, printMode, isGrayscale, *this)), dpr, 1.0, printMode, isGrayscale, *this)),
gasYAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, false, 1, 2, TIME_GRID, Qt::black, true, true, gasYAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, false, 1, 2, TIME_GRID, Qt::black, true, true,
@ -191,8 +189,6 @@ ProfileScene::~ProfileScene()
void ProfileScene::clear() void ProfileScene::clear()
{ {
dataModel->clear();
for (AbstractProfilePolygonItem *item: profileItems) for (AbstractProfilePolygonItem *item: profileItems)
item->clear(); item->clear();
@ -467,8 +463,6 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
maxdepth = newMaxDepth; maxdepth = newMaxDepth;
} }
dataModel->setDive(plotInfo);
// It seems that I'll have a lot of boilerplate setting the model / axis for // It seems that I'll have a lot of boilerplate setting the model / axis for
// each item, I'll mostly like to fix this in the future, but I'll keep at this for now. // each item, I'll mostly like to fix this in the future, but I'll keep at this for now.
profileYAxis->setBounds(0.0, maxdepth); profileYAxis->setBounds(0.0, maxdepth);

View file

@ -11,9 +11,6 @@
#include <QPainter> #include <QPainter>
#include <memory> #include <memory>
class DivePlannerPointsModel;
class DivePlotDataModel;
class AbstractProfilePolygonItem; class AbstractProfilePolygonItem;
class DiveCalculatedCeiling; class DiveCalculatedCeiling;
class DiveCalculatedTissue; class DiveCalculatedTissue;
@ -24,6 +21,7 @@ class DiveHeartrateItem;
class DiveMeanDepthItem; class DiveMeanDepthItem;
class DivePercentageItem; class DivePercentageItem;
class DivePixmaps; class DivePixmaps;
class DivePlannerPointsModel;
class DiveProfileItem; class DiveProfileItem;
class DiveReportedCeiling; class DiveReportedCeiling;
class DiveTemperatureItem; class DiveTemperatureItem;
@ -69,7 +67,6 @@ private:
int maxtime; int maxtime;
int maxdepth; int maxdepth;
DivePlotDataModel *dataModel;
struct plot_info plotInfo; struct plot_info plotInfo;
DiveCartesianAxis *profileYAxis; DiveCartesianAxis *profileYAxis;
DiveCartesianAxis *gasYAxis; DiveCartesianAxis *gasYAxis;

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "profile-widget/profilewidget2.h" #include "profile-widget/profilewidget2.h"
#include "profile-widget/profilescene.h" #include "profile-widget/profilescene.h"
#include "qt-models/diveplotdatamodel.h"
#include "core/device.h" #include "core/device.h"
#include "core/event.h" #include "core/event.h"
#include "core/subsurface-string.h" #include "core/subsurface-string.h"