7 * The heatmap iterator will only return data when there is something to draw,
8 * this allows much faster access to the data in the case where the view is
9 * zoomed out to the point of where there is multiple calls in one pixel,
10 * it automagically calculates the heat for that pixel.
12 class HeatmapRowIterator {
14 virtual ~HeatmapRowIterator(){}
16 /* Go to the next visible heat map */
17 virtual bool next() = 0;
19 /* Is the current value GPU or CPU heat */
20 virtual bool isGpu() const = 0;
22 /* Current step (normally x coordinate) */
23 virtual int step() const = 0;
25 /* Current width (in steps) */
26 virtual int width() const = 0;
29 virtual float heat() const = 0;
31 /* Heat value for selected calls */
32 virtual float selectedHeat() const = 0;
34 /* Label only used when there is a single call in this heat */
35 virtual QString label() const = 0;
40 * Data provider for the whole heatmap
42 class HeatmapDataProvider {
44 virtual ~HeatmapDataProvider(){}
46 /* The start and end values (time on x-axis) for the heatmap */
47 virtual qint64 start() const = 0;
48 virtual qint64 end() const = 0;
51 * Header rows (fixed at top of heatmap view)
54 /* Header row count */
55 virtual unsigned headerRows() const = 0;
57 /* Label to be used in the vertical axis */
58 virtual QString headerLabel(unsigned row) const = 0;
60 /* Get identifier (program no) for row */
61 virtual qint64 headerRowAt(unsigned row) const = 0;
63 /* Get item at row and time */
64 virtual qint64 headerItemAt(unsigned row, qint64 time) const = 0;
66 /* Get iterator for a row between start and end time for steps */
67 virtual HeatmapRowIterator* headerRowIterator(int row, qint64 start, qint64 end, int steps) const = 0;
70 * Data rows (scrollable in heatmap view)
74 virtual unsigned dataRows() const = 0;
76 /* Label to be used in the vertical axis */
77 virtual QString dataLabel(unsigned row) const = 0;
79 /* Get identifier (program no) for row */
80 virtual qint64 dataRowAt(unsigned row) const = 0;
82 /* Get item at row and time */
83 virtual qint64 dataItemAt(unsigned row, qint64 time) const = 0;
85 /* Get iterator for a row between start and end time for steps */
86 virtual HeatmapRowIterator* dataRowIterator(int row, qint64 start, qint64 end, int steps) const = 0;
88 /* Handle double click on item */
89 virtual void itemDoubleClicked(qint64 index) const = 0;
91 /* Get mouse over tooltip for item */
92 virtual QString itemTooltip(qint64 index) const = 0;
94 /* Set the selection */
95 virtual void setSelectionState(SelectionState* state) = 0;
100 * A not very generic heatmap for row based data
102 class HeatmapView : public GraphView {
104 HeatmapView(QWidget* parent);
106 void setDataProvider(HeatmapDataProvider* data);
107 void setSelectionState(SelectionState* state);
109 virtual void mouseMoveEvent(QMouseEvent *e);
110 virtual void mouseDoubleClickEvent(QMouseEvent *e);
112 virtual void paintEvent(QPaintEvent *e);
113 virtual void paintRow(QPainter& painter, HeatmapRowIterator* itr);
117 qint64 itemAtPosition(QPoint pos);
121 HeatmapDataProvider* m_data;