Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkBaseApplication.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkBaseApplication_h
14 #define mitkBaseApplication_h
15 
16 #include <MitkAppUtilExports.h>
17 
18 #include <Poco/Util/Application.h>
19 
20 #include <QString>
21 #include <QVariant>
22 
23 class ctkPluginContext;
24 class ctkPluginFramework;
25 
26 class QCoreApplication;
27 class QTranslator;
28 
29 namespace mitk
30 {
75  class MITKAPPUTIL_EXPORT BaseApplication : public Poco::Util::Application
76  {
77  public:
78  // Command line arguments
79 
80  static const QString ARG_APPLICATION;
81  static const QString ARG_CLEAN;
82  static const QString ARG_CONSOLELOG;
83  static const QString ARG_DEBUG;
84  static const QString ARG_FORCE_PLUGIN_INSTALL;
85  static const QString ARG_HOME;
86  static const QString ARG_NEWINSTANCE;
87  static const QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
88  static const QString ARG_NO_REGISTRY_CACHE;
89  static const QString ARG_PLUGIN_CACHE;
90  static const QString ARG_PLUGIN_DIRS;
91  static const QString ARG_PRELOAD_LIBRARY;
92  static const QString ARG_PRODUCT;
93  static const QString ARG_PROVISIONING;
94  static const QString ARG_REGISTRY_MULTI_LANGUAGE;
95  static const QString ARG_SPLASH_IMAGE;
96  static const QString ARG_STORAGE_DIR;
97  static const QString ARG_XARGS;
98  static const QString ARG_LOG_QT_MESSAGES;
99  static const QString ARG_SEGMENTATION_LABELSET_PRESET;
101 
102  // BlueBerry specific plugin framework properties
103 
104  static const QString PROP_APPLICATION;
105  static const QString PROP_FORCE_PLUGIN_INSTALL;
106  static const QString PROP_NEWINSTANCE;
108  static const QString PROP_NO_REGISTRY_CACHE;
109  static const QString PROP_PRODUCT;
110  static const QString PROP_REGISTRY_MULTI_LANGUAGE;
111 
112  BaseApplication(int argc, char **argv);
113  ~BaseApplication() override;
114 
121  void initializeQt();
122 
129  int run() override;
130 
131  void printHelp(const std::string &name, const std::string &value);
132 
137  void setApplicationName(const QString &name);
138  QString getApplicationName() const;
139 
144  void setOrganizationName(const QString &name);
145  QString getOrganizationName() const;
146 
151  void setOrganizationDomain(const QString &name);
152  QString getOrganizationDomain() const;
153 
162  void setSingleMode(bool singleMode);
163  bool getSingleMode() const;
164 
171  void setSafeMode(bool safeMode);
172  bool getSafeMode() const;
173 
185  void setPreloadLibraries(const QStringList &libraryBaseNames);
186 
192  QStringList getPreloadLibraries() const;
193 
206  void setProvisioningFilePath(const QString &filePath);
207 
212  QString getProvisioningFilePath() const;
213 
214  void setProperty(const QString &property, const QVariant &value);
215  QVariant getProperty(const QString &property) const;
216 
217  void installTranslator(QTranslator*);
218 
219  bool isRunning();
220 
221  void sendMessage(const QByteArray);
222 
223  protected:
224  void initialize(Poco::Util::Application &self) override;
225 
226  void uninitialize() override;
227 
228  int getArgc() const;
229  char **getArgv() const;
230 
238  virtual QString getCTKFrameworkStorageDir() const;
239 
251  virtual void initializeCppMicroServices();
252 
263  virtual QCoreApplication *getQApplication() const;
264 
271  virtual void initializeLibraryPaths();
272 
285  int main(const std::vector<std::string> &args) override;
286 
291  void defineOptions(Poco::Util::OptionSet &options) override;
292 
293  QSharedPointer<ctkPluginFramework> getFramework() const;
294  ctkPluginContext *getFrameworkContext() const;
295 
306  QHash<QString, QVariant> getFrameworkProperties() const;
307 
308  /*
309  * Initialize and display the splash screen if an image filename is given
310  *
311  */
312  void initializeSplashScreen(QCoreApplication * application) const;
313 
314 private:
315  struct Impl;
316  Impl* d;
317  };
318 }
319 
320 #endif
mitk::BaseApplication::ARG_NO_REGISTRY_CACHE
static const QString ARG_NO_REGISTRY_CACHE
Definition: mitkBaseApplication.h:88
mitk::BaseApplication::PROP_REGISTRY_MULTI_LANGUAGE
static const QString PROP_REGISTRY_MULTI_LANGUAGE
Definition: mitkBaseApplication.h:110
mitk::BaseApplication::ARG_DEBUG
static const QString ARG_DEBUG
Definition: mitkBaseApplication.h:83
mitk::BaseApplication::ARG_LOG_QT_MESSAGES
static const QString ARG_LOG_QT_MESSAGES
Definition: mitkBaseApplication.h:98
mitk::BaseApplication::PROP_PRODUCT
static const QString PROP_PRODUCT
Definition: mitkBaseApplication.h:109
mitk::BaseApplication::ARG_PRODUCT
static const QString ARG_PRODUCT
Definition: mitkBaseApplication.h:92
MITKAPPUTIL_EXPORT
#define MITKAPPUTIL_EXPORT
Definition: MitkAppUtilExports.h:15
mitk::BaseApplication::PROP_FORCE_PLUGIN_INSTALL
static const QString PROP_FORCE_PLUGIN_INSTALL
Definition: mitkBaseApplication.h:105
mitk::BaseApplication::ARG_CONSOLELOG
static const QString ARG_CONSOLELOG
Definition: mitkBaseApplication.h:82
mitk::BaseApplication::ARG_PLUGIN_DIRS
static const QString ARG_PLUGIN_DIRS
Definition: mitkBaseApplication.h:90
mitk::BaseApplication::ARG_PROVISIONING
static const QString ARG_PROVISIONING
Definition: mitkBaseApplication.h:93
mitk::BaseApplication::ARG_SEGMENTATION_LABEL_SUGGESTIONS
static const QString ARG_SEGMENTATION_LABEL_SUGGESTIONS
Definition: mitkBaseApplication.h:100
mitk::BaseApplication::ARG_NEWINSTANCE
static const QString ARG_NEWINSTANCE
Definition: mitkBaseApplication.h:86
mitk::BaseApplication::ARG_SEGMENTATION_LABELSET_PRESET
static const QString ARG_SEGMENTATION_LABELSET_PRESET
Definition: mitkBaseApplication.h:99
mitk::BaseApplication::PROP_APPLICATION
static const QString PROP_APPLICATION
Definition: mitkBaseApplication.h:104
mitk::BaseApplication::PROP_NEWINSTANCE
static const QString PROP_NEWINSTANCE
Definition: mitkBaseApplication.h:106
mitk::BaseApplication::ARG_STORAGE_DIR
static const QString ARG_STORAGE_DIR
Definition: mitkBaseApplication.h:96
mitk::BaseApplication::ARG_PRELOAD_LIBRARY
static const QString ARG_PRELOAD_LIBRARY
Definition: mitkBaseApplication.h:91
mitk::BaseApplication::ARG_HOME
static const QString ARG_HOME
Definition: mitkBaseApplication.h:85
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
QSharedPointer
Definition: berryILog.h:16
mitk::BaseApplication::ARG_SPLASH_IMAGE
static const QString ARG_SPLASH_IMAGE
Definition: mitkBaseApplication.h:95
mitk::BaseApplication
Definition: mitkBaseApplication.h:75
mitk::BaseApplication::ARG_CLEAN
static const QString ARG_CLEAN
Definition: mitkBaseApplication.h:81
mitk::BaseApplication::PROP_NO_LAZY_REGISTRY_CACHE_LOADING
static const QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING
Definition: mitkBaseApplication.h:107
mitk::BaseApplication::ARG_FORCE_PLUGIN_INSTALL
static const QString ARG_FORCE_PLUGIN_INSTALL
Definition: mitkBaseApplication.h:84
MitkAppUtilExports.h
mitk::BaseApplication::ARG_XARGS
static const QString ARG_XARGS
Definition: mitkBaseApplication.h:97
mitk::BaseApplication::ARG_REGISTRY_MULTI_LANGUAGE
static const QString ARG_REGISTRY_MULTI_LANGUAGE
Definition: mitkBaseApplication.h:94
mitk::BaseApplication::PROP_NO_REGISTRY_CACHE
static const QString PROP_NO_REGISTRY_CACHE
Definition: mitkBaseApplication.h:108
mitk::BaseApplication::ARG_NO_LAZY_REGISTRY_CACHE_LOADING
static const QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING
Definition: mitkBaseApplication.h:87
mitk::BaseApplication::ARG_PLUGIN_CACHE
static const QString ARG_PLUGIN_CACHE
Definition: mitkBaseApplication.h:89
mitk::BaseApplication::ARG_APPLICATION
static const QString ARG_APPLICATION
Definition: mitkBaseApplication.h:80