1 #ifndef CPPROFILER_EXECUTION_WINDOW 2 #define CPPROFILER_EXECUTION_WINDOW 3 4 #include <memory> 5 #include <QMainWindow> 6 #include <QSlider> 7 8 #include "tree/node_id.hh" 9 #include "core.hh" 10 11 namespace cpprofiler 12 { 13 14 namespace utils 15 { 16 class MaybeCaller; 17 } 18 19 namespace tree 20 { 21 class TraditionalView; 22 } 23 24 namespace pixel_view 25 { 26 class PtCanvas; 27 class IcicleCanvas; 28 } // namespace pixel_view 29 30 class Execution; 31 32 class LanternMenu : public QWidget 33 { 34 Q_OBJECT 35 36 private: 37 QSlider *slider_; 38 39 public: 40 LanternMenu(); 41 42 /// Get slider value value()43 int value() { return slider_->value(); } 44 45 /// Set maximum value of the slider setMax(int v)46 void setMax(int v) { slider_->setMaximum(v); } 47 48 signals: 49 /// indicates that max size for a lantern node changed 50 void limit_changed(int val); 51 }; 52 53 class ExecutionWindow : public QMainWindow 54 { 55 Q_OBJECT 56 57 Execution &execution_; 58 std::unique_ptr<tree::TraditionalView> traditional_view_; 59 60 std::unique_ptr<pixel_view::PtCanvas> pixel_tree_; 61 62 std::unique_ptr<pixel_view::IcicleCanvas> icicle_tree_; 63 64 std::unique_ptr<utils::MaybeCaller> maybe_caller_; 65 66 /// Dockable widget for the pixel tree 67 QDockWidget *pt_dock_ = nullptr; 68 69 /// Dockable widget for the icicle tree 70 QDockWidget *it_dock_ = nullptr; 71 72 /// Settings widget for lantern tree 73 LanternMenu *lantern_widget = nullptr; 74 75 public: 76 tree::TraditionalView &traditional_view(); 77 78 /// Show a window with all bookmarks 79 void showBookmarks() const; 80 81 ExecutionWindow(Execution &ex, QWidget* parent = nullptr); 82 ~ExecutionWindow(); 83 execution()84 Execution& execution() 85 { 86 return execution_; 87 } 88 89 public slots: 90 91 /// Remove currently selected node; then select its parent 92 void removeSelectedNode(); 93 94 void print_log(const std::string &str); 95 96 /// Create and display pixel tree as a dockable widget 97 void showPixelTree(); 98 99 /// Create and display icicle tree as a dockable widget 100 void showIcicleTree(); 101 102 /// Toggle the tree lantern tree version of the visualisation 103 void toggleLanternView(bool checked); 104 105 signals: 106 107 void needToSaveSearch(Execution *e); 108 109 void nodeSelected(NodeID n); 110 111 void nogoodsClicked(std::vector<NodeID>); 112 }; 113 114 } // namespace cpprofiler 115 116 #endif