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
graph_analysis::gui::GraphWidgetManager::tabChanged
void tabChanged(int index)
Definition: GraphWidgetManager.hpp:94
graph_analysis::gui::GraphWidgetManager::refresh
void refresh()
triggers a refresh() in the currently displayed graph widget
Definition: GraphWidgetManager.cpp:192
graph_analysis::gui::GraphWidgetManager::shuffle
void shuffle()
triggers shuffle() in the currently displayed graph widget
Definition: GraphWidgetManager.cpp:198
graph_analysis::gui::GraphWidgetManager::helpSetup
void helpSetup(std::stringstream &ss, const std::string &cmd=std::string("program"))
prints verbose help message regarding usage of 'cmd' to string stream 'ss'
Definition: GraphWidgetManager.cpp:98
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::BaseGraph::Ptr
shared_ptr< BaseGraph > Ptr
Definition: BaseGraph.hpp:34
graph_analysis::gui::GraphWidgetManager::addGraphWidget
void addGraphWidget(GraphWidget *graphWidget)
Definition: GraphWidgetManager.cpp:204
graph_analysis::gui::GraphWidgetManager::EDIT_MODE
@ EDIT_MODE
Definition: GraphWidgetManager.hpp:44
graph_analysis::gui::GraphWidgetManager
The GraphWidgetManager loads and connect all main graph widget components.
Definition: GraphWidgetManager.hpp:40
graph_analysis::gui::GraphWidgetManager::resetGraph
void resetGraph(bool keepData=false)
Definition: GraphWidgetManager.cpp:210
graph_analysis::gui::GraphWidgetManager::notifyAll
void notifyAll()
Definition: GraphWidgetManager.cpp:253
graph_analysis::gui::GraphWidgetManager::MOVE_MODE
@ MOVE_MODE
Definition: GraphWidgetManager.hpp:44
graph_analysis::gui::GraphWidgetManager::exportGraph
void exportGraph()
Definition: GraphWidgetManager.cpp:241
graph_analysis::gui::GraphWidgetManager::notifyModeChange
void notifyModeChange(Mode mode)
graph_analysis::gui::GraphWidgetManager::GraphWidgetManager
GraphWidgetManager()
Definition: GraphWidgetManager.cpp:31
graph_analysis::gui::GraphWidgetManager::Mode
Mode
Definition: GraphWidgetManager.hpp:44
graph_analysis::gui::GraphWidgetManager::updateStatus
void updateStatus(const std::string &message, int timeout=0)
setter method for updating the temporary text (i.e. for another 'timeout' miliseconds) currently bein...
Definition: GraphWidgetManager.hpp:63
graph_analysis::gui::GraphWidgetManager::~GraphWidgetManager
~GraphWidgetManager()
destructor - frees the main window (which recursively frees all other Qt components)
Definition: GraphWidgetManager.cpp:92
graph_analysis::gui::GraphWidgetManager::updateStatus
void updateStatus(const char *message, int timeout=0)
Definition: GraphWidgetManager.hpp:57
graph_analysis::gui::GraphWidgetManager::importGraph
void importGraph()
Definition: GraphWidgetManager.cpp:227
graph_analysis::gui::GraphWidgetManager::TIMEOUT
static const int TIMEOUT
StatusBar standard timeout (in ms)
Definition: GraphWidgetManager.hpp:47
graph_analysis::gui::GraphWidgetManager::CONNECT_MODE
@ CONNECT_MODE
Definition: GraphWidgetManager.hpp:44
graph_analysis::gui::GraphWidgetManager::updateStatus
void updateStatus(const QString &message, int timeout=0)
setter method for updating the temporary text (i.e. for another 'timeout' miliseconds) currently bein...
Definition: GraphWidgetManager.hpp:69
graph_analysis::gui::GraphWidget
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
graph_analysis::gui::GraphWidgetManager::mpGraph
graph_analysis::BaseGraph::Ptr mpGraph
conceptual underlying graph
Definition: GraphWidgetManager.hpp:99