summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveeventitem.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-16 15:02:32 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-17 06:17:09 +0700
commit1f8078828663f6bfff768cbc2fb36e6643eb3d0e (patch)
tree93437eb965759cb6b08ce2b92b6568c81d4559e7 /qt-ui/profile/diveeventitem.h
parent9cb5ea45d886c15b26b196bc292b7a4bbf359b20 (diff)
downloadsubsurface-1f8078828663f6bfff768cbc2fb36e6643eb3d0e.tar.gz
Added a DiveEventItem that knows how to handle itself.
Simply pass a event to the item and it will know what to do. The sad part is that this isn't true yet - there's quite a bit of boilerplate that a lot of the items are needing, but the good part is that the boolerplate is the same in all of the items, which means that I can create a tiny bit of abstraction to encapsulate it and the code will be way smaller to setup the items on the canvas. Right now the items are being correctly placed on the right places. It doesn't supports hidding / showing yet. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveeventitem.h')
-rw-r--r--qt-ui/profile/diveeventitem.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/qt-ui/profile/diveeventitem.h b/qt-ui/profile/diveeventitem.h
new file mode 100644
index 000000000..896036e8d
--- /dev/null
+++ b/qt-ui/profile/diveeventitem.h
@@ -0,0 +1,29 @@
+#ifndef DIVEEVENTITEM_H
+#define DIVEEVENTITEM_H
+
+#include "divepixmapitem.h"
+
+class DiveCartesianAxis;
+class DivePlotDataModel;
+struct event;
+
+class DiveEventItem : public DivePixmapItem {
+ Q_OBJECT
+public:
+ DiveEventItem(QObject* parent = 0);
+ void setEvent(struct event *ev);
+ void eventVisibilityChanged(const QString& eventName, bool visible);
+ void setVerticalAxis(DiveCartesianAxis *axis);
+ void setHorizontalAxis(DiveCartesianAxis *axis);
+ void setModel(DivePlotDataModel *model);
+ void recalculate();
+private:
+ void setupToolTipString();
+ void setupPixmap();
+ DiveCartesianAxis *vAxis;
+ DiveCartesianAxis *hAxis;
+ DivePlotDataModel *dataModel;
+ struct event* internalEvent;
+};
+
+#endif \ No newline at end of file