Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryPlatform.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
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 
18 #include "berryPlatform.h"
19 
20 #include <berryIProduct.h>
21 
22 #include "internal/berryInternalPlatform.h"
23 #include "internal/berryIRuntimeConstants.h"
24 
25 #include <service/datalocation/ctkLocation.h>
26 
27 namespace berry {
28 
29 const QString Platform::PI_RUNTIME = IRuntimeConstants::PI_RUNTIME();
30 
32 const int Platform::OS_AIX = BERRY_OS_AIX;
41 const int Platform::OS_QNX = BERRY_OS_QNX;
47 const int Platform::OS_VMS = BERRY_OS_VMS;
48 
59 
60 const QString Platform::PROP_QTPLUGIN_PATH = "BlueBerry.qtplugin_path";
61 
62 const QString Platform::PROP_NEWINSTANCE = "BlueBerry.newInstance";
63 const QString Platform::PROP_APPLICATION = "BlueBerry.application";
64 const QString Platform::PROP_PLUGIN_DIRS = "BlueBerry.plugin_dirs";
65 const QString Platform::PROP_FORCE_PLUGIN_INSTALL = "BlueBerry.forcePlugins";
66 
67 const QString Platform::PROP_TESTPLUGIN = "BlueBerry.testplugin";
68 const QString Platform::PROP_TESTAPPLICATION = "BlueBerry.testapplication";
69 
70 const QString Platform::PROP_IGNOREAPP = "BlueBerry.ignoreApp";
71 
72 const QString Platform::PROP_XARGS = "xargs";
73 
74 
76 {
77  ctkLocation* location = GetConfigurationLocation();
78  if (location)
79  {
80  return location->getUrl().toLocalFile();
81  }
82  return QDir();
83 }
84 
86 {
87  return InternalPlatform::GetInstance()->GetConfigurationLocation();
88 }
89 
91 {
92  return InternalPlatform::GetInstance()->GetAdapterManager();
93 }
94 
96 {
97  return InternalPlatform::GetInstance()->GetExtensionRegistry();
98 }
99 
101 {
102  return InternalPlatform::GetInstance()->GetPreferencesService();
103 }
104 
105 //PlatformEvents& Platform::GetEvents()
106 //{
107 // return InternalPlatform::GetInstance()->GetEvents();
108 //}
109 
111 {
112  ctkLocation* location = GetInstallLocation();
113  if (location)
114  {
115  return location->getUrl().toLocalFile();
116  }
117  return QDir();
118 }
119 
121 {
122  return InternalPlatform::GetInstance()->GetInstallLocation();
123 }
124 
126 {
127  ctkLocation* location = GetInstanceLocation();
128  if (location)
129  {
130  return location->getUrl().toLocalFile();
131  }
132  return QDir();
133 
134 }
135 
137 {
138  return InternalPlatform::GetInstance()->GetInstanceLocation();
139 }
140 
142 {
143  return BERRY_OS;
144 }
145 
147 {
148  return BERRY_ARCH;
149 }
150 
152 {
153 #ifdef BERRY_OS_FAMILY_UNIX
154  return true;
155 #else
156  return false;
157 #endif
158 }
159 
161 {
162 #ifdef BERRY_OS_FAMILY_WINDOWS
163  return true;
164 #else
165  return false;
166 #endif
167 }
168 
170 {
171 #ifdef BERRY_OS_FAMILY_BSD
172  return true;
173 #else
174  return false;
175 #endif
176 }
177 
179 {
180 #ifdef BERRY_OS_FAMILY_LINUX
181  return true;
182 #else
183  return false;
184 #endif
185 }
186 
188 {
189 #ifdef BERRY_OS_FAMILY_VMS
190  return true;
191 #else
192  return false;
193 #endif
194 }
195 
196 bool Platform::GetStatePath(QDir& statePath, const QSharedPointer<ctkPlugin>& plugin, bool /*create*/)
197 {
198  statePath = GetStateLocation(plugin);
199  return true;
200 }
201 
203 {
204  return InternalPlatform::GetInstance()->GetStateLocation(plugin);
205 }
206 
208 {
209  ctkLocation* location = GetUserLocation();
210  if (location)
211  {
212  return location->getUrl().toLocalFile();
213  }
214  return QDir();
215 
216 }
217 
219 {
220  return InternalPlatform::GetInstance()->GetUserLocation();
221 }
222 
224 {
225  return InternalPlatform::GetInstance()->IsRunning();
226 }
227 
229 {
230  return InternalPlatform::GetInstance()->GetApplicationArgs();
231 }
232 
233 QSharedPointer<ctkPlugin> Platform::GetPlugin(const QString& symbolicName)
234 {
235  return InternalPlatform::GetInstance()->GetPlugin(symbolicName);
236 }
237 
238 QList<QSharedPointer<ctkPlugin> > Platform::GetPlugins(const QString& symbolicName,
239  const QString& version)
240 {
241  return InternalPlatform::GetInstance()->GetPlugins(symbolicName, version);
242 }
243 
244 QVariant berry::Platform::GetDebugOption(const QString& option)
245 {
246  return InternalPlatform::GetInstance()->GetOption(option);
247 }
248 
250 {
251  return InternalPlatform::GetInstance()->GetProduct();
252 }
253 
254 }
static QT_DEPRECATED QDir GetInstancePath()
static const int OS_IRIX
static QStringList GetApplicationArgs()
static const int OS_UNKNOWN_UNIX
#define BERRY_ARCH_IA32
static const int ARCH_PPC
static QT_DEPRECATED QDir GetInstallPath()
static const int OS_VMS
static QT_DEPRECATED bool GetStatePath(QDir &statePath, const QSharedPointer< ctkPlugin > &plugin, bool create=true)
static const int OS_LINUX
static const int OS_FREE_BSD
static QDir GetStateLocation(const QSharedPointer< ctkPlugin > &plugin)
#define BERRY_ARCH_SPARC
#define BERRY_ARCH_PPC
static const QString PROP_NEWINSTANCE
static const int ARCH_MIPS
#define BERRY_OS_MAC_OS_X
Definition: berryPlatform.h:29
static ctkLocation * GetInstallLocation()
static bool IsUnix()
static const int OS_VXWORKS
static const QString PROP_TESTAPPLICATION
#define BERRY_OS_SOLARIS
Definition: berryPlatform.h:33
static bool IsBSD()
static bool IsWindows()
static QList< QSharedPointer< ctkPlugin > > GetPlugins(const QString &symbolicName, const QString &version=QString())
#define BERRY_ARCH_ALPHA
#define BERRY_OS_UNKNOWN_UNIX
Definition: berryPlatform.h:37
static const int OS_AIX
static const int OS_HPUX
#define BERRY_OS_AIX
Definition: berryPlatform.h:25
#define BERRY_ARCH_IA64
#define BERRY_OS_NET_BSD
Definition: berryPlatform.h:30
#define BERRY_OS_TRU64
Definition: berryPlatform.h:27
static const int OS_MAC_OS_X
static const QString PROP_TESTPLUGIN
#define BERRY_ARCH_MIPS
#define BERRY_OS_QNX
Definition: berryPlatform.h:34
#define BERRY_OS_VMS
Definition: berryPlatform.h:40
static ctkLocation * GetInstanceLocation()
static ctkLocation * GetUserLocation()
static const int ARCH_SPARC
#define BERRY_OS_VXWORKS
Definition: berryPlatform.h:35
static bool IsRunning()
static const int OS_WINDOWS_CE
static QT_DEPRECATED QDir GetUserPath()
static const int OS_OPEN_BSD
static IAdapterManager * GetAdapterManager()
static IExtensionRegistry * GetExtensionRegistry()
static const int ARCH_ALPHA
#define BERRY_OS_WINDOWS_NT
Definition: berryPlatform.h:38
#define BERRY_OS_LINUX
Definition: berryPlatform.h:28
#define BERRY_OS_HPUX
Definition: berryPlatform.h:26
#define BERRY_OS_CYGWIN
Definition: berryPlatform.h:36
static int GetOS()
static const QString PROP_APPLICATION
static const QString PI_RUNTIME
static SmartPointer< IProduct > GetProduct()
static const QString PROP_IGNOREAPP
static QSharedPointer< ctkPlugin > GetPlugin(const QString &symbolicName)
static bool IsLinux()
static const int ARCH_HPPA
static const int OS_QNX
static const QString PROP_PLUGIN_DIRS
static const QString PROP_FORCE_PLUGIN_INSTALL
static const int ARCH_IA64
static const int OS_NET_BSD
static ctkLocation * GetConfigurationLocation()
#define BERRY_OS_WINDOWS_CE
Definition: berryPlatform.h:39
static const QString PROP_XARGS
#define BERRY_ARCH_POWER
static const int OS_CYGWIN
#define BERRY_OS_FREE_BSD
Definition: berryPlatform.h:24
static QT_DEPRECATED QDir GetConfigurationPath()
static const QString PROP_QTPLUGIN_PATH
static const int ARCH_ARM
static const int ARCH_POWER
static const int OS_WINDOWS_NT
#define BERRY_ARCH_ARM
static bool IsVMS()
static const int ARCH_AMD64
#define BERRY_OS_IRIX
Definition: berryPlatform.h:32
static const int OS_TRU64
#define BERRY_OS_OPEN_BSD
Definition: berryPlatform.h:31
#define BERRY_ARCH_HPPA
static QVariant GetDebugOption(const QString &option)
#define BERRY_ARCH_AMD64
static const int OS_SOLARIS
static int GetOSArch()
static IPreferencesService * GetPreferencesService()
static const int ARCH_IA32