NorMIT-nav  2023.01.05-dev+develop.0da12
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  QSettingsPtr getGenericSettingsFromInstaller();
143 
144  SettingsPtr mSettings;
145 
146  QString getDefaultProfileUid(QString defaultProfile);
147  void profilesChanged();
148  QStringList getInstalledProfiles();
149  QStringList getCustomProfiles();
150  QStringList getProfilesInFolder(QString folder);
151 
152  QString getCustomPath();
153  void newProfile(QString uid);
154  void copyProfile(QString base, QString uid);
155  QString getPathForInstalled(QString uid);
156  QString getPathForCustom(QString uid);
157  void createCustomProfile(QString uid);
158 };
159 
160 cxResource_EXPORT ProfilePtr profile();
161 
162 
163 
164 } // namespace cx
165 
166 
167 #endif // CXPROFILE_H
cx::XmlOptionFile
Helper class for xml files used to store ssc/cx data.
Definition: cxXmlOptionItem.h:78
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::StringPropertyPtr
boost::shared_ptr< class StringProperty > StringPropertyPtr
Definition: cxVideoConnectionWidget.h:42
cx::ProfileManager
Definition: cxProfile.h:115
cx::Settings
Customized interface for setting values in QSettings.
Definition: cxSettings.h:37
cx::profile
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:160
cx::Profile
Definition: cxProfile.h:41
cx::ProfilePtr
boost::shared_ptr< class Profile > ProfilePtr
Definition: cxProfile.h:29
cx::SettingsPtr
boost::shared_ptr< class Settings > SettingsPtr
Definition: cxProfile.h:25
cx::QSettingsPtr
boost::shared_ptr< class QSettings > QSettingsPtr
Definition: cxProfile.h:24
cx::settings
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:21