Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
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 // MITKBASEAPPLICATION_H
static const QString ARG_DEBUG
static const QString ARG_CONSOLELOG
static const QString ARG_REGISTRY_MULTI_LANGUAGE
static const QString ARG_CLEAN
static const QString ARG_PLUGIN_CACHE
static const QString ARG_XARGS
DataCollection - Class to facilitate loading/accessing structured data.
static const QString PROP_REGISTRY_MULTI_LANGUAGE
static const QString PROP_APPLICATION
static const QString ARG_SEGMENTATION_LABEL_SUGGESTIONS
static const QString PROP_NO_REGISTRY_CACHE
static const QString ARG_SPLASH_IMAGE
static const QString ARG_NO_REGISTRY_CACHE
static const QString ARG_PRELOAD_LIBRARY
static const QString ARG_NEWINSTANCE
static const QString ARG_HOME
static const QString ARG_PLUGIN_DIRS
static const QString ARG_FORCE_PLUGIN_INSTALL
#define MITKAPPUTIL_EXPORT
static const QString ARG_PRODUCT
static const QString ARG_LOG_QT_MESSAGES
static const QString PROP_PRODUCT
static const QString ARG_APPLICATION
static const QString PROP_NEWINSTANCE
static const QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING
static const QString ARG_SEGMENTATION_LABELSET_PRESET
static const QString ARG_PROVISIONING
static const QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING
static const QString ARG_STORAGE_DIR
static const QString PROP_FORCE_PLUGIN_INSTALL