X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fgraphwidget.h;h=7ab17c65490001a59ce7ecb73427a54c8c91b0b5;hb=b70a86af10057c5b7fcf79b674cfe5abbeaadebb;hp=266f6945a3ca6d3fb64e0bce1231abbb9fc79940;hpb=56ea30956b10d22fc78d120f5506f352cfecd3cd;p=apitrace diff --git a/gui/graphwidget.h b/gui/graphwidget.h index 266f694..7ab17c6 100644 --- a/gui/graphwidget.h +++ b/gui/graphwidget.h @@ -12,6 +12,12 @@ enum GraphType { GraphCpu }; +enum SelectType { + SelectNone, + SelectTime, + SelectProgram +}; + class GraphWidget : public QWidget { Q_OBJECT @@ -22,18 +28,28 @@ public: void setProfile(trace::Profile* profile, GraphType type); const trace::Profile::Call* callAtPosition(const QPoint& pos); + void selectNone(bool notify = false); + void selectTime(int64_t start, int64_t end, bool notify = false); + void selectProgram(unsigned program, bool notify = false); + protected: - virtual void mousePressEvent(QMouseEvent *e); virtual void paintEvent(QPaintEvent *e); - virtual void mouseMoveEvent(QMouseEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); virtual void mouseDoubleClickEvent(QMouseEvent *e); - virtual void resizeEvent(QResizeEvent *e); signals: void jumpToCall(int no); void viewChanged(int call, int width); + void selectedNone(); + void selectedProgram(unsigned program); + void selectedTime(int64_t start, int64_t end); + public slots: void changeView(int call, int width); @@ -44,34 +60,46 @@ private: void paintHorizontalAxis(QPainter& painter); private: + /* Data */ trace::Profile* m_profile; GraphType m_type; - int64_t m_maxTime; - - int m_minCall; - int m_maxCall; - - int m_minCallWidth; - int m_maxCallWidth; + /* Vertical Axis */ + int64_t m_timeMax; + /* Horizontal axis */ int m_call; + int m_callMin; + int m_callMax; int m_callWidth; + int m_callWidthMin; + int m_callWidthMax; - QPoint m_mousePressPosition; + /* Viewport */ + int m_graphWidth; + int m_graphHeight; + + /* Mouse track data */ int m_mousePressCall; + QPoint m_mousePressPosition; + /* Style */ int m_axisWidth; int m_axisHeight; - - int m_graphWidth; - int m_graphHeight; - QPen m_axisForeground; QBrush m_axisBackground; - QLinearGradient m_graphGradientGpu; QLinearGradient m_graphGradientCpu; + QLinearGradient m_graphGradientDeselected; + + struct { + SelectType type; + + unsigned program; + + int64_t timeStart; + int64_t timeEnd; + } m_selection; }; #endif // GRAPHWIDGET_H