graph_analysis
GraphWidgetManager.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_GUI_GRAPH_WIDGET_MANAGER_HPP
2 #define GRAPH_ANALYSIS_GUI_GRAPH_WIDGET_MANAGER_HPP
3 
4 #include <string>
5 #include <sstream>
6 #include <QObject>
7 #include <QString>
8 #include <QStatusBar>
9 #include <QDockWidget>
10 #include <QMainWindow>
11 #include <QTabWidget>
12 #include "../GraphIO.hpp"
13 
14 namespace graph_analysis {
15 namespace gui {
16 
17 class GraphWidget;
18 
40 class GraphWidgetManager : public QObject
41 {
42  Q_OBJECT
43 public:
45 
47  static const int TIMEOUT;
48 
50 
53 
55  void helpSetup(std::stringstream& ss, const std::string& cmd = std::string("program"));
56 
57  void updateStatus(const char* message, int timeout = 0)
58  {
59  mpStatus->showMessage(QString(message), timeout);
60  }
61 
63  void updateStatus(const std::string& message, int timeout = 0)
64  {
65  mpStatus->showMessage(QString(message.c_str()), timeout);
66  }
67 
69  void updateStatus(const QString& message, int timeout = 0)
70  {
71  mpStatus->showMessage(message, timeout);
72  }
73 
74 public slots:
80  void refresh();
82  void shuffle();
83 
84  void addGraphWidget(GraphWidget* graphWidget);
85 
86  void resetGraph(bool keepData = false);
87 
88  void importGraph();
89  void exportGraph();
90 
94  void tabChanged(int index) { refresh(); }
95 
96 
97 protected:
100 
101  void notifyModeChange(Mode mode);
102  void notifyAll();
103 
104 private:
106  QMainWindow *mpMainWindow;
111  QTabWidget* mpTabWidget;
113  QStatusBar* mpStatus;
115  QString mLayout;
116 
117  GraphWidget* currentGraphWidget();
118 
120  Mode mMode;
121 };
122 
123 } // end namespace gui
124 } // end namespace graph_analysis
125 
126 #endif // GRAPH_ANALYSIS_GUI_GRAPH_WIDGET_MANAGER_HPP
void helpSetup(std::stringstream &ss, const std::string &cmd=std::string("program"))
prints verbose help message regarding usage of &#39;cmd&#39; to string stream &#39;ss&#39;
Definition: GraphWidgetManager.cpp:98
Definition: GraphWidgetManager.hpp:44
void updateStatus(const std::string &message, int timeout=0)
setter method for updating the temporary text (i.e. for another &#39;timeout&#39; miliseconds) currently bein...
Definition: GraphWidgetManager.hpp:63
void notifyAll()
Definition: GraphWidgetManager.cpp:253
void tabChanged(int index)
Definition: GraphWidgetManager.hpp:94
~GraphWidgetManager()
destructor - frees the main window (which recursively frees all other Qt components) ...
Definition: GraphWidgetManager.cpp:92
void resetGraph(bool keepData=false)
Definition: GraphWidgetManager.cpp:210
void refresh()
triggers a refresh() in the currently displayed graph widget
Definition: GraphWidgetManager.cpp:192
GraphWidgetManager()
Definition: GraphWidgetManager.cpp:31
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
Definition: GraphWidgetManager.hpp:44
Definition: GraphWidgetManager.hpp:44
void updateStatus(const char *message, int timeout=0)
Definition: GraphWidgetManager.hpp:57
Mode
Definition: GraphWidgetManager.hpp:44
static const int TIMEOUT
StatusBar standard timeout (in ms)
Definition: GraphWidgetManager.hpp:47
shared_ptr< BaseGraph > Ptr
Definition: BaseGraph.hpp:34
graph_analysis::BaseGraph::Ptr mpGraph
conceptual underlying graph
Definition: GraphWidgetManager.hpp:99
void addGraphWidget(GraphWidget *graphWidget)
Definition: GraphWidgetManager.cpp:204
The GraphWidgetManager loads and connect all main graph widget components.
Definition: GraphWidgetManager.hpp:40
void shuffle()
triggers shuffle() in the currently displayed graph widget
Definition: GraphWidgetManager.cpp:198
void updateStatus(const QString &message, int timeout=0)
setter method for updating the temporary text (i.e. for another &#39;timeout&#39; miliseconds) currently bein...
Definition: GraphWidgetManager.hpp:69
void exportGraph()
Definition: GraphWidgetManager.cpp:241
void importGraph()
Definition: GraphWidgetManager.cpp:227