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 54 #ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT 72 Q_PROPERTY(QString slicerHome READ slicerHome CONSTANT)
76 Q_PROPERTY(QString defaultScenePath READ defaultScenePath WRITE setDefaultScenePath)
77 Q_PROPERTY(QString slicerSharePath READ slicerSharePath CONSTANT)
78 Q_PROPERTY(QString temporaryPath READ temporaryPath WRITE setTemporaryPath)
79 Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath)
80 Q_PROPERTY(QString startupWorkingPath READ startupWorkingPath CONSTANT)
81 Q_PROPERTY(QString launcherExecutableFilePath READ launcherExecutableFilePath CONSTANT)
82 Q_PROPERTY(QString launcherSettingsFilePath READ launcherSettingsFilePath CONSTANT)
83 Q_PROPERTY(QString slicerDefaultSettingsFilePath READ slicerDefaultSettingsFilePath CONSTANT)
84 Q_PROPERTY(QString slicerUserSettingsFilePath READ slicerUserSettingsFilePath CONSTANT)
85 Q_PROPERTY(QString slicerRevisionUserSettingsFilePath READ slicerRevisionUserSettingsFilePath CONSTANT)
86 Q_PROPERTY(QString extensionsInstallPath READ extensionsInstallPath WRITE setExtensionsInstallPath)
87 Q_PROPERTY(QString intDir READ intDir CONSTANT)
88 Q_PROPERTY(
bool isInstalled READ isInstalled CONSTANT)
89 Q_PROPERTY(QString releaseType READ releaseType CONSTANT)
90 Q_PROPERTY(QString repositoryUrl READ repositoryUrl CONSTANT)
91 Q_PROPERTY(QString repositoryBranch READ repositoryBranch CONSTANT)
92 Q_PROPERTY(QString repositoryRevision READ repositoryRevision CONSTANT)
93 Q_PROPERTY(QString revision READ revision CONSTANT)
94 Q_PROPERTY(
int majorVersion READ majorVersion CONSTANT)
95 Q_PROPERTY(
int minorVersion READ minorVersion CONSTANT)
96 Q_PROPERTY(QString documentationBaseUrl READ documentationBaseUrl)
97 Q_PROPERTY(QString documentationVersion READ documentationVersion CONSTANT)
98 Q_PROPERTY(QString documentationLanguage READ documentationLanguage)
99 Q_PROPERTY(QString platform READ platform CONSTANT)
100 Q_PROPERTY(QString arch READ arch CONSTANT)
101 Q_PROPERTY(QString os READ os CONSTANT)
102 Q_PROPERTY(
bool isCustomMainApplication READ isCustomMainApplication CONSTANT)
103 Q_PROPERTY(QString mainApplicationName READ mainApplicationName CONSTANT)
104 Q_PROPERTY(QString mainApplicationRepositoryUrl READ mainApplicationRepositoryUrl CONSTANT)
105 Q_PROPERTY(QString mainApplicationRepositoryRevision READ mainApplicationRepositoryRevision CONSTANT)
106 Q_PROPERTY(QString mainApplicationRevision READ mainApplicationRevision CONSTANT)
107 Q_PROPERTY(
int mainApplicationMajorVersion READ mainApplicationMajorVersion CONSTANT)
108 Q_PROPERTY(
int mainApplicationMinorVersion READ mainApplicationMinorVersion CONSTANT)
109 Q_PROPERTY(
int mainApplicationPatchVersion READ mainApplicationPatchVersion CONSTANT)
126 AA_DisablePython = 1000,
152 Q_INVOKABLE QProcessEnvironment startupEnvironment()
const;
155 QString startupWorkingPath()
const;
167 Q_INVOKABLE QProcessEnvironment environment()
const;
173 Q_INVOKABLE
void setEnvironmentVariable(
const QString& key,
const QString& value);
176 Q_INVOKABLE
bool isEnvironmentVariableValueSet(
const QString& key,
const QString& value);
180 Q_INVOKABLE
void prependEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
184 Q_INVOKABLE
void appendEnvironmentVariable(
const QString& key,
const QString& value, QChar separator =
';');
188 void parseArguments(
bool& exitWhenDone);
191 ExitNotRequested = -1,
192 ExitSuccess = EXIT_SUCCESS,
193 ExitFailure = EXIT_FAILURE
209 int returnCode()
const;
234 QString slicerHome()
const;
240 QString defaultScenePath()
const;
243 void setDefaultScenePath(
const QString& path);
251 QString slicerSharePath()
const;
255 bool isEmbeddedModule(
const QString& moduleFileName)
const;
258 QString defaultTemporaryPath()
const;
261 QString temporaryPath()
const;
264 void setTemporaryPath(
const QString& path);
268 QString defaultCachePath()
const;
273 QString cachePath()
const;
277 void setCachePath(
const QString& path);
280 QString launcherExecutableFilePath()
const;
283 QString launcherSettingsFilePath()
const;
286 QString launcherRevisionSpecificUserSettingsFilePath()
const;
290 QString slicerDefaultSettingsFilePath()
const;
294 QString slicerUserSettingsFilePath()
const;
298 QString slicerRevisionUserSettingsFilePath()
const;
301 QString defaultExtensionsInstallPath()
const;
304 QString extensionsInstallPath()
const;
307 void setExtensionsInstallPath(
const QString& path);
311 QString intDir()
const;
314 bool isInstalled()
const;
319 QString releaseType()
const;
325 Q_INVOKABLE
void addModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
328 Q_INVOKABLE
void removeModuleAssociatedNodeType(
const QString& nodeClassName,
const QString& moduleName);
331 Q_INVOKABLE QStringList modulesAssociatedWithNodeType(
const QString& nodeClassName)
const;
334 Q_INVOKABLE QStringList allModuleAssociatedNodeTypes()
const;
336 #ifdef Slicer_USE_PYTHONQT 345 ctkPythonConsole* pythonConsole()
const;
351 void setPythonConsole(ctkPythonConsole* pythonConsole);
355 #ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT 364 #ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT 374 Q_INVOKABLE ctkErrorLogAbstractModel* errorLogModel()
const;
395 Q_INVOKABLE QSettings* defaultSettings()
const;
400 Q_INVOKABLE QSettings* userSettings()
const;
405 Q_INVOKABLE QSettings* settings()
const;
410 Q_INVOKABLE QSettings* revisionUserSettings()
const;
413 bool isCustomMainApplication()
const;
416 QString mainApplicationName()
const;
421 QString mainApplicationRepositoryUrl()
const;
426 QString mainApplicationRepositoryRevision()
const;
430 QString mainApplicationRevision()
const;
434 int mainApplicationMajorVersion()
const;
438 int mainApplicationMinorVersion()
const;
442 int mainApplicationPatchVersion()
const;
449 QString documentationBaseUrl()
const;
454 QString documentationVersion()
const;
458 QString documentationLanguage()
const;
463 Q_INVOKABLE QString moduleDocumentationUrl(
const QString &moduleName)
const;
466 virtual QString copyrights()
const;
469 virtual QString acknowledgment()
const;
472 virtual QString libraries()
const;
476 QString repositoryUrl()
const;
480 QString repositoryBranch()
const;
484 QString repositoryRevision()
const;
487 QString revision()
const;
490 int majorVersion()
const;
493 int minorVersion()
const;
497 QString platform()
const;
507 #ifdef Slicer_BUILD_DICOM_SUPPORT 508 Q_INVOKABLE ctkDICOMDatabase* dicomDatabase()
const;
513 QSharedPointer<ctkDICOMDatabase> dicomDatabaseShared()
const;
517 Q_INVOKABLE
static QStringList translationFolders();
521 Q_INVOKABLE
static void loadTranslations(
const QString& dir);
525 Q_INVOKABLE
static void loadLanguage();
532 Q_INVOKABLE
static bool loadCaCertificates(
const QString& slicerHome);
536 Q_INVOKABLE
static QString caCertificatesPath(
const QString& slicerHome);
538 Q_INVOKABLE
int registerResource(
const QByteArray& data);
542 Q_INVOKABLE
void showConsoleMessage(QString message,
bool error=
true)
const;
546 Q_INVOKABLE QString toSlicerHomeAbsolutePath(
const QString& path)
const;
550 Q_INVOKABLE QString toSlicerHomeRelativePath(
const QString& path)
const;
554 Q_INVOKABLE QStringList toSlicerHomeAbsolutePaths(
const QStringList& path)
const;
558 Q_INVOKABLE QStringList toSlicerHomeRelativePaths(
const QStringList& path)
const;
564 static void restart();
566 bool unregisterResource(
int handle);
590 virtual void openUrl(
const QString& url);
597 virtual void handlePreApplicationCommandLineArguments();
608 virtual void handleCommandLineArguments();
610 virtual void onSlicerApplicationLogicModified();
611 virtual void onUserInformationModified();
612 void onSlicerApplicationLogicRequest(vtkObject*,
void* ,
unsigned long);
613 void processAppLogicModified();
614 void processAppLogicReadData();
615 void processAppLogicWriteData();
619 virtual void editNode(vtkObject*,
void*,
unsigned long) {};
625 virtual void onAboutToQuit();
631 void requestInvokeEvent(vtkObject* caller,
void* callData);
636 void scheduleInvokeEvent(
unsigned int delay,
void* caller,
unsigned long event,
void* callData);
650 void urlReceived(QString url);
654 void invokeEventRequested(
unsigned int delay,
void* caller,
655 unsigned long event,
void* callData);
659 QScopedPointer<qSlicerCoreApplicationPrivate>
d_ptr;
682 if (this->Application)
689 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.
Class querying application updates on the download server.
qSlicerCoreApplication * Application
virtual void setRenderPaused(bool pause)
virtual void editNode(vtkObject *, void *, unsigned long)
QScopedPointer< qSlicerCoreApplicationPrivate > d_ptr