Line data Source code
1 : #include "Utilities.h"
2 :
3 : #include <QCoreApplication>
4 : #include <QDebug>
5 : #include <QThread>
6 :
7 0 : Utilities::Utilities()
8 : {
9 0 : }
10 :
11 0 : FeedItem *Utilities::feedItemFromRaw(const RawFeed *raw, qint64 dbId, const QString& userURL, QObject* parent)
12 : {
13 0 : FeedType feedType = FeedTypeRSS;
14 0 : if (raw->feedType == RawFeed::GoogleNewsSitemap) {
15 0 : feedType = FeedTypeGoogleNewsSitemap;
16 : }
17 :
18 : return new FeedItem(dbId,
19 : 0,
20 0 : raw->title,
21 0 : raw->subtitle,
22 0 : raw->lastUpdated,
23 0 : raw->minutesToUpdate,
24 0 : raw->url,
25 0 : raw->siteURL,
26 : userURL,
27 0 : raw->imageURL,
28 0 : QDateTime(),
29 : -1,
30 : true,
31 : feedType,
32 : parent
33 0 : );
34 : }
35 :
36 0 : QString Utilities::commaSeparatedStringList(const QVector<qint64> input)
37 : {
38 0 : QString output;
39 0 : int size = input.size();
40 0 : for(int i = 0; i < size; i++) {
41 0 : output += QString::number(input.at(i));
42 :
43 0 : if (i != size - 1) {
44 0 : output += ", ";
45 : }
46 : }
47 :
48 0 : return output;
49 0 : }
50 :
51 0 : bool Utilities::isInMainThread()
52 : {
53 0 : return QCoreApplication::instance()->thread() == QThread::currentThread();
54 : }
|