Computer Assisted Medical Intervention Tool Kit  version 5.2
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-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
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 #include <QStackedLayout>
42 
43 namespace camitk {
44 
45 // -- Core stuff classes
46 class Component;
47 class Viewer;
48 
66 class CAMITK_API MainWindow : public QMainWindow {
67  Q_OBJECT
68 
69 public:
70 
73 
79  MainWindow(QString title);
80 
82  ~MainWindow() override;
83 
87  virtual void aboutToShow();
88 
90 
93 
95  QString getName() const;
96 
104  void setWindowSubtitle(QString);
105 
107  QProgressBar* getProgressBar();
108 
110  void showStatusBar(bool);
111 
113  virtual void redirectToConsole(bool);
114 
116  void showConsole(bool);
117 
119  bool getConsoleVisibility();
121 
125  virtual void initSettings();
126 
128  void saveSettings();
130 
133 
135 
143  CAMITK_API_DEPRECATED("This method is now called showDockViewer(..)") virtual void showViewer(Viewer*, bool);
145 
147  virtual void showDockViewer(Viewer*, bool);
148 
157  virtual void addDockViewer(Qt::DockWidgetArea, Viewer*);
158 
160  void refreshViewers();
161 
172  virtual void setCentralViewer(Viewer*);
173 
177  virtual Viewer* getCentralViewer() const;
178 
182  virtual void showViewerToolbar(Viewer* theViewer, bool visible);
184 
185 public slots:
186 
190  virtual void refresh();
191 
193  void show();
195 
196 
197 protected:
198 
200  void closeEvent(QCloseEvent*) override;
201 
206 
208  QMap<Viewer*, QDockWidget*> dockWidgetMap;
209 
211 
213  void dragEnterEvent(QDragEnterEvent* event) override;
214 
216  void dragMoveEvent(QDragMoveEvent* event) override;
217 
219  void dragLeaveEvent(QDragLeaveEvent* event) override;
220 
222  void dropEvent(QDropEvent* event) override;
223 
225 
238  CAMITK_API_DEPRECATED("Removing viewers can be harmful. Central viewer is now simply hidden, therefore there is no need to remove it.") bool removeViewer(Viewer* viewer);
240 
245  Viewer* centralViewer;
246 
247 
248 private:
249 
256  virtual bool addViewer(Viewer*);
257 
259  ConsoleStream cout;
260 
262  ConsoleStream cerr;
263 
265  QProgressBar* myProgressBar;
266 
268  QDockWidget* consoleWindow;
269 
271  QTextEdit* consoleWindowTextEdit;
272 
274  QString mainTitle;
275 
278  QStackedLayout* centralLayout;
279 
280 };
281 }
282 
283 
284 #endif // MAINWINDOW_H
#define CAMITK_API_DEPRECATED(X)
Definition: CamiTKAPI.h:94
#define CAMITK_API
Definition: CamiTKAPI.h:49
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
Provides a console windows, within the CamiTK application.
Definition: ConsoleStream.h:71
This class is the base class for your application.
Definition: MainWindow.h:66
QList< Viewer * > viewers
Definition: MainWindow.h:205
QMap< Viewer *, QDockWidget * > dockWidgetMap
the map that gives the corresponding QDockWidget for a given Viewer
Definition: MainWindow.h:208
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:181
Definition: Action.cpp:36
void refresh()
refresh the display