Fraxinus  18.10
An IGT application
cxFilePathProperty.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 
12 #ifndef CXFILEPATHPROPERTY_H
13 #define CXFILEPATHPROPERTY_H
14 
15 #include "cxResourceExport.h"
16 
17 #include <QDomElement>
18 #include <QStringList>
19 #include "cxStringPropertyBase.h"
20 #include "cxXmlOptionItem.h"
21 
22 namespace cx
23 {
24 
25 
35 class cxResource_EXPORT EmbeddedFilepath
36 {
37 public:
38  void appendRootPath(QString path);
39  void setFilepath(QString filename);
40 
41  QString getRelativeFilepath() const;
42  QString getAbsoluteFilepath() const;
43  bool exists() const;
44  QString getRootPath() const;
45  QStringList getRootPaths() const;
46 
47 private:
48  void evaluate(QString* foundRoot, bool* found, QString* foundRelative, QString* foundAbsolute) const;
49  QStringList mRoots;
50  QString mFilePath;
51 };
52 
53 typedef boost::shared_ptr<class FilePathProperty> FilePathPropertyPtr;
54 
58 class cxResource_EXPORT FilePathProperty: public Property
59 {
60 Q_OBJECT
61 public:
65  static FilePathPropertyPtr initialize(const QString& uid, QString name, QString help, QString value,
66  QStringList paths, QDomNode root = QDomNode());
67 
68 public:
69  // inherited interface
70  virtual QString getDisplayName() const;
71  virtual QString getUid() const;
72 
73  virtual QVariant getValueAsVariant() const;
74  virtual void setValueFromVariant(QVariant val);
75 
76  virtual bool setValue(const QString& value);
77  virtual QString getValue() const;
78  virtual QString getHelp() const;
79  virtual void setHelp(QString val);
80 
81  EmbeddedFilepath getEmbeddedPath();
82 
83 signals:
84  void valueWasSet();
85 
86 private:
88  QString mName;
89  QString mUid;
90  QString mHelp;
91  EmbeddedFilepath mFilePath;
92  XmlOptionItem mStore;
93 };
94 
95 
96 } // namespace cx
97 
98 #endif // CXFILEPATHPROPERTY_H
Superclass for all data adapters.
Definition: cxProperty.h:43
Helper class for storing one string value in an xml document.
boost::shared_ptr< class FilePathProperty > FilePathPropertyPtr
Namespace for all CustusX production code.