NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxFilePathProperty.cpp
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 #include "cxFilePathProperty.h"
13 
14 #include <iostream>
15 #include <QDomElement>
16 #include <QStringList>
17 #include "cxTypeConversions.h"
18 #include "cxLogger.h"
19 
20 namespace cx
21 {
22 
24 {
25 
26 }
27 
31 FilePathPropertyPtr FilePathProperty::initialize(const QString& uid, QString name, QString help, QString value, QStringList paths, QDomNode root)
32 {
34  retval->mUid = uid;
35  retval->mName = name.isEmpty() ? uid : name;
36  retval->mHelp = help;
37  retval->mFilePath.setFilepath(value);
38  foreach (QString path, paths)
39  retval->mFilePath.appendRootPath(path);
40  retval->mStore = XmlOptionItem(uid, root.toElement());
41  retval->mFilePath.setFilepath(retval->mStore.readValue(value));
42  return retval;
43 }
44 
45 QString FilePathProperty::getUid() const
46 {
47  return mUid;
48 }
49 
51 {
52  return mHelp;
53 }
54 
55 void FilePathProperty::setHelp(QString val)
56 {
57  if (val == mHelp)
58  return;
59 
60  mHelp = val;
61  emit changed();
62 }
63 
65 {
66  return this->getValue();
67 }
68 
70 {
71  this->setValue(val.toString());
72 }
73 
74 } // namespace cx
cxLogger.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cxFilePathProperty.h
cx::FilePathProperty::initialize
static FilePathPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList paths, QDomNode root=QDomNode())
Definition: cxFilePathProperty.cpp:31
cx::FilePathPropertyPtr
boost::shared_ptr< class FilePathProperty > FilePathPropertyPtr
Definition: cxPlusConnectWidget.h:28
cx::FilePathProperty::setValueFromVariant
virtual void setValueFromVariant(QVariant val)
Definition: cxFilePathProperty.cpp:69
cx::FilePathProperty::getHelp
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
Definition: cxFilePathProperty.cpp:50
cx::XmlOptionItem
Helper class for storing one string value in an xml document.
Definition: cxXmlOptionItem.h:38
cx::FilePathPropertyBase::getValue
virtual QString getValue() const
Definition: cxFilePathPropertyBase.cpp:112
cxTypeConversions.h
cx::FilePathProperty::setHelp
virtual void setHelp(QString val)
Definition: cxFilePathProperty.cpp:55
cx::FilePathPropertyBase::mHelp
QString mHelp
Definition: cxFilePathPropertyBase.h:88
cx::FilePathProperty::getValueAsVariant
virtual QVariant getValueAsVariant() const
Definition: cxFilePathProperty.cpp:64
cx::FilePathPropertyBase::setValue
virtual bool setValue(const QString &value)
Definition: cxFilePathPropertyBase.cpp:117
cx::FilePathPropertyBase::mUid
QString mUid
Definition: cxFilePathPropertyBase.h:87
cx::FilePathProperty::getUid
virtual QString getUid() const
Definition: cxFilePathProperty.cpp:45
cx::FilePathProperty::FilePathProperty
FilePathProperty()
Definition: cxFilePathProperty.cpp:23