Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <mitkBaseApplication.h>
Public Member Functions | |
BaseApplication (int argc, char **argv) | |
~BaseApplication () | |
void | initializeQt () |
int | run () override |
void | printHelp (const std::string &name, const std::string &value) |
void | setApplicationName (const QString &name) |
QString | getApplicationName () const |
void | setOrganizationName (const QString &name) |
QString | getOrganizationName () const |
void | setOrganizationDomain (const QString &name) |
QString | getOrganizationDomain () const |
void | setSingleMode (bool singleMode) |
bool | getSingleMode () const |
void | setSafeMode (bool safeMode) |
bool | getSafeMode () const |
void | setPreloadLibraries (const QStringList &libraryBaseNames) |
QStringList | getPreloadLibraries () const |
void | setProvisioningFilePath (const QString &filePath) |
QString | getProvisioningFilePath () const |
void | setProperty (const QString &property, const QVariant &value) |
QVariant | getProperty (const QString &property) const |
Protected Member Functions | |
void | initialize (Poco::Util::Application &self) override |
void | uninitialize () override |
int | getArgc () const |
char ** | getArgv () const |
virtual QString | getCTKFrameworkStorageDir () const |
virtual void | initializeCppMicroServices () |
virtual QCoreApplication * | getQApplication () const |
virtual void | initializeLibraryPaths () |
int | main (const std::vector< std::string > &args) override |
void | defineOptions (Poco::Util::OptionSet &options) override |
QSharedPointer< ctkPluginFramework > | getFramework () const |
ctkPluginContext * | getFrameworkContext () const |
QHash< QString, QVariant > | getFrameworkProperties () const |
void | initializeSplashScreen (QCoreApplication *application) const |
A utility classes for starting up BlueBerry applications.
In the simplest case, a user creates an instance of this class and just calls run() which launches a CTK Plugin Framework instance and executes the default application registered by a plug-in via the org.blueberry.osgi.applications extension point.
This class contains many convenience methods to:
The behavior can further be customized by deriving from BaseApplication and overriding specific methods, such as:
A simple but complete usage example: #include <mitkBaseApplication.h>
int main(int argc, char** argv) { mitk::BaseApplication app(argc, argv); app.setApplicationName("MyApp"); app.setOrganizationName("MyOrganization");
// Run the workbench return app.run(); }
Definition at line 82 of file mitkBaseApplication.h.
mitk::BaseApplication::BaseApplication | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 326 of file mitkBaseApplication.cpp.
mitk::BaseApplication::~BaseApplication | ( | ) |
Definition at line 330 of file mitkBaseApplication.cpp.
|
overrideprotected |
Define command line arguments
options |
Definition at line 704 of file mitkBaseApplication.cpp.
References ARG_APPLICATION, ARG_CLEAN, ARG_CONSOLELOG, ARG_DEBUG, ARG_FORCE_PLUGIN_INSTALL, ARG_NEWINSTANCE, ARG_NO_LAZY_REGISTRY_CACHE_LOADING, ARG_NO_REGISTRY_CACHE, ARG_PRELOAD_LIBRARY, ARG_PRODUCT, ARG_PROVISIONING, ARG_REGISTRY_MULTI_LANGUAGE, ARG_SPLASH_IMAGE, ARG_STORAGE_DIR, ARG_TESTAPPLICATION, ARG_TESTPLUGIN, ARG_XARGS, printHelp(), PROP_APPLICATION, PROP_PRODUCT, PROP_TESTAPPLICATION, and PROP_TESTPLUGIN.
QString mitk::BaseApplication::getApplicationName | ( | ) | const |
Definition at line 361 of file mitkBaseApplication.cpp.
Referenced by getCTKFrameworkStorageDir(), and initializeQt().
|
protected |
Definition at line 579 of file mitkBaseApplication.cpp.
|
protected |
Definition at line 580 of file mitkBaseApplication.cpp.
|
protectedvirtual |
Get the framework storage directory for the CTK plugin framework. This method is called in the initialize(Poco::Util::Application&) method. It must not be called without a QCoreApplications instance.
Definition at line 581 of file mitkBaseApplication.cpp.
References ARG_NEWINSTANCE, getApplicationName(), getOrganizationName(), getSingleMode(), and qHash().
Referenced by initialize().
|
protected |
Definition at line 790 of file mitkBaseApplication.cpp.
Referenced by getFrameworkContext(), and uninitialize().
|
protected |
Definition at line 795 of file mitkBaseApplication.cpp.
References framework, and getFramework().
|
protected |
Get the initial properties for the CTK plugin framework.
The returned map contains the initial framework properties for initializing the CTK plugin framework. The value of specific properties may change at runtime and differ from the initial value.
Definition at line 818 of file mitkBaseApplication.cpp.
QString mitk::BaseApplication::getOrganizationDomain | ( | ) | const |
Definition at line 395 of file mitkBaseApplication.cpp.
Referenced by initializeQt().
QString mitk::BaseApplication::getOrganizationName | ( | ) | const |
Definition at line 379 of file mitkBaseApplication.cpp.
Referenced by getCTKFrameworkStorageDir(), and initializeQt().
QStringList mitk::BaseApplication::getPreloadLibraries | ( | ) | const |
Get the list of library base names which should be pre-loaded.
Definition at line 434 of file mitkBaseApplication.cpp.
Referenced by initialize().
QVariant mitk::BaseApplication::getProperty | ( | const QString & | property | ) | const |
Definition at line 827 of file mitkBaseApplication.cpp.
Referenced by initializeCppMicroServices().
QString mitk::BaseApplication::getProvisioningFilePath | ( | ) | const |
Get the file path to the provisioning file.
Definition at line 436 of file mitkBaseApplication.cpp.
Referenced by initialize().
|
protectedvirtual |
Get the QCoreApplication object.
This method is called in the initialize(Poco::Util::Application&) method and must create a QCoreApplication instance if the global qApp variable is not initialized yet.
Definition at line 622 of file mitkBaseApplication.cpp.
References getSafeMode(), and getSingleMode().
Referenced by initializeQt().
bool mitk::BaseApplication::getSafeMode | ( | ) | const |
Definition at line 428 of file mitkBaseApplication.cpp.
Referenced by getQApplication().
bool mitk::BaseApplication::getSingleMode | ( | ) | const |
Definition at line 409 of file mitkBaseApplication.cpp.
Referenced by getCTKFrameworkStorageDir(), getQApplication(), and setSafeMode().
|
overrideprotected |
Definition at line 510 of file mitkBaseApplication.cpp.
References getCTKFrameworkStorageDir(), getPreloadLibraries(), getProvisioningFilePath(), initializeCppMicroServices(), initializeLibraryPaths(), initializeQt(), and initializeSplashScreen().
|
protectedvirtual |
Initialize the CppMicroServices library.
The default implementation set the CppMicroServices storage path to the current ctkPluginConstants::FRAMEWORK_STORAGE property value.
This method is called in the initialize(Poco::Util::Application&) after the CTK Plugin Framework storage directory property was set.
Definition at line 612 of file mitkBaseApplication.cpp.
References getProperty(), and us::ModuleSettings::SetStoragePath().
Referenced by initialize().
|
protectedvirtual |
Add plugin library search paths to the CTK Plugin Framework.
This method is called in the nitialize(Poco::Util::Application&) method after getQApplication() was called.
Definition at line 650 of file mitkBaseApplication.cpp.
Referenced by initialize().
void mitk::BaseApplication::initializeQt | ( | ) |
Initialize the Qt library such that a QCoreApplication instance is available and e.g. Qt Widgets can be created.
This is usually not called directly by the user.
Definition at line 490 of file mitkBaseApplication.cpp.
References getApplicationName(), getOrganizationDomain(), getOrganizationName(), getQApplication(), setApplicationName(), setOrganizationDomain(), and setOrganizationName().
Referenced by initialize(), and main().
|
protected |
Definition at line 803 of file mitkBaseApplication.cpp.
References ARG_SPLASH_IMAGE.
Referenced by initialize().
|
overrideprotected |
Runs the application for which the platform was started. The platform must be running.
The given argument is passed to the application being run. If it is an invalid QVariant then the command line arguments used in starting the platform, and not consumed by the platform code, are passed to the application as a QStringList
.
argument | the argument passed to the application. May be invalid |
std::exception | if anything goes wrong |
Definition at line 683 of file mitkBaseApplication.cpp.
void mitk::BaseApplication::printHelp | ( | const std::string & | name, |
const std::string & | value | ||
) |
Definition at line 342 of file mitkBaseApplication.cpp.
Referenced by defineOptions().
|
override |
Launches the BlueBerry framework and runs the default application or the one specified in the PROP_APPLICATION framework property.
Definition at line 820 of file mitkBaseApplication.cpp.
Referenced by main().
void mitk::BaseApplication::setApplicationName | ( | const QString & | name | ) |
Set the application name. Same as QCoreApplication::setApplicationName.
name | The application name. |
Definition at line 352 of file mitkBaseApplication.cpp.
Referenced by initializeQt(), and main().
void mitk::BaseApplication::setOrganizationDomain | ( | const QString & | name | ) |
Set the organization domain. Same as QCoreApplication::setOrganizationDomain.
name | The organization domain. |
Definition at line 386 of file mitkBaseApplication.cpp.
Referenced by initializeQt().
void mitk::BaseApplication::setOrganizationName | ( | const QString & | name | ) |
Set the organization name. Same as QCoreApplication::setOrganizationName.
name | The organization name. |
Definition at line 370 of file mitkBaseApplication.cpp.
Referenced by initializeQt(), and main().
void mitk::BaseApplication::setPreloadLibraries | ( | const QStringList & | libraryBaseNames | ) |
Set a list of library names or absoulte file paths which should be loaded at application start-up. The name and file path may contain a library version appended at the end and separated by a '$' charactger.
For example liborg_mitk_gui_qt_common$1.0
. Platform specific suffixes are appended automatically.
libraryBaseNames | A list of library base names. |
Definition at line 429 of file mitkBaseApplication.cpp.
Referenced by main().
void mitk::BaseApplication::setProperty | ( | const QString & | property, |
const QVariant & | value | ||
) |
Definition at line 826 of file mitkBaseApplication.cpp.
Referenced by main().
void mitk::BaseApplication::setProvisioningFilePath | ( | const QString & | filePath | ) |
Set the path to the provisioning file.
By default a provisioning file located in the same directory as the executable and named <executable>.provisioning is loaded if it exists. To disable parsing of provisioning files, use an empty string as the argument. Use a null QString (QString::null
) to reset to the default behaviour.
filePath | An absolute file path to the provisioning file. |
Definition at line 435 of file mitkBaseApplication.cpp.
Referenced by main().
void mitk::BaseApplication::setSafeMode | ( | bool | safeMode | ) |
Put the application in safe mode, catching exceptions from the Qt event loop.
safeMode |
Definition at line 410 of file mitkBaseApplication.cpp.
References getSingleMode().
void mitk::BaseApplication::setSingleMode | ( | bool | singleMode | ) |
Put the application in single mode, which by default only allows a single instance of the application to be created.
Calling this method after run() has been called has no effect.
singleMode |
Definition at line 402 of file mitkBaseApplication.cpp.
Referenced by main().
|
overrideprotected |
Definition at line 565 of file mitkBaseApplication.cpp.
References getFramework().
|
static |
Definition at line 89 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 88 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 100 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 98 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 95 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 91 of file mitkBaseApplication.h.
|
static |
Definition at line 87 of file mitkBaseApplication.h.
Referenced by defineOptions(), and getCTKFrameworkStorageDir().
|
static |
Definition at line 105 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 104 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 93 of file mitkBaseApplication.h.
|
static |
Definition at line 94 of file mitkBaseApplication.h.
|
static |
Definition at line 96 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 90 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 97 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 106 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 108 of file mitkBaseApplication.h.
Referenced by defineOptions(), and initializeSplashScreen().
|
static |
Definition at line 92 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 102 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 101 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 110 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 121 of file mitkBaseApplication.h.
Referenced by defineOptions(), and main().
|
static |
Definition at line 115 of file mitkBaseApplication.h.
|
static |
Definition at line 114 of file mitkBaseApplication.h.
|
static |
Definition at line 117 of file mitkBaseApplication.h.
|
static |
Definition at line 116 of file mitkBaseApplication.h.
|
static |
Definition at line 120 of file mitkBaseApplication.h.
Referenced by defineOptions(), and main().
|
static |
Definition at line 118 of file mitkBaseApplication.h.
|
static |
Definition at line 123 of file mitkBaseApplication.h.
Referenced by defineOptions().
|
static |
Definition at line 122 of file mitkBaseApplication.h.
Referenced by defineOptions().