mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
27dbdd35c6
This is a rather long commit, because it refactors lots of the event code from pointer to value semantics: pointers to entries in an std::vector<> are not stable, so better use indexes. To step through the event-list at diven time stamps, add *_loop classes, which encapsulate state that had to be manually handled before by the caller. I'm not happy about the interface, but it tries to mirror the one we had before. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEEVENTITEM_H
|
|
#define DIVEEVENTITEM_H
|
|
|
|
#include "divepixmapitem.h"
|
|
#include "core/event.h"
|
|
|
|
class DiveCartesianAxis;
|
|
class DivePixmaps;
|
|
struct event;
|
|
struct plot_info;
|
|
|
|
class DiveEventItem : public DivePixmapItem {
|
|
Q_OBJECT
|
|
public:
|
|
DiveEventItem(const struct dive *d, int idx, const struct event &ev, struct gasmix lastgasmix,
|
|
const struct plot_info &pi, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
|
int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent = nullptr);
|
|
~DiveEventItem();
|
|
void eventVisibilityChanged(const QString &eventName, bool visible);
|
|
void setVerticalAxis(DiveCartesianAxis *axis, int speed);
|
|
void setHorizontalAxis(DiveCartesianAxis *axis);
|
|
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
|
const struct event &ev, const struct plot_info &pi,
|
|
int firstSecond, int lastSecond);
|
|
|
|
private:
|
|
void setupToolTipString(struct gasmix lastgasmix);
|
|
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
|
|
void recalculatePos();
|
|
DiveCartesianAxis *vAxis;
|
|
DiveCartesianAxis *hAxis;
|
|
public:
|
|
int idx;
|
|
struct event ev;
|
|
const struct dive *dive;
|
|
int depth;
|
|
};
|
|
|
|
#endif // DIVEEVENTITEM_H
|