mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn event-list of divecomputer into std::vector<>
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>
This commit is contained in:
parent
8ddc960fa0
commit
27dbdd35c6
36 changed files with 644 additions and 821 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#define DIVEEVENTITEM_H
|
||||
|
||||
#include "divepixmapitem.h"
|
||||
#include "core/event.h"
|
||||
|
||||
class DiveCartesianAxis;
|
||||
class DivePixmaps;
|
||||
|
|
@ -12,17 +13,15 @@ struct plot_info;
|
|||
class DiveEventItem : public DivePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
||||
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();
|
||||
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);
|
||||
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
||||
const struct event *ev, const struct plot_info &pi,
|
||||
const struct event &ev, const struct plot_info &pi,
|
||||
int firstSecond, int lastSecond);
|
||||
|
||||
private:
|
||||
|
|
@ -31,7 +30,9 @@ private:
|
|||
void recalculatePos();
|
||||
DiveCartesianAxis *vAxis;
|
||||
DiveCartesianAxis *hAxis;
|
||||
struct event *ev;
|
||||
public:
|
||||
int idx;
|
||||
struct event ev;
|
||||
const struct dive *dive;
|
||||
int depth;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue