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;
44 class qSlicerCoreApplicationPrivate;
46 #ifdef Slicer_USE_PYTHONQT 48 class ctkPythonConsole;
50 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 66 Q_PROPERTY(QString slicerHome READ slicerHome CONSTANT)
70 Q_PROPERTY(QString defaultScenePath READ defaultScenePath WRITE setDefaultScenePath)
71 Q_PROPERTY(QString slicerSharePath READ slicerSharePath CONSTANT)
72 Q_PROPERTY(QString temporaryPath READ temporaryPath WRITE setTemporaryPath)
73 Q_PROPERTY(QString launcherExecutableFilePath READ launcherExecutableFilePath CONSTANT)
74 Q_PROPERTY(QString launcherSettingsFilePath READ launcherSettingsFilePath CONSTANT)
75 Q_PROPERTY(QString slicerDefaultSettingsFilePath READ slicerDefaultSettingsFilePath CONSTANT)
76 Q_PROPERTY(QString slicerUserSettingsFilePath READ slicerUserSettingsFilePath CONSTANT)
77 Q_PROPERTY(QString slicerRevisionUserSettingsFilePath READ slicerRevisionUserSettingsFilePath CONSTANT)
78 Q_PROPERTY(QString extensionsInstallPath READ extensionsInstallPath WRITE setExtensionsInstallPath)
79 Q_PROPERTY(QString intDir READ intDir CONSTANT)
80 Q_PROPERTY(
bool isInstalled READ isInstalled CONSTANT)
81 Q_PROPERTY(QString releaseType READ releaseType CONSTANT)
82 Q_PROPERTY(QString repositoryUrl READ repositoryUrl CONSTANT)
83 Q_PROPERTY(QString repositoryBranch READ repositoryBranch CONSTANT)
84 Q_PROPERTY(QString repositoryRevision READ repositoryRevision CONSTANT)
85 Q_PROPERTY(
int majorVersion READ majorVersion CONSTANT)
86 Q_PROPERTY(
int minorVersion READ minorVersion CONSTANT)
87 Q_PROPERTY(QString platform READ platform CONSTANT)
88 Q_PROPERTY(QString arch READ arch CONSTANT)
89 Q_PROPERTY(QString os READ os CONSTANT)
90 Q_PROPERTY(
bool isCustomMainApplication READ isCustomMainApplication CONSTANT)
91 Q_PROPERTY(QString mainApplicationName READ mainApplicationName CONSTANT)
92 Q_PROPERTY(QString mainApplicationRepositoryUrl READ mainApplicationRepositoryUrl CONSTANT)
93 Q_PROPERTY(QString mainApplicationRepositoryRevision READ mainApplicationRepositoryRevision CONSTANT)
94 Q_PROPERTY(
int mainApplicationMajorVersion READ mainApplicationMajorVersion CONSTANT)
95 Q_PROPERTY(
int mainApplicationMinorVersion READ mainApplicationMinorVersion CONSTANT)
96 Q_PROPERTY(
int mainApplicationPatchVersion READ mainApplicationPatchVersion CONSTANT)
111 AA_DisablePython = 1000,
137 Q_INVOKABLE QProcessEnvironment startupEnvironment()
const;
149 Q_INVOKABLE QProcessEnvironment environment()
const;
155 void setEnvironmentVariable(
const QString& key,
const QString& value);
158 bool isEnvironmentVariableValueSet(
const QString& key,
const QString& value);
162 void prependEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
166 void appendEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
170 void parseArguments(
bool& exitWhenDone);
173 ExitNotRequested = -1,
174 ExitSuccess = EXIT_SUCCESS,
175 ExitFailure = EXIT_FAILURE
182 int returnCode()
const;
192 QString slicerHome()
const;
198 QString defaultScenePath()
const;
201 void setDefaultScenePath(
const QString& path);
209 QString slicerSharePath()
const;
213 bool isEmbeddedModule(
const QString& moduleFileName)
const;
216 QString defaultTemporaryPath()
const;
219 QString temporaryPath()
const;
222 void setTemporaryPath(
const QString& path);
225 QString launcherExecutableFilePath()
const;
228 QString launcherSettingsFilePath()
const;
231 QString launcherRevisionSpecificUserSettingsFilePath()
const;
235 QString slicerDefaultSettingsFilePath()
const;
239 QString slicerUserSettingsFilePath()
const;
243 QString slicerRevisionUserSettingsFilePath()
const;
246 QString defaultExtensionsInstallPath()
const;
249 QString extensionsInstallPath()
const;
252 void setExtensionsInstallPath(
const QString& path);
254 void gatherExtensionsHistoryInformationOnStartup();
258 QString intDir()
const;
261 bool isInstalled()
const;
266 QString releaseType()
const;
272 Q_INVOKABLE
void addModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
275 Q_INVOKABLE
void removeModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
278 Q_INVOKABLE QStringList modulesAssociatedWithNodeType(
const QString& nodeClassName)
const;
281 Q_INVOKABLE QStringList allModuleAssociatedNodeTypes()
const;
283 #ifdef Slicer_USE_PYTHONQT 292 ctkPythonConsole* pythonConsole()
const;
298 void setPythonConsole(ctkPythonConsole* pythonConsole);
302 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 330 Q_INVOKABLE QSettings* defaultSettings()
const;
335 Q_INVOKABLE QSettings* userSettings()
const;
340 Q_INVOKABLE QSettings* settings()
const;
345 Q_INVOKABLE QSettings* revisionUserSettings()
const;
348 bool isCustomMainApplication()
const;
351 QString mainApplicationName()
const;
356 QString mainApplicationRepositoryUrl()
const;
361 QString mainApplicationRepositoryRevision()
const;
365 int mainApplicationMajorVersion()
const;
369 int mainApplicationMinorVersion()
const;
373 int mainApplicationPatchVersion()
const;
376 virtual QString copyrights()
const;
379 virtual QString acknowledgment()
const;
382 virtual QString libraries()
const;
386 QString repositoryUrl()
const;
390 QString repositoryBranch()
const;
394 QString repositoryRevision()
const;
398 int majorVersion()
const;
401 int minorVersion()
const;
405 QString platform()
const;
415 #ifdef Slicer_BUILD_DICOM_SUPPORT 416 Q_INVOKABLE ctkDICOMDatabase* dicomDatabase()
const;
421 Q_INVOKABLE
void setDICOMDatabase(ctkDICOMDatabase* dicomDatabase);
424 static void loadTranslations(
const QString& dir);
426 static void loadLanguage();
432 static bool loadCaCertificates(
const QString& slicerHome);
434 Q_INVOKABLE
int registerResource(
const QByteArray& data);
438 Q_INVOKABLE
void showConsoleMessage(QString message,
bool error=
true)
const;
444 static void restart();
446 bool unregisterResource(
int handle);
453 virtual void handlePreApplicationCommandLineArguments();
464 virtual void handleCommandLineArguments();
466 virtual void onSlicerApplicationLogicModified();
467 virtual void onUserInformationModified();
468 void onSlicerApplicationLogicRequest(vtkObject*,
void* ,
unsigned long);
469 void processAppLogicModified();
470 void processAppLogicReadData();
471 void processAppLogicWriteData();
480 void requestInvokeEvent(vtkObject* caller,
void* callData);
485 void scheduleInvokeEvent(
unsigned int delay,
void* caller,
unsigned long event,
void* callData);
498 void invokeEventRequested(
unsigned int delay,
void* caller,
499 unsigned long event,
void* callData);
503 QScopedPointer<qSlicerCoreApplicationPrivate>
d_ptr;
A set of MRML Nodes that supports serialization and undo/redo.
QScopedPointer< qSlicerCoreApplicationPrivate > d_ptr