ImGraph
 All Classes Functions Variables Enumerations Pages
Window.h
1 #ifndef _WINDOWS_IMGRAPH_HEADER_
2 #define _WINDOWS_IMGRAPH_HEADER_
3 
4 #ifdef _WIN32
5 #pragma warning(push)
6 #pragma warning(disable:4996 4244 4251 4275 4800 4503)
7 #endif
8 #include <QGraphicsView>
9 #include <QResizeEvent>
10 #include <QPainter>
11 #include <QRect>
12 #include <QString>
13 #include <QDialog>
14 #include <QStatusBar>
15 #include <QLabel>
16 #include <QWidget>
17 #include <QLayout>
18 #include <QMainWindow>
19 #include <QComboBox>
20 #include <QDial>
21 #include <QPainterPath>
22 #include <QTreeWidget>
23 
24 #ifdef _WIN32
25 #pragma warning(pop)
26 #endif
27 
28 #include <map>
29 
30 namespace charliesoft
31 {
32  class GraphLayout;
33  class MainWidget;
34  class GlobalConfig;
35  class VertexRepresentation;
36  class GroupParamRepresentation;
37 
38 
39  class DraggableContainer : public QTreeWidget
40  {
41  public:
42  DraggableContainer() :QTreeWidget(){};
43  protected:
44  virtual void mousePressEvent(QMouseEvent *);
45  };
46 
47  class Window : public QMainWindow
48  {
49  Q_OBJECT;
50 
51  protected:
52  QVector<QAction*> vect_QActions;
53  QToolBar* _toolbar;
54 
55  bool eventFilter(QObject *obj, QEvent *event);
56 
57  void createToolbar(QToolBar* toolBar);
58  public:
59  static Window* getInstance();
60  static void releaseInstance();
61  static void synchroMainGraph();
62 
63  void show();
64  void addTab(MainWidget* tmp, QString tabName);
65 
66  void setStatusMessage(QString msg){
67  statusBar()->showMessage(msg);
68  };
69 
70  MainWidget* getMainWidget() const;
71  std::string getKey(QTreeWidgetItem* w) {
72  try{ return keysName_.at(w); }
73  catch (std::out_of_range){ return ""; };
74  };
75 
76  void redraw();
77 
78  bool event(QEvent *event);
79 
80  bool consumeEvent(QEvent *event);
81 
82  void showListAlgoDock(bool listOfAlgo);
83 
84  GroupParamRepresentation* getParamDock();
85  private:
86  static Window* ptr;
87 
88  Window();
89  ~Window();
90 
91  QMenu *menuFile;
92  QMenu *menuEdit;
93  QMenu *menuAide;
94  QTabWidget* _tabWidget;
95  QTabBar* _listOfDock;
96 
97  QDockWidget * _dock;
98  QDockWidget * _property_dock;
99  DraggableContainer * _dock_content;
100  std::vector<QTreeWidgetItem *> dock_categories;
101  std::map<QTreeWidgetItem*, std::string> keysName_;
102 
103  void fillDock(int idDock);
104 
105  void closeEvent(QCloseEvent *event);
106 
107  private slots:
108  void openFile();
109  void newProject();
110  void saveProject();
111  void startGraph();
112  void stopGraph();
113  void switchPause();
114  void saveAsProject();
115  void createSubgraph();
116  bool quitProg();
117  void printHelp();
118 
119  void updatePropertyDock(GroupParamRepresentation*);
120 
121  void closeTab_(int index)
122  {
123  // Delete the page widget, which automatically removes
124  // the tab as well.
125  delete _tabWidget->widget(index);
126  }
127 
128  };
129 }
130 
131 
132 #endif
Definition: Window.h:47
Definition: VertexRepresentation.h:79
Definition: Window.h:39
Definition: GraphicView.h:84