This repository was archived by the owner on Feb 16, 2021. It is now read-only.
forked from pinkierton/harkach
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostObject.cpp
More file actions
190 lines (170 loc) · 4.33 KB
/
PostObject.cpp
File metadata and controls
190 lines (170 loc) · 4.33 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#include "PostObject.h"
#include <QDebug>
PostObject::PostObject(QObject *parent) : QObject(parent)
{
}
PostObject::PostObject(const QJsonObject &postObj, QObject *parent)
:
QObject(parent),
mBanned(static_cast<bool>(postObj[QLatin1String("banned")].toInt())),
mClosed(static_cast<bool>(postObj[QLatin1String("closed")].toInt())),
mComment(postObj[QLatin1String("comment")].toString()),
mDate(postObj[QLatin1String("date")].toString()),
mEmail(postObj[QLatin1String("email")].toString()),
mFiles(Attachment::makeObjectList(postObj[QLatin1String("files")].toArray())),
mLasthit(QDateTime::fromTime_t(postObj[QLatin1String("lasthit")].toVariant().toUInt())),
mName(postObj[QLatin1String("name")].toString()),
mNum(postObj[QLatin1String("num")].toVariant().toInt()),
mOp(static_cast<bool>(postObj[QLatin1String("op")].toInt())),
mParent(postObj[QLatin1String("parent")].toVariant().toInt()),
mSticky(static_cast<bool>(postObj[QLatin1String("sticky")].toInt())),
mSubject(postObj[QLatin1String("subject")].toString()),
mTimestamp(QDateTime::fromTime_t(postObj[QLatin1String("timestamp")].toVariant().toUInt())),
mTrip(postObj[QLatin1String("trip")].toString()),
mTripType(postObj[QLatin1String("trip_type")].toString())
{
}
bool PostObject::banned() const {
return mBanned;
}
void PostObject::setBanned(bool value) {
if (mBanned != value) {
mBanned = value;
emit bannedChanged();
}
}
bool PostObject::closed() const {
return mClosed;
}
void PostObject::setClosed(bool value) {
if (mClosed != value) {
mClosed = value;
emit closedChanged();
}
}
QString PostObject::comment() const {
return mComment;
}
void PostObject::setComment(const QString &value) {
if (mComment != value) {
mComment = value;
emit commentChanged();
}
}
QString PostObject::date() const {
return mDate;
}
void PostObject::setDate(const QString &value) {
if (mDate != value) {
mDate = value;
emit dateChanged();
}
}
QString PostObject::email() const {
return mEmail;
}
void PostObject::setEmail(const QString &value) {
if (mEmail != value) {
mEmail = value;
emit emailChanged();
}
}
QObjectList PostObject::files() const {
return mFiles;
}
void PostObject::setFiles(QObjectList value) {
if (mFiles != value) {
mFiles = value;
emit filesChanged();
}
}
QDateTime PostObject::lasthit() const {
return mLasthit;
}
void PostObject::setLasthit(QDateTime value) {
if (mLasthit != value) {
mLasthit = value;
emit lasthitChanged();
}
}
QString PostObject::name() const {
return mName;
}
void PostObject::setName(const QString &value) {
if (mName != value) {
mName = value;
emit nameChanged();
}
}
int PostObject::num() const {
return mNum;
}
void PostObject::setNum(int value) {
if (mNum != value) {
mNum = value;
emit numChanged();
}
}
bool PostObject::op() const {
return mOp;
}
void PostObject::setOp(bool value) {
if (mOp != value) {
mOp = value;
emit opChanged();
}
}
int PostObject::parent() const {
return mParent;
}
void PostObject::setParent(int value) {
if (mParent != value) {
mParent = value;
emit parentChanged();
}
}
bool PostObject::sticky() const {
return mSticky;
}
void PostObject::setSticky(bool value) {
if (mSticky != value) {
mSticky = value;
emit stickyChanged();
}
}
QString PostObject::subject() const {
return mSubject;
}
void PostObject::setSubject(const QString &value) {
if (mSubject != value) {
mSubject = value;
emit subjectChanged();
}
}
QDateTime PostObject::timestamp() const {
return mTimestamp;
}
void PostObject::setTimestamp(QDateTime value) {
if (mTimestamp != value) {
mTimestamp = value;
emit timestampChanged();
}
}
QString PostObject::trip() const {
return mTrip;
}
void PostObject::setTrip(const QString &value) {
if (mTrip != value) {
mTrip = value;
emit tripChanged();
}
}
QString PostObject::tripType() const {
return mTripType;
}
void PostObject::setTripType(const QString &value) {
if (mTripType != value) {
mTripType = value;
emit tripTypeChanged();
}
}