Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKBASEAPPLICATION_H
18 #define MITKBASEAPPLICATION_H
19 
20 #include <MitkAppUtilExports.h>
21 
22 #include <Poco/Util/Application.h>
23 
24 #include <QHash>
25 #include <QScopedPointer>
26 #include <QSharedPointer>
27 #include <QString>
28 
29 class QCoreApplication;
30 
31 class ctkPluginContext;
32 class ctkPluginFramework;
33 
34 namespace mitk
35 {
82  class MITKAPPUTIL_EXPORT BaseApplication : public Poco::Util::Application
83  {
84  public:
85  // Command line arguments
86 
87  static QString ARG_NEWINSTANCE;
88  static QString ARG_CLEAN;
89  static QString ARG_APPLICATION;
90  static QString ARG_PRODUCT;
91  static QString ARG_HOME;
92  static QString ARG_STORAGE_DIR;
93  static QString ARG_PLUGIN_CACHE;
94  static QString ARG_PLUGIN_DIRS;
95  static QString ARG_FORCE_PLUGIN_INSTALL;
96  static QString ARG_PRELOAD_LIBRARY;
97  static QString ARG_PROVISIONING;
98  static QString ARG_DEBUG;
99 
100  static QString ARG_CONSOLELOG;
101  static QString ARG_TESTPLUGIN;
102  static QString ARG_TESTAPPLICATION;
103 
104  static QString ARG_NO_REGISTRY_CACHE;
107 
108  static QString ARG_SPLASH_IMAGE;
109 
110  static QString ARG_XARGS;
111 
112  // BlueBerry specific Plugin Framework properties
113 
114  static QString PROP_NEWINSTANCE;
116  static QString PROP_NO_REGISTRY_CACHE;
119 
120  static QString PROP_PRODUCT;
121  static QString PROP_APPLICATION;
122  static QString PROP_TESTPLUGIN;
123  static QString PROP_TESTAPPLICATION;
124 
125  BaseApplication(int argc, char **argv);
126  ~BaseApplication();
127 
134  void initializeQt();
135 
142  int run() override;
143 
144  void printHelp(const std::string &name, const std::string &value);
145 
150  void setApplicationName(const QString &name);
151  QString getApplicationName() const;
152 
157  void setOrganizationName(const QString &name);
158  QString getOrganizationName() const;
159 
164  void setOrganizationDomain(const QString &name);
165  QString getOrganizationDomain() const;
166 
175  void setSingleMode(bool singleMode);
176  bool getSingleMode() const;
177 
184  void setSafeMode(bool safeMode);
185  bool getSafeMode() const;
186 
198  void setPreloadLibraries(const QStringList &libraryBaseNames);
199 
205  QStringList getPreloadLibraries() const;
206 
219  void setProvisioningFilePath(const QString &filePath);
220 
225  QString getProvisioningFilePath() const;
226 
227  void setProperty(const QString &property, const QVariant &value);
228  QVariant getProperty(const QString &property) const;
229 
230  protected:
231  void initialize(Poco::Util::Application &self) override;
232 
233  void uninitialize() override;
234 
235  int getArgc() const;
236  char **getArgv() const;
237 
245  virtual QString getCTKFrameworkStorageDir() const;
246 
258  virtual void initializeCppMicroServices();
259 
270  virtual QCoreApplication *getQApplication() const;
271 
278  virtual void initializeLibraryPaths();
279 
292  int main(const std::vector<std::string> &args) override;
293 
298  void defineOptions(Poco::Util::OptionSet &options) override;
299 
300  QSharedPointer<ctkPluginFramework> getFramework() const;
301  ctkPluginContext *getFrameworkContext() const;
302 
313  QHash<QString, QVariant> getFrameworkProperties() const;
314 
315  /*
316  * Initialize and display the splash screen if an image filename is given
317  *
318  */
319  void initializeSplashScreen(QCoreApplication * application) const;
320 
321 private:
322  struct Impl;
323  QScopedPointer<Impl> d;
324  };
325 }
326 
327 #endif // MITKBASEAPPLICATION_H
static QString ARG_PLUGIN_CACHE
static QString ARG_APPLICATION
static QString PROP_TESTAPPLICATION
DataCollection - Class to facilitate loading/accessing structured data.
static QString ARG_PLUGIN_DIRS
static QString PROP_TESTPLUGIN
static QString PROP_REGISTRY_MULTI_LANGUAGE
static QString ARG_REGISTRY_MULTI_LANGUAGE
static QString PROP_NO_REGISTRY_CACHE
static QString ARG_STORAGE_DIR
static QString PROP_NEWINSTANCE
int main(int argc, char **argv)
Definition: MitkCoreApp.cpp:22
static QString ARG_FORCE_PLUGIN_INSTALL
static QString ARG_SPLASH_IMAGE
static QString ARG_PROVISIONING
#define MITKAPPUTIL_EXPORT
static QString ARG_TESTAPPLICATION
static QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING
static QString ARG_NO_REGISTRY_CACHE
static QString PROP_APPLICATION
static QString ARG_NEWINSTANCE
static QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING
static QString PROP_FORCE_PLUGIN_INSTALL
static QString ARG_PRELOAD_LIBRARY