Computer Assited Medical Intervention Tool Kit  version 4.1
MainWindow.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef MAINWINDOW_H
28 #define MAINWINDOW_H
29 
30 // -- Core stuff
31 #include "CamiTKAPI.h"
32 #include "ConsoleStream.h"
33 
34 // -- QT stuff
35 #include <QMainWindow>
36 #include <QApplication>
37 #include <QDir>
38 #include <QTextEdit>
39 #include <QProgressBar>
40 #include <QStatusBar>
41 
42 
43 namespace camitk {
44 
45 // -- Core stuff classes
46 class Component;
47 class Viewer;
48 
62 class CAMITK_API MainWindow : public QMainWindow {
63  Q_OBJECT
64 
65 public:
66 
69 
75  MainWindow(QString title);
76 
78  ~MainWindow() override;
79 
83  virtual void aboutToShow();
84 
86 
89 
91  QString getName() const;
92 
100  void setWindowSubtitle(QString);
101 
103  QProgressBar* getProgressBar();
104 
106  void showStatusBar(bool);
107 
109  virtual void redirectToConsole(bool);
110 
112  void showConsole(bool);
113 
115  bool getConsoleVisibility();
117 
120 
122  virtual void showViewer(Viewer*, bool);
123 
128  virtual void addDockViewer(Qt::DockWidgetArea, Viewer*);
129 
131  void refreshViewers();
132 
137  virtual void setCentralViewer(Viewer*);
138 
143  virtual const Viewer& getCentralViewer() const;
145 
146 public slots:
147 
149  virtual void refresh();
152 
154  void show();
156 
157 
158 protected:
159 
161  void closeEvent(QCloseEvent*) override;
162 
164  QList<Viewer*> viewers;
167 
169  QMap<Viewer*, QDockWidget*> dockWidgetMap;
170 
172  virtual void initSettings();
174 
176  void dragEnterEvent(QDragEnterEvent* event) override;
177 
179  void dragMoveEvent(QDragMoveEvent* event) override;
180 
182  void dragLeaveEvent(QDragLeaveEvent* event) override;
183 
185  void dropEvent(QDropEvent* event) override;
186 
193  bool removeViewer(Viewer* viewer);
194 
200 
201 
202 private:
203 
210  virtual bool addViewer(Viewer*);
212 
215 
218 
220  QProgressBar* myProgressBar;
221 
223  QDockWidget* consoleWindow;
224 
227 
229  QString mainTitle;
230 };
231 }
232 
233 
234 #endif // MAINWINDOW_H
Viewer is an abstract viewer.
Definition: Viewer.h:55
This Class is the base class for your application.
Definition: MainWindow.h:62
Definition: Action.cpp:36
QDockWidget * consoleWindow
console to display all messages
Definition: MainWindow.h:223
#define CAMITK_API
Definition: CamiTKAPI.h:49
QProgressBar * myProgressBar
the progress bar (access through setProgress() method)
Definition: MainWindow.h:220
Provides a console windows, within the CamiTK application.
Definition: ConsoleStream.h:71
Viewer * centralViewer
The actual central Viewer.
Definition: MainWindow.h:199
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
ConsoleStream cout
the output stream for the application console
Definition: MainWindow.h:214
QMap< Viewer *, QDockWidget * > dockWidgetMap
the map that gives the corresponding QDockWidget for a given Viewer
Definition: MainWindow.h:169
ConsoleStream cerr
the error stream for the application console
Definition: MainWindow.h:217
QString mainTitle
the main part of the title
Definition: MainWindow.h:229
QTextEdit * consoleWindowTextEdit
the QTextEdit part of the console dialog
Definition: MainWindow.h:226