Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerApplication.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerApplication_h
22 #define __qSlicerApplication_h
23 
24 // Qt includes
25 class QPalette;
26 
27 // CTK includes
28 #include <ctkErrorLogModel.h>
29 #include <ctkPimpl.h>
30 #include <ctkSettingsDialog.h>
31 
32 // QTCORE includes
33 #include "qSlicerCoreApplication.h"
34 
35 // QTGUI includes
36 #include "qSlicerBaseQTGUIExport.h"
37 
38 class QMainWindow;
39 class qSlicerApplicationPrivate;
41 class qSlicerIOManager;
42 #ifdef Slicer_USE_PYTHONQT
44 #endif
46 class qSlicerWidget;
47 
48 class ctkErrorLogModel;
49 #ifdef Slicer_USE_QtTesting
50 class ctkQtTestingUtility;
51 #endif
52 
53 #ifdef Slicer_BUILD_DICOM_SUPPORT
54 class ctkDICOMBrowser;
55 #endif
56 
57 // MRML includes
58 class vtkMRMLNode;
59 
60 class Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplication : public qSlicerCoreApplication
61 {
62  Q_OBJECT
63 public:
64 
66  qSlicerApplication(int &argc, char **argv);
67  ~qSlicerApplication() override;
68 
71 
83  bool notify(QObject * receiver, QEvent * event) override;
84 
86  Q_INVOKABLE qSlicerCommandOptions* commandOptions()const;
87 
89  Q_INVOKABLE qSlicerIOManager* ioManager();
90 
91 #ifdef Slicer_USE_PYTHONQT
92  Q_INVOKABLE qSlicerPythonManager * pythonManager();
94  Q_INVOKABLE ctkPythonConsole * pythonConsole();
96  Q_INVOKABLE ctkErrorLogLevel::LogLevel pythonConsoleLogLevel()const;
97 #endif
98 
99  #ifdef Slicer_USE_QtTesting
100  Q_INVOKABLE ctkQtTestingUtility* testingUtility();
102  #endif
103 
105  Q_INVOKABLE qSlicerLayoutManager* layoutManager()const;
106  Q_INVOKABLE void setLayoutManager(qSlicerLayoutManager* layoutManager);
107 
109  QMainWindow* mainWindow()const;
110 
114  //virtual void commitData(QSessionManager & manager);
115 
117  void setToolTipsEnabled(bool enable);
118 
124  QString nodeModule(vtkMRMLNode* node, double *confidence=nullptr)const;
125 
126  Q_INVOKABLE ctkSettingsDialog* settingsDialog()const;
127  Q_INVOKABLE void openSettingsDialog(const QString& settingsPanel=QString());
128 
145  Q_INVOKABLE virtual void logApplicationInformation() const;
146 
147 #ifdef Slicer_BUILD_DICOM_SUPPORT
148  Q_INVOKABLE ctkDICOMBrowser* createDICOMBrowserForMainDatabase();
151 #endif
152 
153 #ifdef Q_OS_WIN32
154  Q_INVOKABLE static unsigned long int windowsOSBuildNumber();
156 
158  Q_INVOKABLE static unsigned int windowsActiveCodePage();
159 #endif
160 
163  Q_INVOKABLE static bool isCodePageUtf8();
164 
165 public slots:
166 
172  void openNodeModule(vtkMRMLNode* node, QString role=QString(), QString context=QString());
173 
176  void confirmRestart(QString reason = QString());
177 
180  bool launchDesigner(const QStringList& args = QStringList());
181 
182 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT
183  void openExtensionsManagerDialog();
185 
187  void openExtensionsCatalogWebsite();
188 #endif
189 
190 #ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT
191  void openApplicationDownloadWebsite();
193 #endif
194 
196  int numberOfRecentLogFilesToKeep();
197 
199  QStringList recentLogFiles();
200 
203  QString currentLogFile()const;
204 
211  void setHasBorderInFullScreen(bool);
212 
218  void setRenderPaused(bool pause) override;
219 
222  void pauseRender() override;
223 
226  void resumeRender() override;
227 
229  bool loadFiles(const QStringList& filePaths, vtkMRMLMessageCollection* userMessages = nullptr) override;
230 
231 #ifdef Slicer_USE_PYTHONQT
232  void setPythonConsoleLogLevel(ctkErrorLogLevel::LogLevel logLevel);
234 #endif
235 
236 signals:
237 
247  void startupCompleted();
248 
253  void renderPaused(bool);
254 
255 protected slots:
256 
258  void editNode(vtkObject*, void*, unsigned long) override;
259 
260 #ifdef Slicer_USE_PYTHONQT
261  void logToPythonConsole(const QDateTime& currentDateTime, const QString& threadId,
263  ctkErrorLogLevel::LogLevel logLevel, const QString& origin, const ctkErrorLogContext& context, const QString& text);
264 #endif
265 
266 protected:
269  void handleCommandLineArguments() override;
270  void onSlicerApplicationLogicModified() override;
271 
274  void setupFileLogging();
275 
276 private:
277  Q_DECLARE_PRIVATE(qSlicerApplication);
278  Q_DISABLE_COPY(qSlicerApplication);
279 };
280 
284 void Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplyPalette(QPalette& palette);
285 
286 #endif
virtual void onSlicerApplicationLogicModified()
virtual bool loadFiles(const QStringList &filePaths, vtkMRMLMessageCollection *userMessages=nullptr)
static qSlicerCoreApplication * application()
void Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplyPalette(QPalette &palette)
qSlicerCoreApplication Superclass
virtual void handleCommandLineArguments()
virtual void setRenderPaused(bool pause)
virtual void editNode(vtkObject *, void *, unsigned long)
virtual void handlePreApplicationCommandLineArguments()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167