subsurface/profile-widget/diveeventitem.h
Berthold Stoeger f82ae2be7f profile: cache pixmaps for dive event items
For better scalability, we might replace the dive event icons
by SVGs. Since rendering SVGs is potentially very slow, cache
the pixmaps when the scene is generated.

Note: this does not yet do any SVG rendering, only the caching
of pixmaps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00

41 lines
1.2 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef DIVEEVENTITEM_H
#define DIVEEVENTITEM_H
#include "divepixmapitem.h"
class DiveCartesianAxis;
class DivePixmapCache;
class DivePixmaps;
struct event;
class DiveEventItem : public DivePixmapItem {
Q_OBJECT
public:
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
DivePlotDataModel *model, 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);
void setModel(DivePlotDataModel *model);
bool shouldBeHidden();
public
slots:
void recalculatePos(int animationSpeed);
private:
void setupToolTipString(struct gasmix lastgasmix);
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
int depthAtTime(int time);
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;
DivePlotDataModel *dataModel;
struct event *ev;
const struct dive *dive;
};
#endif // DIVEEVENTITEM_H