Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
25class QPalette;
26
27// CTK includes
28#include <ctkErrorLogModel.h>
29#include <ctkPimpl.h>
30#include <ctkSettingsDialog.h>
31
32// QTCORE includes
34
35// QTGUI includes
36#include "qSlicerBaseQTGUIExport.h"
37
38class QMainWindow;
39class qSlicerApplicationPrivate;
42#ifdef Slicer_USE_PYTHONQT
44#endif
46class qSlicerWidget;
47
48class ctkErrorLogModel;
49#ifdef Slicer_USE_QtTesting
50class ctkQtTestingUtility;
51#endif
52
53#ifdef Slicer_BUILD_DICOM_SUPPORT
54class ctkDICOMBrowser;
55#endif
56
57// MRML includes
58class vtkMRMLNode;
59
60class Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplication : public qSlicerCoreApplication
61{
62 Q_OBJECT
63public:
64
66 qSlicerApplication(int &argc, char **argv);
68
71
83 bool notify(QObject * receiver, QEvent * event) override;
84
87
90
91#ifdef Slicer_USE_PYTHONQT
93 Q_INVOKABLE qSlicerPythonManager * pythonManager();
94 Q_INVOKABLE ctkPythonConsole * pythonConsole();
96 Q_INVOKABLE ctkErrorLogLevel::LogLevel pythonConsoleLogLevel()const;
97#endif
98
99 #ifdef Slicer_USE_QtTesting
101 Q_INVOKABLE ctkQtTestingUtility* testingUtility();
102 #endif
103
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
150 Q_INVOKABLE ctkDICOMBrowser* createDICOMBrowserForMainDatabase();
151#endif
152
153#ifdef Q_OS_WIN32
155 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
165public 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
184 void openExtensionsManagerDialog();
185
187 void openExtensionsCatalogWebsite();
188#endif
189
190#ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT
192 void openApplicationDownloadWebsite();
193#endif
194
197
199 QStringList recentLogFiles();
200
203 QString currentLogFile()const;
204
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
233 void setPythonConsoleLogLevel(ctkErrorLogLevel::LogLevel logLevel);
234#endif
235
236signals:
237
248
253 void renderPaused(bool);
254
255protected slots:
256
258 void editNode(vtkObject*, void*, unsigned long) override;
259
260#ifdef Slicer_USE_PYTHONQT
262 void logToPythonConsole(const QDateTime& currentDateTime, const QString& threadId,
263 ctkErrorLogLevel::LogLevel logLevel, const QString& origin, const ctkErrorLogContext& context, const QString& text);
264#endif
265
266protected:
271
275
276private:
277 Q_DECLARE_PRIVATE(qSlicerApplication);
278 Q_DISABLE_COPY(qSlicerApplication);
279};
280
284void Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplyPalette(QPalette& palette);
285
286#endif
void pauseRender() override
void setHasBorderInFullScreen(bool)
QStringList recentLogFiles()
Paths of recent log files.
void editNode(vtkObject *, void *, unsigned long) override
Request editing of a MRML node.
QString currentLogFile() const
static Q_INVOKABLE bool isCodePageUtf8()
static qSlicerApplication * application()
Return a reference to the application singleton.
Q_INVOKABLE qSlicerCommandOptions * commandOptions() const
Get commandOptions.
Q_INVOKABLE qSlicerIOManager * ioManager()
Get IO Manager.
void confirmRestart(QString reason=QString())
QString nodeModule(vtkMRMLNode *node, double *confidence=nullptr) const
int numberOfRecentLogFilesToKeep()
Number of recent log files to keep. Older log files are deleted automatically.
bool notify(QObject *receiver, QEvent *event) override
Q_INVOKABLE ctkSettingsDialog * settingsDialog() const
qSlicerCoreApplication Superclass
void handlePreApplicationCommandLineArguments() override
Reimplemented from qSlicerCoreApplication.
void renderPaused(bool)
qSlicerApplication(int &argc, char **argv)
void handleCommandLineArguments() override
void setRenderPaused(bool pause) override
virtual Q_INVOKABLE void logApplicationInformation() const
void resumeRender() override
Q_INVOKABLE void setLayoutManager(qSlicerLayoutManager *layoutManager)
void setToolTipsEnabled(bool enable)
Enable/Disable tooltips.
Q_INVOKABLE qSlicerLayoutManager * layoutManager() const
Set/Get layout manager.
Q_INVOKABLE void openSettingsDialog(const QString &settingsPanel=QString())
void onSlicerApplicationLogicModified() override
QMainWindow * mainWindow() const
Return a pointer on the main window of the application if any.
bool loadFiles(const QStringList &filePaths, vtkMRMLMessageCollection *userMessages=nullptr) override
Override the qSlicerCoreApplication implementation to also show error messages in a popup window.
~qSlicerApplication() override
void openNodeModule(vtkMRMLNode *node, QString role=QString(), QString context=QString())
bool launchDesigner(const QStringList &args=QStringList())
qSlicerCoreApplication(int &argc, char **argv)
Abstract Superclass for all specific types of MRML nodes.
void Q_SLICER_BASE_QTGUI_EXPORT qSlicerApplyPalette(QPalette &palette)