mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
9740651e01
The DivePlotDataModel was saved with every event to access the depth. However, since the depth never changes, we can simply save the depth instead. Also, since we only need the model to access the plot_info, pass the plot_info directly. As noted in a previous commit message, I believe that Qt models are a very bad choice for intra-application data transfer. They should only ever be used to interface with Qt. And since touching this code, pass duration_t instead of int to depthAtTime() to make the callers less cluttered. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEEVENTITEM_H
|
|
#define DIVEEVENTITEM_H
|
|
|
|
#include "divepixmapitem.h"
|
|
|
|
class DiveCartesianAxis;
|
|
class DivePixmaps;
|
|
struct event;
|
|
struct plot_info;
|
|
|
|
class DiveEventItem : public DivePixmapItem {
|
|
Q_OBJECT
|
|
public:
|
|
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
|
const struct plot_info &pi, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
|
int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent = nullptr);
|
|
~DiveEventItem();
|
|
const struct event *getEvent() const;
|
|
struct event *getEventMutable();
|
|
void eventVisibilityChanged(const QString &eventName, bool visible);
|
|
void setVerticalAxis(DiveCartesianAxis *axis, int speed);
|
|
void setHorizontalAxis(DiveCartesianAxis *axis);
|
|
bool shouldBeHidden();
|
|
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
|
const struct event *ev, const struct plot_info &pi);
|
|
public
|
|
slots:
|
|
void recalculatePos(int animationSpeed);
|
|
|
|
private:
|
|
void setupToolTipString(struct gasmix lastgasmix);
|
|
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
|
|
DiveCartesianAxis *vAxis;
|
|
DiveCartesianAxis *hAxis;
|
|
struct event *ev;
|
|
const struct dive *dive;
|
|
int depth;
|
|
};
|
|
|
|
#endif // DIVEEVENTITEM_H
|