qBittorrent
rss_article.h
Go to the documentation of this file.
1 /*
2  * Bittorrent Client using Qt and libtorrent.
3  * Copyright (C) 2017 Vladimir Golovnev <[email protected]>
4  * Copyright (C) 2010 Christophe Dumez <[email protected]>
5  * Copyright (C) 2010 Arnaud Demaiziere <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * In addition, as a special exception, the copyright holders give permission to
22  * link this program with the OpenSSL project's "OpenSSL" library (or with
23  * modified versions of it that use the same license as the "OpenSSL" library),
24  * and distribute the linked executables. You must obey the GNU General Public
25  * License in all respects for all of the code used other than "OpenSSL". If you
26  * modify file(s), you may extend this exception to your version of the file(s),
27  * but you are not obligated to do so. If you do not wish to do so, delete this
28  * exception statement from your version.
29  */
30 
31 #pragma once
32 
33 #include <QDateTime>
34 #include <QObject>
35 #include <QString>
36 #include <QVariantHash>
37 
38 namespace RSS
39 {
40  class Feed;
41 
42  class Article : public QObject
43  {
44  Q_OBJECT
45  Q_DISABLE_COPY_MOVE(Article)
46 
47  friend class Feed;
48 
49  Article(Feed *feed, const QVariantHash &varHash);
50  Article(Feed *feed, const QJsonObject &jsonObj);
51 
52  public:
53  static const QString KeyId;
54  static const QString KeyDate;
55  static const QString KeyTitle;
56  static const QString KeyAuthor;
57  static const QString KeyDescription;
58  static const QString KeyTorrentURL;
59  static const QString KeyLink;
60  static const QString KeyIsRead;
61 
62  Feed *feed() const;
63  QString guid() const;
64  QDateTime date() const;
65  QString title() const;
66  QString author() const;
67  QString description() const;
68  QString torrentUrl() const;
69  QString link() const;
70  bool isRead() const;
71  QVariantHash data() const;
72 
73  void markAsRead();
74 
75  QJsonObject toJsonObject() const;
76 
77  static bool articleDateRecentThan(const Article *article, const QDateTime &date);
78 
79  signals:
80  void read(Article *article = nullptr);
81 
82  private:
83  Feed *m_feed = nullptr;
84  QString m_guid;
85  QDateTime m_date;
86  QString m_title;
87  QString m_author;
88  QString m_description;
89  QString m_torrentURL;
90  QString m_link;
91  bool m_isRead = false;
92  QVariantHash m_data;
93  };
94 }
Definition: rss_article.h:43
QDateTime m_date
Definition: rss_article.h:85
Feed * m_feed
Definition: rss_article.h:83
QString m_link
Definition: rss_article.h:90
QString m_description
Definition: rss_article.h:88
QString m_title
Definition: rss_article.h:86
static const QString KeyIsRead
Definition: rss_article.h:60
static const QString KeyAuthor
Definition: rss_article.h:56
static const QString KeyDate
Definition: rss_article.h:54
QJsonObject toJsonObject() const
QString guid() const
Definition: rss_article.cpp:82
void read(Article *article=nullptr)
static bool articleDateRecentThan(const Article *article, const QDateTime &date)
QString m_guid
Definition: rss_article.h:84
static const QString KeyDescription
Definition: rss_article.h:57
QVariantHash m_data
Definition: rss_article.h:92
void markAsRead()
QString torrentUrl() const
QString link() const
static const QString KeyLink
Definition: rss_article.h:59
bool m_isRead
Definition: rss_article.h:91
QString title() const
Definition: rss_article.cpp:92
QString m_author
Definition: rss_article.h:87
static const QString KeyId
Definition: rss_article.h:53
QString author() const
Definition: rss_article.cpp:97
static const QString KeyTitle
Definition: rss_article.h:55
static const QString KeyTorrentURL
Definition: rss_article.h:58
QString description() const
QVariantHash data() const
Feed * feed() const
QDateTime date() const
Definition: rss_article.cpp:87
bool isRead() const
QString m_torrentURL
Definition: rss_article.h:89