-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrssitem.cpp
More file actions
90 lines (71 loc) · 2.43 KB
/
rssitem.cpp
File metadata and controls
90 lines (71 loc) · 2.43 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
/*
Copyright 2014-2015 Vanniktech - Niklas Baudy
This file is part of SpeedReader.
SpeedReader is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
SpeedReader is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SpeedReader. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rssitem.h"
#include <QVariant>
RSSItem::RSSItem(QUuid rssItemId, QString title, QString description, QString link, QString imageLocal, QString imageInternet, QDateTime date, bool speedRead) {
mRSSItemId = rssItemId;
mTitle = title;
mDescription = description;
mLink = link;
mImageLocal = imageLocal;
mImageInternet = imageInternet;
mDate = date;
mSpeedRead = speedRead;
if (!mImageLocal.isEmpty()) mImage = QImage(mImageLocal);
}
RSSItem::RSSItem(QSqlQuery sqlQuery) {
mRSSItemId = sqlQuery.value("rss_item_id").value<QUuid>();
mTitle = sqlQuery.value("title").value<QString>();
mDescription = sqlQuery.value("description").value<QString>();
mLink = sqlQuery.value("link").value<QString>();
mImageLocal = sqlQuery.value("image_local").value<QString>();
mImageInternet = sqlQuery.value("image_internet").value<QString>();
mDate = QDateTime::fromTime_t(sqlQuery.value("date").value<uint>());
mSpeedRead = sqlQuery.value("speedread").value<bool>();
if (!mImageLocal.isEmpty()) mImage = QImage(mImageLocal);
}
QUuid RSSItem::getRSSItemId() {
return mRSSItemId;
}
QString RSSItem::getTitle() {
return mTitle;
}
QString RSSItem::getDescription() {
return mDescription;
}
QString RSSItem::getLink() {
return mLink;
}
QString RSSItem::getImageLocal() {
return mImageLocal;
}
QString RSSItem::getImageInternet() {
return mImageInternet;
}
QImage RSSItem::getImage() {
return mImage;
}
QDateTime RSSItem::getDate() {
return mDate;
}
bool RSSItem::isSpeedRead() {
return mSpeedRead;
}
void RSSItem::setSpeedRead(bool speedread) {
mSpeedRead = speedread;
}
void RSSItem::flipSpeedRead() {
mSpeedRead = !mSpeedRead;
}