-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathThreadObject.cpp
106 lines (84 loc) · 2.25 KB
/
ThreadObject.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "ThreadObject.h"
#include <QVariant>
#include <QDebug>
ThreadObject::ThreadObject(const QJsonObject &threadObj, QObject *parent)
:
QObject(parent),
mNum(threadObj[QLatin1String("num")].toVariant().toInt()),
mPostsCount(threadObj[QLatin1String("posts_count")].toInt()),
mComment(threadObj[QLatin1String("comment")].toString().remove(QLatin1String("\\r\\n"))),
mSubject(threadObj[QLatin1String("subject")].toString()),
mTimeStamp(QDateTime::fromTime_t(threadObj[QLatin1String("timestamp")].toVariant().toUInt())),
mLasthit(QDateTime::fromTime_t(threadObj[QLatin1String("lasthit")].toVariant().toUInt())),
mFiles(Attachment::makeAttachmentList(threadObj[QLatin1String("files")].toArray(), this))
{
}
ThreadObject::~ThreadObject() {
qDeleteAll(mFiles);
mFiles.clear();
}
int ThreadObject::num() const {
return mNum;
}
void ThreadObject::setNum(int value) {
if (mNum != value) {
mNum = value;
emit numChanged();
}
}
int ThreadObject::postsCount() const {
return mPostsCount;
}
void ThreadObject::setPostsCount(int value) {
if (mPostsCount != value) {
mPostsCount = value;
emit postsCountChanged();
}
}
QString ThreadObject::comment() const {
return mComment;
}
void ThreadObject::setComment(const QString &value) {
if (mComment != value) {
mComment = value;
emit commentChanged();
}
}
QString ThreadObject::subject() const {
return mSubject;
}
void ThreadObject::setSubject(const QString &value) {
if (mSubject != value) {
mSubject = value;
emit subjectChanged();
}
}
QDateTime ThreadObject::timeStamp() const {
return mTimeStamp;
}
void ThreadObject::setTimeStamp(QDateTime value) {
if (mTimeStamp != value) {
mTimeStamp = value;
emit timeStampChanged();
}
}
QDateTime ThreadObject::lasthit() const {
return mLasthit;
}
void ThreadObject::setLasthit(QDateTime value) {
if (mLasthit != value) {
mLasthit = value;
emit lasthitChanged();
}
}
AttachmentList ThreadObject::files() const
{
return mFiles;
}
void ThreadObject::setFiles(const AttachmentList &value)
{
if (mFiles != value) {
mFiles = value;
emit filesChanged();
}
}