21#ifndef __qSlicerCoreApplication_h
22#define __qSlicerCoreApplication_h
25#include <QApplication>
27#include <QProcessEnvironment>
32#include <ctkVTKObject.h>
35#include "vtkSlicerConfigure.h"
36#include "qSlicerBaseQTCoreExport.h"
38#ifdef Slicer_BUILD_DICOM_SUPPORT
39class ctkDICOMDatabase;
41class ctkErrorLogAbstractModel;
45class qSlicerCoreApplicationPrivate;
47#ifdef Slicer_USE_PYTHONQT
49class ctkPythonConsole;
51#ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT
54#ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT
75 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(QLocale applicationLocale READ applicationLocale CONSTANT)
97 Q_PROPERTY(QString applicationLocaleName READ applicationLocaleName CONSTANT)
98 Q_PROPERTY(QString documentationBaseUrl READ documentationBaseUrl)
99 Q_PROPERTY(QString documentationVersion READ documentationVersion CONSTANT)
100 Q_PROPERTY(QString documentationLanguage READ documentationLanguage CONSTANT)
101 Q_PROPERTY(QString platform READ platform CONSTANT)
102 Q_PROPERTY(QString arch READ arch CONSTANT)
103 Q_PROPERTY(QString os READ os CONSTANT)
104 Q_PROPERTY(
bool isCustomMainApplication READ isCustomMainApplication CONSTANT)
105 Q_PROPERTY(QString mainApplicationName READ mainApplicationName CONSTANT)
106 Q_PROPERTY(QString mainApplicationRepositoryUrl READ mainApplicationRepositoryUrl CONSTANT)
107 Q_PROPERTY(QString mainApplicationRepositoryRevision READ mainApplicationRepositoryRevision CONSTANT)
108 Q_PROPERTY(QString mainApplicationRevision READ mainApplicationRevision CONSTANT)
109 Q_PROPERTY(
int mainApplicationMajorVersion READ mainApplicationMajorVersion CONSTANT)
110 Q_PROPERTY(
int mainApplicationMinorVersion READ mainApplicationMinorVersion CONSTANT)
111 Q_PROPERTY(
int mainApplicationPatchVersion READ mainApplicationPatchVersion CONSTANT)
112 Q_PROPERTY(
bool isUsageLoggingSupported READ isUsageLoggingSupported CONSTANT)
129 AA_DisablePython = 1000,
194 ExitNotRequested = -1,
195 ExitSuccess = EXIT_SUCCESS,
196 ExitFailure = EXIT_FAILURE
339#ifdef Slicer_USE_PYTHONQT
348 ctkPythonConsole* pythonConsole()
const;
354 void setPythonConsole(ctkPythonConsole* pythonConsole);
358#ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT
367#ifdef Slicer_BUILD_APPLICATIONUPDATE_SUPPORT
524#ifdef Slicer_BUILD_DICOM_SUPPORT
526 Q_INVOKABLE ctkDICOMDatabase* dicomDatabase()
const;
530 QSharedPointer<ctkDICOMDatabase> dicomDatabaseShared()
const;
600 Q_INVOKABLE
void logUsageEvent(
const QString& component,
const QString& event);
684 virtual void editNode(vtkObject*,
void*,
unsigned long) {};
720 unsigned long event,
void* callData);
726 QScopedPointer<qSlicerCoreApplicationPrivate>
d_ptr;
749 if (this->Application)
756 if (this->Application)
Safe replacement of qSlicerCoreApplication::pauseRender/resumeRender.
qSlicerCoreApplication * Application
Class querying application updates on the download server.
QString launcherSettingsFilePath() const
If any, return slicer launcher settings file path.
int mainApplicationMajorVersion() const
QString applicationLocaleName() const
QString defaultExtensionsInstallPath() const
Get slicer default extensions path.
virtual void onUserInformationModified()
void setDefaultScenePath(const QString &path)
Set default slicer scene directory.
void setCachePath(const QString &path)
virtual void onSlicerApplicationLogicModified()
Q_INVOKABLE void appendEnvironmentVariable(const QString &key, const QString &value, QChar separator=';')
qSlicerCoreCommandOptions * coreCommandOptions() const
Get coreCommandOptions.
Q_INVOKABLE ctkErrorLogAbstractModel * errorLogModel() const
Get errorLogModel.
Q_INVOKABLE int registerResource(const QByteArray &data)
virtual void openUrl(const QString &url)
Q_INVOKABLE QStringList toSlicerHomeRelativePaths(const QStringList &path) const
QString repositoryUrl() const
virtual void onAboutToQuit()
Perform application cleanup following a call to QCoreApplication::exit().
Q_INVOKABLE void setEnvironmentVariable(const QString &key, const QString &value)
Convenient function to set an environment variable.
QLocale applicationLocale() const
Q_INVOKABLE vtkSlicerApplicationLogic * applicationLogic() const
Get application logic.
QString mainApplicationName() const
Return the name of the main application.
void setTemporaryPath(const QString &path)
Set slicer temporary directory.
void setCoreCommandOptions(qSlicerCoreCommandOptions *options)
QString slicerHome() const
void requestInvokeEvent(vtkObject *caller, void *callData)
static Q_INVOKABLE QStringList translationFolders()
Return list of folders where the application looks for translations (*.qm files)
int minorVersion() const
Return the Slicer minor version number.
void setExtensionsInstallPath(const QString &path)
Set slicer extension directory.
virtual QString libraries() const
Return the libraries of Slicer.
static Q_INVOKABLE void loadLanguage()
QString launcherExecutableFilePath() const
If any, return slicer launcher executable file path.
Q_INVOKABLE void prependEnvironmentVariable(const QString &key, const QString &value, QChar separator=';')
void invokeEventRequested(unsigned int delay, void *caller, unsigned long event, void *callData)
Q_INVOKABLE QProcessEnvironment environment() const
Returns the current environment.
QScopedPointer< qSlicerCoreApplicationPrivate > d_ptr
QString defaultTemporaryPath() const
Get slicer default temporary directory.
static Q_INVOKABLE bool loadCaCertificates(const QString &slicerHome)
void processAppLogicWriteData()
virtual bool loadFiles(const QStringList &filePaths, vtkMRMLMessageCollection *userMessages=nullptr)
Q_INVOKABLE QString toSlicerHomeAbsolutePath(const QString &path) const
void terminate(int exitCode=qSlicerCoreApplication::ExitSuccess)
Set the ReturnCode flag and call QCoreApplication::exit()
Q_INVOKABLE qSlicerModuleManager * moduleManager() const
Get the module manager.
QString temporaryPath() const
Get slicer temporary directory.
Q_INVOKABLE bool isEnvironmentVariableValueSet(const QString &key, const QString &value)
Returns True if environment variable identified by key is set to value.
QString slicerRevisionUserSettingsFilePath() const
Q_INVOKABLE QString moduleDocumentationUrl(const QString &moduleName) const
Q_INVOKABLE QStringList toSlicerHomeAbsolutePaths(const QStringList &path) const
Q_INVOKABLE QSettings * settings() const
QString mainApplicationRevision() const
Q_INVOKABLE void addModuleAssociatedNodeType(const QString &nodeClassName, const QString &moduleName)
void onSlicerApplicationLogicRequest(vtkObject *, void *, unsigned long)
virtual void handleCommandLineArguments()
Q_INVOKABLE vtkMRMLAbstractLogic * moduleLogic(const QString &moduleName) const
static bool testAttribute(qSlicerCoreApplication::ApplicationAttribute attribute)
void processAppLogicModified()
QString documentationLanguage() const
QString launcherRevisionSpecificUserSettingsFilePath() const
If any, return slicer user settings file path specific to a given revision of Slicer.
Q_INVOKABLE void showConsoleMessage(QString message, bool error=true) const
virtual QString copyrights() const
Return the copyrights of Slicer.
bool isUsageLoggingSupported() const
virtual void resumeRender()
Q_INVOKABLE QSettings * userSettings() const
QString releaseType() const
Return the release type of this instance of Slicer.
QString extensionsInstallPath() const
Get slicer extension directory.
bool unregisterResource(int handle)
void setCoreIOManager(qSlicerCoreIOManager *ioManager)
qSlicerCoreApplication(qSlicerCoreApplicationPrivate *pimpl, int &argc, char **argv)
void scheduleInvokeEvent(unsigned int delay, void *caller, unsigned long event, void *callData)
QString startupWorkingPath() const
Current working directory at the time the application was started.
QString mainApplicationRepositoryUrl() const
static qSlicerCoreApplication * application()
Q_INVOKABLE QStringList modulesAssociatedWithNodeType(const QString &nodeClassName) const
List of all modules that are associated with the specified node type.
QString slicerDefaultSettingsFilePath() const
void parseArguments(bool &exitWhenDone)
Q_INVOKABLE void handleURIArguments(const QStringList &fileNames)
int majorVersion() const
Return the Slicer major version number.
void urlReceived(QString url)
QString cachePath() const
void processAppLogicReadData()
void mrmlSceneChanged(vtkMRMLScene *mrmlScene)
QString slicerSharePath() const
QString mainApplicationRepositoryRevision() const
QString defaultScenePath() const
virtual void editNode(vtkObject *, void *, unsigned long)
Q_INVOKABLE QString toSlicerHomeRelativePath(const QString &path) const
bool isInstalled() const
Return true is this instance of Slicer is running from an installed directory.
QString documentationBaseUrl() const
bool isEmbeddedModule(const QString &moduleFileName) const
virtual void setRenderPaused(bool pause)
void usageEventLogged(const QString &component, const QString &event)
virtual void handlePreApplicationCommandLineArguments()
void setURIArgumentHandlingEnabled(bool enabled)
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
Get MRML Scene.
int mainApplicationMinorVersion() const
static Q_INVOKABLE QString caCertificatesPath(const QString &slicerHome)
virtual QString acknowledgment() const
Return the acknowledgment text of Slicer.
QString documentationVersion() const
Q_INVOKABLE QStringList allModuleAssociatedNodeTypes() const
List of all node types that are associated with any module.
QString repositoryRevision() const
Q_INVOKABLE qSlicerCoreIOManager * coreIOManager() const
Get the IO manager.
QString repositoryBranch() const
static Q_INVOKABLE void loadTranslations(const QString &dir)
QString revision() const
Return Slicer's user-friendly revision identifier.
Q_INVOKABLE void removeModuleAssociatedNodeType(const QString &nodeClassName, const QString &moduleName)
Remove association between a module and a node type.
Q_INVOKABLE QProcessEnvironment startupEnvironment() const
Returns the environment without the Slicer specific values.
Q_INVOKABLE QSettings * defaultSettings() const
bool isCustomMainApplication() const
Return if main application is custom application (not Slicer).
virtual void pauseRender()
QString slicerUserSettingsFilePath() const
Q_INVOKABLE void logUsageEvent(const QString &component, const QString &event)
bool isURIArgumentHandlingEnabled() const
QString defaultCachePath() const
static void setAttribute(qSlicerCoreApplication::ApplicationAttribute attribute, bool on=true)
int mainApplicationPatchVersion() const
Q_INVOKABLE QSettings * revisionUserSettings() const
virtual void setMRMLScene(vtkMRMLScene *scene)
Class querying and storing extensions data.
Superclass for MRML logic classes.
A set of MRML Nodes that supports serialization and undo/redo.
Q_DECLARE_METATYPE(qSlicerExtensionsManagerModel::ServerAPI)