21 #ifndef __qSlicerCoreApplication_h 22 #define __qSlicerCoreApplication_h 25 #include <QApplication> 27 #include <QProcessEnvironment> 28 #include <QStringList> 32 #include <ctkVTKObject.h> 35 #include "vtkSlicerConfigure.h" 36 #include "qSlicerBaseQTCoreExport.h" 38 #ifdef Slicer_BUILD_DICOM_SUPPORT 39 class ctkDICOMDatabase;
41 class ctkErrorLogAbstractModel;
45 class qSlicerCoreApplicationPrivate;
47 #ifdef Slicer_USE_PYTHONQT 49 class ctkPythonConsole;
51 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 68 Q_PROPERTY(QString slicerHome READ slicerHome CONSTANT)
72 Q_PROPERTY(QString defaultScenePath READ defaultScenePath WRITE setDefaultScenePath)
73 Q_PROPERTY(QString slicerSharePath READ slicerSharePath CONSTANT)
74 Q_PROPERTY(QString temporaryPath READ temporaryPath WRITE setTemporaryPath)
75 Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath)
76 Q_PROPERTY(QString launcherExecutableFilePath READ launcherExecutableFilePath CONSTANT)
77 Q_PROPERTY(QString launcherSettingsFilePath READ launcherSettingsFilePath CONSTANT)
78 Q_PROPERTY(QString slicerDefaultSettingsFilePath READ slicerDefaultSettingsFilePath CONSTANT)
79 Q_PROPERTY(QString slicerUserSettingsFilePath READ slicerUserSettingsFilePath CONSTANT)
80 Q_PROPERTY(QString slicerRevisionUserSettingsFilePath READ slicerRevisionUserSettingsFilePath CONSTANT)
81 Q_PROPERTY(QString extensionsInstallPath READ extensionsInstallPath WRITE setExtensionsInstallPath)
82 Q_PROPERTY(QString intDir READ intDir CONSTANT)
83 Q_PROPERTY(
bool isInstalled READ isInstalled CONSTANT)
84 Q_PROPERTY(QString releaseType READ releaseType CONSTANT)
85 Q_PROPERTY(QString repositoryUrl READ repositoryUrl CONSTANT)
86 Q_PROPERTY(QString repositoryBranch READ repositoryBranch CONSTANT)
87 Q_PROPERTY(QString repositoryRevision READ repositoryRevision CONSTANT)
88 Q_PROPERTY(QString revision READ revision CONSTANT)
89 Q_PROPERTY(
int majorVersion READ majorVersion CONSTANT)
90 Q_PROPERTY(
int minorVersion READ minorVersion CONSTANT)
91 Q_PROPERTY(QString platform READ platform CONSTANT)
92 Q_PROPERTY(QString arch READ arch CONSTANT)
93 Q_PROPERTY(QString os READ os CONSTANT)
94 Q_PROPERTY(
bool isCustomMainApplication READ isCustomMainApplication CONSTANT)
95 Q_PROPERTY(QString mainApplicationName READ mainApplicationName CONSTANT)
96 Q_PROPERTY(QString mainApplicationRepositoryUrl READ mainApplicationRepositoryUrl CONSTANT)
97 Q_PROPERTY(QString mainApplicationRepositoryRevision READ mainApplicationRepositoryRevision CONSTANT)
98 Q_PROPERTY(QString mainApplicationRevision READ mainApplicationRevision CONSTANT)
99 Q_PROPERTY(
int mainApplicationMajorVersion READ mainApplicationMajorVersion CONSTANT)
100 Q_PROPERTY(
int mainApplicationMinorVersion READ mainApplicationMinorVersion CONSTANT)
101 Q_PROPERTY(
int mainApplicationPatchVersion READ mainApplicationPatchVersion CONSTANT)
118 AA_DisablePython = 1000,
144 Q_INVOKABLE QProcessEnvironment startupEnvironment()
const;
156 Q_INVOKABLE QProcessEnvironment environment()
const;
162 Q_INVOKABLE
void setEnvironmentVariable(
const QString& key,
const QString& value);
165 Q_INVOKABLE
bool isEnvironmentVariableValueSet(
const QString& key,
const QString& value);
169 Q_INVOKABLE
void prependEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
173 Q_INVOKABLE
void appendEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
177 void parseArguments(
bool& exitWhenDone);
180 ExitNotRequested = -1,
181 ExitSuccess = EXIT_SUCCESS,
182 ExitFailure = EXIT_FAILURE
198 int returnCode()
const;
224 QString slicerHome()
const;
230 QString defaultScenePath()
const;
233 void setDefaultScenePath(
const QString& path);
241 QString slicerSharePath()
const;
245 bool isEmbeddedModule(
const QString& moduleFileName)
const;
248 QString defaultTemporaryPath()
const;
251 QString temporaryPath()
const;
254 void setTemporaryPath(
const QString& path);
258 QString defaultCachePath()
const;
263 QString cachePath()
const;
267 void setCachePath(
const QString& path);
270 QString launcherExecutableFilePath()
const;
273 QString launcherSettingsFilePath()
const;
276 QString launcherRevisionSpecificUserSettingsFilePath()
const;
280 QString slicerDefaultSettingsFilePath()
const;
284 QString slicerUserSettingsFilePath()
const;
288 QString slicerRevisionUserSettingsFilePath()
const;
291 QString defaultExtensionsInstallPath()
const;
294 QString extensionsInstallPath()
const;
297 void setExtensionsInstallPath(
const QString& path);
299 void gatherExtensionsHistoryInformationOnStartup();
303 QString intDir()
const;
306 bool isInstalled()
const;
311 QString releaseType()
const;
317 Q_INVOKABLE
void addModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
320 Q_INVOKABLE
void removeModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
323 Q_INVOKABLE QStringList modulesAssociatedWithNodeType(
const QString& nodeClassName)
const;
326 Q_INVOKABLE QStringList allModuleAssociatedNodeTypes()
const;
328 #ifdef Slicer_USE_PYTHONQT 337 ctkPythonConsole* pythonConsole()
const;
343 void setPythonConsole(ctkPythonConsole* pythonConsole);
347 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 357 Q_INVOKABLE ctkErrorLogAbstractModel* errorLogModel()
const;
378 Q_INVOKABLE QSettings* defaultSettings()
const;
383 Q_INVOKABLE QSettings* userSettings()
const;
388 Q_INVOKABLE QSettings* settings()
const;
393 Q_INVOKABLE QSettings* revisionUserSettings()
const;
396 bool isCustomMainApplication()
const;
399 QString mainApplicationName()
const;
404 QString mainApplicationRepositoryUrl()
const;
409 QString mainApplicationRepositoryRevision()
const;
413 QString mainApplicationRevision()
const;
417 int mainApplicationMajorVersion()
const;
421 int mainApplicationMinorVersion()
const;
425 int mainApplicationPatchVersion()
const;
428 virtual QString copyrights()
const;
431 virtual QString acknowledgment()
const;
434 virtual QString libraries()
const;
438 QString repositoryUrl()
const;
442 QString repositoryBranch()
const;
446 QString repositoryRevision()
const;
449 QString revision()
const;
452 int majorVersion()
const;
455 int minorVersion()
const;
459 QString platform()
const;
469 #ifdef Slicer_BUILD_DICOM_SUPPORT 470 Q_INVOKABLE ctkDICOMDatabase* dicomDatabase()
const;
475 QSharedPointer<ctkDICOMDatabase> dicomDatabaseShared()
const;
478 static void loadTranslations(
const QString& dir);
480 static void loadLanguage();
486 static bool loadCaCertificates(
const QString& slicerHome);
488 Q_INVOKABLE
int registerResource(
const QByteArray& data);
492 Q_INVOKABLE
void showConsoleMessage(QString message,
bool error=
true)
const;
496 Q_INVOKABLE QString toSlicerHomeAbsolutePath(
const QString& path)
const;
500 Q_INVOKABLE QString toSlicerHomeRelativePath(
const QString& path)
const;
504 Q_INVOKABLE QStringList toSlicerHomeAbsolutePaths(
const QStringList& path)
const;
508 Q_INVOKABLE QStringList toSlicerHomeRelativePaths(
const QStringList& path)
const;
514 static void restart();
516 bool unregisterResource(
int handle);
537 virtual void handlePreApplicationCommandLineArguments();
548 virtual void handleCommandLineArguments();
550 virtual void onSlicerApplicationLogicModified();
551 virtual void onUserInformationModified();
552 void onSlicerApplicationLogicRequest(vtkObject*,
void* ,
unsigned long);
553 void processAppLogicModified();
554 void processAppLogicReadData();
555 void processAppLogicWriteData();
559 virtual void editNode(vtkObject*,
void*,
unsigned long) {};
565 virtual void onAboutToQuit();
571 void requestInvokeEvent(vtkObject* caller,
void* callData);
576 void scheduleInvokeEvent(
unsigned int delay,
void* caller,
unsigned long event,
void* callData);
590 void urlReceived(QString url);
594 void invokeEventRequested(
unsigned int delay,
void* caller,
595 unsigned long event,
void* callData);
599 QScopedPointer<qSlicerCoreApplicationPrivate>
d_ptr;
virtual void resumeRender()
Superclass for MRML logic classes.
virtual void pauseRender()
A set of MRML Nodes that supports serialization and undo/redo.
virtual void setRenderPaused(bool pause)
virtual void editNode(vtkObject *, void *, unsigned long)
QScopedPointer< qSlicerCoreApplicationPrivate > d_ptr