subsurface/profile-widget/diveeventitem.h
Berthold Stoeger 8a9ca5fcda profile: don't create "uninteresting" event icons
There is code to dynamically show/hide event icons of a certain
type. The same code is used to hide generally non-interesting/
redundant items.

Instead, don't even create these items. Yes, this is idle
premature optimization.

A loop over all created event icons to hide them can be
removed, because the icon is hidden anyway on construction
time.

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

42 lines
1.3 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();
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
const struct event *ev, const DivePlotDataModel &model);
public
slots:
void recalculatePos(int animationSpeed);
private:
void setupToolTipString(struct gasmix lastgasmix);
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;
DivePlotDataModel *dataModel;
struct event *ev;
const struct dive *dive;
};
#endif // DIVEEVENTITEM_H