Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
Medical Imaging Interaction Toolkit
berryPlatform.cpp
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 
14 #include "berryPlatform.h"
15 
16 #include <berryIProduct.h>
17 
18 #include "internal/berryInternalPlatform.h"
19 #include "internal/berryIRuntimeConstants.h"
20 
21 #include <service/datalocation/ctkLocation.h>
22 
23 namespace berry {
24 
25 const QString Platform::PI_RUNTIME = IRuntimeConstants::PI_RUNTIME();
26 
28 const int Platform::OS_AIX = BERRY_OS_AIX;
37 const int Platform::OS_QNX = BERRY_OS_QNX;
43 const int Platform::OS_VMS = BERRY_OS_VMS;
44 
55 
56 const QString Platform::PROP_QTPLUGIN_PATH = "BlueBerry.qtplugin_path";
57 
58 const QString Platform::PROP_NEWINSTANCE = "BlueBerry.newInstance";
59 const QString Platform::PROP_APPLICATION = "BlueBerry.application";
60 const QString Platform::PROP_PLUGIN_DIRS = "BlueBerry.plugin_dirs";
61 const QString Platform::PROP_FORCE_PLUGIN_INSTALL = "BlueBerry.forcePlugins";
62 
63 const QString Platform::PROP_IGNOREAPP = "BlueBerry.ignoreApp";
64 
65 const QString Platform::PROP_XARGS = "xargs";
66 
67 
69 {
70  ctkLocation* location = GetConfigurationLocation();
71  if (location)
72  {
73  return location->getUrl().toLocalFile();
74  }
75  return QDir();
76 }
77 
79 {
80  return InternalPlatform::GetInstance()->GetConfigurationLocation();
81 }
82 
84 {
85  return InternalPlatform::GetInstance()->GetAdapterManager();
86 }
87 
89 {
90  return InternalPlatform::GetInstance()->GetExtensionRegistry();
91 }
92 
94 {
95  return InternalPlatform::GetInstance()->GetPreferencesService();
96 }
97 
98 //PlatformEvents& Platform::GetEvents()
99 //{
100 // return InternalPlatform::GetInstance()->GetEvents();
101 //}
102 
104 {
105  ctkLocation* location = GetInstallLocation();
106  if (location)
107  {
108  return location->getUrl().toLocalFile();
109  }
110  return QDir();
111 }
112 
114 {
115  return InternalPlatform::GetInstance()->GetInstallLocation();
116 }
117 
119 {
120  ctkLocation* location = GetInstanceLocation();
121  if (location)
122  {
123  return location->getUrl().toLocalFile();
124  }
125  return QDir();
126 
127 }
128 
130 {
131  return InternalPlatform::GetInstance()->GetInstanceLocation();
132 }
133 
135 {
136  return BERRY_OS;
137 }
138 
140 {
141  return BERRY_ARCH;
142 }
143 
145 {
146 #ifdef BERRY_OS_FAMILY_UNIX
147  return true;
148 #else
149  return false;
150 #endif
151 }
152 
154 {
155 #ifdef BERRY_OS_FAMILY_WINDOWS
156  return true;
157 #else
158  return false;
159 #endif
160 }
161 
163 {
164 #ifdef BERRY_OS_FAMILY_BSD
165  return true;
166 #else
167  return false;
168 #endif
169 }
170 
172 {
173 #ifdef BERRY_OS_FAMILY_LINUX
174  return true;
175 #else
176  return false;
177 #endif
178 }
179 
181 {
182 #ifdef BERRY_OS_FAMILY_VMS
183  return true;
184 #else
185  return false;
186 #endif
187 }
188 
189 bool Platform::GetStatePath(QDir& statePath, const QSharedPointer<ctkPlugin>& plugin, bool /*create*/)
190 {
191  statePath = GetStateLocation(plugin);
192  return true;
193 }
194 
196 {
197  return InternalPlatform::GetInstance()->GetStateLocation(plugin);
198 }
199 
201 {
202  ctkLocation* location = GetUserLocation();
203  if (location)
204  {
205  return location->getUrl().toLocalFile();
206  }
207  return QDir();
208 
209 }
210 
212 {
213  return InternalPlatform::GetInstance()->GetUserLocation();
214 }
215 
217 {
218  return InternalPlatform::GetInstance()->IsRunning();
219 }
220 
222 {
223  return InternalPlatform::GetInstance()->GetApplicationArgs();
224 }
225 
226 QSharedPointer<ctkPlugin> Platform::GetPlugin(const QString& symbolicName)
227 {
228  return InternalPlatform::GetInstance()->GetPlugin(symbolicName);
229 }
230 
231 QList<QSharedPointer<ctkPlugin> > Platform::GetPlugins(const QString& symbolicName,
232  const QString& version)
233 {
234  return InternalPlatform::GetInstance()->GetPlugins(symbolicName, version);
235 }
236 
237 QVariant berry::Platform::GetDebugOption(const QString& option)
238 {
239  return InternalPlatform::GetInstance()->GetOption(option);
240 }
241 
243 {
244  return InternalPlatform::GetInstance()->GetProduct();
245 }
246 
247 }
static QT_DEPRECATED QDir GetInstancePath()
static const int OS_IRIX
static QStringList GetApplicationArgs()
static const int OS_UNKNOWN_UNIX
#define BERRY_ARCH_IA32
Definition: berryPlatform.h:98
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:25
static ctkLocation * GetInstallLocation()
static bool IsUnix()
static const int OS_VXWORKS
#define BERRY_OS_SOLARIS
Definition: berryPlatform.h:29
static bool IsBSD()
static bool IsWindows()
static QList< QSharedPointer< ctkPlugin > > GetPlugins(const QString &symbolicName, const QString &version=QString())
#define BERRY_ARCH_ALPHA
Definition: berryPlatform.h:97
#define BERRY_OS_UNKNOWN_UNIX
Definition: berryPlatform.h:33
static const int OS_AIX
static const int OS_HPUX
#define BERRY_OS_AIX
Definition: berryPlatform.h:21
#define BERRY_ARCH_IA64
Definition: berryPlatform.h:99
#define BERRY_OS_NET_BSD
Definition: berryPlatform.h:26
#define BERRY_OS_TRU64
Definition: berryPlatform.h:23
static const int OS_MAC_OS_X
#define BERRY_ARCH_MIPS
#define BERRY_OS_QNX
Definition: berryPlatform.h:30
#define BERRY_OS_VMS
Definition: berryPlatform.h:36
static ctkLocation * GetInstanceLocation()
static ctkLocation * GetUserLocation()
static const int ARCH_SPARC
#define BERRY_OS_VXWORKS
Definition: berryPlatform.h:31
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:34
#define BERRY_OS_LINUX
Definition: berryPlatform.h:24
#define BERRY_OS_HPUX
Definition: berryPlatform.h:22
#define BERRY_OS_CYGWIN
Definition: berryPlatform.h:32
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:35
static const QString PROP_XARGS
#define BERRY_ARCH_POWER
static const int OS_CYGWIN
#define BERRY_OS_FREE_BSD
Definition: berryPlatform.h:20
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:28
static const int OS_TRU64
#define BERRY_OS_OPEN_BSD
Definition: berryPlatform.h:27
#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