1 #ifndef TIMELINEWIDGET_H
2 #define TIMELINEWIDGET_H
7 #include "trace_profiler.hpp"
9 class TimelineWidget : public QWidget
27 TimelineWidget(QWidget *parent = 0);
29 void setProfile(trace::Profile* profile);
31 void selectNone(bool notify = false);
32 void selectProgram(unsigned program, bool notify = false);
33 void selectTime(int64_t start, int64_t end, bool notify = false);
36 virtual void wheelEvent(QWheelEvent *e);
37 virtual void mousePressEvent(QMouseEvent *e);
38 virtual void mouseMoveEvent(QMouseEvent *e);
39 virtual void mouseReleaseEvent(QMouseEvent *e);
40 virtual void mouseDoubleClickEvent(QMouseEvent *e);
42 virtual void paintEvent(QPaintEvent *e);
43 virtual void resizeEvent(QResizeEvent *e);
46 void setHorizontalScrollValue(int value);
47 void setVerticalScrollValue(int value);
50 void verticalScrollMaxChanged(int max);
51 void verticalScrollValueChanged(int value);
53 void horizontalScrollMaxChanged(int max);
54 void horizontalScrollValueChanged(int value);
56 void jumpToCall(int call);
59 void selectedProgram(unsigned program);
60 void selectedTime(int64_t start, int64_t end);
63 void setRowScroll(int position, bool notify = true);
64 void setTimeScroll(int64_t time, bool notify = true);
66 bool drawCall(QPainter& painter, const trace::Profile::Call& call, int &lastX, int64_t &heat, bool gpu);
67 void drawHeat(QPainter& painter, int x, int64_t heat, bool gpu, bool selected);
69 double timeToPosition(int64_t time);
70 int64_t positionToTime(int pos);
74 const trace::Profile::Frame* frameAtTime(int64_t time);
75 const trace::Profile::Call* cpuCallAtTime(int64_t time);
76 const trace::Profile::Call* drawCallAtTime(int64_t time);
77 const trace::Profile::Call* drawCallAtTime(int64_t time, int program);
81 trace::Profile* m_profile;
82 std::vector<int> m_rowPrograms;
100 int64_t m_timeWidthMin;
101 int64_t m_timeWidthMax;
104 int m_selectionRight;
112 int64_t m_mousePressTime;
113 QPoint m_mousePosition;
114 QPoint m_mousePressPosition;
115 MousePressMode m_mousePressMode;
123 QPen m_axisForeground;
124 QBrush m_axisBackground;
126 QPen m_itemGpuForeground;
127 QBrush m_itemGpuBackground;
128 QPen m_itemCpuForeground;
129 QBrush m_itemCpuBackground;
130 QPen m_itemDeselectedForeground;
131 QBrush m_itemDeselectedBackground;
132 QPen m_selectionBorder;
133 QBrush m_selectionBackground;
135 QBrush m_zoomBackground;
148 #endif // TIMELINEWIDGET_H