CustusX  2020.11.07-dev+develop.4ce4a
An IGT application
cxProfile.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXPROFILE_H
12 #define CXPROFILE_H
13 
14 #include "cxResourceExport.h"
15 
16 #include <QString>
17 #include <QObject>
18 #include "boost/shared_ptr.hpp"
19 
20 class QSettings;
21 
22 namespace cx
23 {
24 typedef boost::shared_ptr<class QSettings> QSettingsPtr;
25 typedef boost::shared_ptr<class Settings> SettingsPtr;
26 typedef boost::shared_ptr<class StringProperty> StringPropertyPtr;
27 
28 class XmlOptionFile;
29 class Settings;
30 
31 typedef boost::shared_ptr<class Profile> ProfilePtr;
32 
41 class cxResource_EXPORT Profile : public QObject
42 {
43 public:
44  Profile(QString path, SettingsPtr settings);
45  ~Profile();
46  void activate();
47 
51  XmlOptionFile getXmlSettings();
52 
56  Settings* getSettings() const;
57 
61  QString getName() const;
62 
66  QString getUid() const;
67 
71  QString getPath() const;
72 
77  QStringList getApplicationToolConfigPaths();
78 
82  QString getToolConfigFilePath();
83  void setToolConfigFilePath(QString path);
84 
88  QString getSettingsPath();
89 
95  QStringList getAllRootConfigPaths();
96 
100  QString getSessionRootFolder() const;
101  void setSessionRootFolder(QString path);
102 
103  QString getPatientTemplatePath();
104 private:
105  QString mPath;
106  SettingsPtr mSettings;
107  QString getSettingsFile();
108  QString getDefaultSessionRootFolder() const;
109 };
110 
115 class cxResource_EXPORT ProfileManager : public QObject
116 {
117  Q_OBJECT
118 public:
119  static ProfileManager* getInstance(QString defaultProfile = QString("Laboratory"));
120  static void initialize();
121  static void shutdown();
122 
123  QStringList getProfiles();
124 
125  ProfilePtr activeProfile();
126  void setActiveProfile(QString uid);
127 
131  QString getSettingsPath();
132 
133 signals:
134  void activeProfileChanged();
135 
136 private:
137  ProfileManager(QString defaultProfile);
138  ~ProfileManager();
139  static ProfileManager* mInstance;
140  ProfilePtr mActive;
141  QSettingsPtr getGenericSettings();
142 
143  SettingsPtr mSettings;
144 
145  QString getDefaultProfileUid(QString defaultProfile);
146  void profilesChanged();
147  QStringList getInstalledProfiles();
148  QStringList getCustomProfiles();
149  QStringList getProfilesInFolder(QString folder);
150 
151  QString getCustomPath();
152  void newProfile(QString uid);
153  void copyProfile(QString base, QString uid);
154  QString getPathForInstalled(QString uid);
155  QString getPathForCustom(QString uid);
156  void createCustomProfile(QString uid);
157 };
158 
159 cxResource_EXPORT ProfilePtr profile();
160 
161 
162 
163 } // namespace cx
164 
165 
166 #endif // CXPROFILE_H
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:160
boost::shared_ptr< class Settings > SettingsPtr
Definition: cxProfile.h:25
boost::shared_ptr< class StringProperty > StringPropertyPtr
Customized interface for setting values in QSettings.
Definition: cxSettings.h:37
boost::shared_ptr< class QSettings > QSettingsPtr
Definition: cxProfile.h:24
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:21
boost::shared_ptr< class Profile > ProfilePtr
Definition: cxProfile.h:29
Helper class for xml files used to store ssc/cx data.
Namespace for all CustusX production code.