-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
projectproperties.cpp
42 lines (33 loc) · 1001 Bytes
/
projectproperties.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <QDomElement>
#include <QDomDocument>
#include "projectproperties.h"
QDomElement ProjectProperties::toDomElement(QDomDocument &doc) const
{
QDomElement props = doc.createElement("properties");
QDomElement t = doc.createElement("title");
QDomText tval = doc.createTextNode(this->title);
t.appendChild(tval);
QDomElement n = doc.createElement("note");
QDomText nval = doc.createTextNode(this->note);
n.appendChild(nval);
props.appendChild(t);
props.appendChild(n);
return props;
}
void ProjectProperties::fromDomElement(const QDomElement &el)
{
QDomNodeList titles = el.elementsByTagName("title");
if (!titles.isEmpty()) {
QDomElement t = titles.at(0).toElement();
title = t.text();
}
QDomNodeList notes = el.elementsByTagName("note");
if (!notes.isEmpty()) {
QDomElement n = notes.at(0).toElement();
note = n.text();
}
}
void ProjectProperties::clear() {
title = "";
note = "";
}