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 69 Q_PROPERTY(QString slicerHome READ slicerHome CONSTANT)
73 Q_PROPERTY(QString defaultScenePath READ defaultScenePath WRITE setDefaultScenePath)
74 Q_PROPERTY(QString slicerSharePath READ slicerSharePath CONSTANT)
75 Q_PROPERTY(QString temporaryPath READ temporaryPath WRITE setTemporaryPath)
76 Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath)
77 Q_PROPERTY(QString startupWorkingPath READ startupWorkingPath CONSTANT)
78 Q_PROPERTY(QString launcherExecutableFilePath READ launcherExecutableFilePath CONSTANT)
79 Q_PROPERTY(QString launcherSettingsFilePath READ launcherSettingsFilePath CONSTANT)
80 Q_PROPERTY(QString slicerDefaultSettingsFilePath READ slicerDefaultSettingsFilePath CONSTANT)
81 Q_PROPERTY(QString slicerUserSettingsFilePath READ slicerUserSettingsFilePath CONSTANT)
82 Q_PROPERTY(QString slicerRevisionUserSettingsFilePath READ slicerRevisionUserSettingsFilePath CONSTANT)
83 Q_PROPERTY(QString extensionsInstallPath READ extensionsInstallPath WRITE setExtensionsInstallPath)
84 Q_PROPERTY(QString intDir READ intDir CONSTANT)
85 Q_PROPERTY(
bool isInstalled READ isInstalled CONSTANT)
86 Q_PROPERTY(QString releaseType READ releaseType CONSTANT)
87 Q_PROPERTY(QString repositoryUrl READ repositoryUrl CONSTANT)
88 Q_PROPERTY(QString repositoryBranch READ repositoryBranch CONSTANT)
89 Q_PROPERTY(QString repositoryRevision READ repositoryRevision CONSTANT)
90 Q_PROPERTY(QString revision READ revision CONSTANT)
91 Q_PROPERTY(
int majorVersion READ majorVersion CONSTANT)
92 Q_PROPERTY(
int minorVersion READ minorVersion CONSTANT)
93 Q_PROPERTY(QString documentationBaseUrl READ documentationBaseUrl)
94 Q_PROPERTY(QString documentationVersion READ documentationVersion CONSTANT)
95 Q_PROPERTY(QString documentationLanguage READ documentationLanguage)
96 Q_PROPERTY(QString platform READ platform CONSTANT)
97 Q_PROPERTY(QString arch READ arch CONSTANT)
98 Q_PROPERTY(QString os READ os CONSTANT)
99 Q_PROPERTY(
bool isCustomMainApplication READ isCustomMainApplication CONSTANT)
100 Q_PROPERTY(QString mainApplicationName READ mainApplicationName CONSTANT)
101 Q_PROPERTY(QString mainApplicationRepositoryUrl READ mainApplicationRepositoryUrl CONSTANT)
102 Q_PROPERTY(QString mainApplicationRepositoryRevision READ mainApplicationRepositoryRevision CONSTANT)
103 Q_PROPERTY(QString mainApplicationRevision READ mainApplicationRevision CONSTANT)
104 Q_PROPERTY(
int mainApplicationMajorVersion READ mainApplicationMajorVersion CONSTANT)
105 Q_PROPERTY(
int mainApplicationMinorVersion READ mainApplicationMinorVersion CONSTANT)
106 Q_PROPERTY(
int mainApplicationPatchVersion READ mainApplicationPatchVersion CONSTANT)
123 AA_DisablePython = 1000,
149 Q_INVOKABLE QProcessEnvironment startupEnvironment()
const;
152 QString startupWorkingPath()
const;
164 Q_INVOKABLE QProcessEnvironment environment()
const;
170 Q_INVOKABLE
void setEnvironmentVariable(
const QString& key,
const QString& value);
173 Q_INVOKABLE
bool isEnvironmentVariableValueSet(
const QString& key,
const QString& value);
177 Q_INVOKABLE
void prependEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
181 Q_INVOKABLE
void appendEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
185 void parseArguments(
bool& exitWhenDone);
188 ExitNotRequested = -1,
189 ExitSuccess = EXIT_SUCCESS,
190 ExitFailure = EXIT_FAILURE
206 int returnCode()
const;
231 QString slicerHome()
const;
237 QString defaultScenePath()
const;
240 void setDefaultScenePath(
const QString& path);
248 QString slicerSharePath()
const;
252 bool isEmbeddedModule(
const QString& moduleFileName)
const;
255 QString defaultTemporaryPath()
const;
258 QString temporaryPath()
const;
261 void setTemporaryPath(
const QString& path);
265 QString defaultCachePath()
const;
270 QString cachePath()
const;
274 void setCachePath(
const QString& path);
277 QString launcherExecutableFilePath()
const;
280 QString launcherSettingsFilePath()
const;
283 QString launcherRevisionSpecificUserSettingsFilePath()
const;
287 QString slicerDefaultSettingsFilePath()
const;
291 QString slicerUserSettingsFilePath()
const;
295 QString slicerRevisionUserSettingsFilePath()
const;
298 QString defaultExtensionsInstallPath()
const;
301 QString extensionsInstallPath()
const;
304 void setExtensionsInstallPath(
const QString& path);
308 QString intDir()
const;
311 bool isInstalled()
const;
316 QString releaseType()
const;
322 Q_INVOKABLE
void addModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
325 Q_INVOKABLE
void removeModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
328 Q_INVOKABLE QStringList modulesAssociatedWithNodeType(
const QString& nodeClassName)
const;
331 Q_INVOKABLE QStringList allModuleAssociatedNodeTypes()
const;
333 #ifdef Slicer_USE_PYTHONQT 342 ctkPythonConsole* pythonConsole()
const;
348 void setPythonConsole(ctkPythonConsole* pythonConsole);
352 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 362 Q_INVOKABLE ctkErrorLogAbstractModel* errorLogModel()
const;
383 Q_INVOKABLE QSettings* defaultSettings()
const;
388 Q_INVOKABLE QSettings* userSettings()
const;
393 Q_INVOKABLE QSettings* settings()
const;
398 Q_INVOKABLE QSettings* revisionUserSettings()
const;
401 bool isCustomMainApplication()
const;
404 QString mainApplicationName()
const;
409 QString mainApplicationRepositoryUrl()
const;
414 QString mainApplicationRepositoryRevision()
const;
418 QString mainApplicationRevision()
const;
422 int mainApplicationMajorVersion()
const;
426 int mainApplicationMinorVersion()
const;
430 int mainApplicationPatchVersion()
const;
437 QString documentationBaseUrl()
const;
442 QString documentationVersion()
const;
446 QString documentationLanguage()
const;
451 Q_INVOKABLE QString moduleDocumentationUrl(
const QString &moduleName)
const;
454 virtual QString copyrights()
const;
457 virtual QString acknowledgment()
const;
460 virtual QString libraries()
const;
464 QString repositoryUrl()
const;
468 QString repositoryBranch()
const;
472 QString repositoryRevision()
const;
475 QString revision()
const;
478 int majorVersion()
const;
481 int minorVersion()
const;
485 QString platform()
const;
495 #ifdef Slicer_BUILD_DICOM_SUPPORT 496 Q_INVOKABLE ctkDICOMDatabase* dicomDatabase()
const;
501 QSharedPointer<ctkDICOMDatabase> dicomDatabaseShared()
const;
505 Q_INVOKABLE
static QStringList translationFolders();
509 Q_INVOKABLE
static void loadTranslations(
const QString& dir);
513 Q_INVOKABLE
static void loadLanguage();
519 Q_INVOKABLE
static bool loadCaCertificates(
const QString& slicerHome);
521 Q_INVOKABLE
int registerResource(
const QByteArray& data);
525 Q_INVOKABLE
void showConsoleMessage(QString message,
bool error=
true)
const;
529 Q_INVOKABLE QString toSlicerHomeAbsolutePath(
const QString& path)
const;
533 Q_INVOKABLE QString toSlicerHomeRelativePath(
const QString& path)
const;
537 Q_INVOKABLE QStringList toSlicerHomeAbsolutePaths(
const QStringList& path)
const;
541 Q_INVOKABLE QStringList toSlicerHomeRelativePaths(
const QStringList& path)
const;
547 static void restart();
549 bool unregisterResource(
int handle);
573 virtual void openUrl(
const QString& url);
580 virtual void handlePreApplicationCommandLineArguments();
591 virtual void handleCommandLineArguments();
593 virtual void onSlicerApplicationLogicModified();
594 virtual void onUserInformationModified();
595 void onSlicerApplicationLogicRequest(vtkObject*,
void* ,
unsigned long);
596 void processAppLogicModified();
597 void processAppLogicReadData();
598 void processAppLogicWriteData();
602 virtual void editNode(vtkObject*,
void*,
unsigned long) {};
608 virtual void onAboutToQuit();
614 void requestInvokeEvent(vtkObject* caller,
void* callData);
619 void scheduleInvokeEvent(
unsigned int delay,
void* caller,
unsigned long event,
void* callData);
633 void urlReceived(QString url);
637 void invokeEventRequested(
unsigned int delay,
void* caller,
638 unsigned long event,
void* callData);
642 QScopedPointer<qSlicerCoreApplicationPrivate>
d_ptr;
665 if (this->Application)
672 if (this->Application)
virtual void resumeRender()
Superclass for MRML logic classes.
virtual void pauseRender()
Q_DECLARE_METATYPE(qSlicerExtensionsManagerModel::ServerAPI)
static qSlicerCoreApplication * application()
Safe replacement of qSlicerCoreApplication::pauseRender/resumeRender.
Class querying and storing extensions data.
A set of MRML Nodes that supports serialization and undo/redo.
qSlicerCoreApplication * Application
virtual void setRenderPaused(bool pause)
virtual void editNode(vtkObject *, void *, unsigned long)
QScopedPointer< qSlicerCoreApplicationPrivate > d_ptr