mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 13:11:25 -07:00
parent
7d97905716
commit
a2121f2483
8 changed files with 94 additions and 96 deletions
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "rss_article.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QVariant>
|
||||
|
||||
#include "base/global.h"
|
||||
|
@ -38,19 +37,6 @@
|
|||
|
||||
using namespace RSS;
|
||||
|
||||
namespace
|
||||
{
|
||||
QVariantHash articleDataFromJSON(const QJsonObject &jsonObj)
|
||||
{
|
||||
auto varHash = jsonObj.toVariantHash();
|
||||
// JSON object store DateTime as string so we need to convert it
|
||||
varHash[Article::KeyDate] =
|
||||
QDateTime::fromString(jsonObj.value(Article::KeyDate).toString(), Qt::RFC2822Date);
|
||||
|
||||
return varHash;
|
||||
}
|
||||
}
|
||||
|
||||
const QString Article::KeyId = u"id"_qs;
|
||||
const QString Article::KeyDate = u"date"_qs;
|
||||
const QString Article::KeyTitle = u"title"_qs;
|
||||
|
@ -75,11 +61,6 @@ Article::Article(Feed *feed, const QVariantHash &varHash)
|
|||
{
|
||||
}
|
||||
|
||||
Article::Article(Feed *feed, const QJsonObject &jsonObj)
|
||||
: Article(feed, articleDataFromJSON(jsonObj))
|
||||
{
|
||||
}
|
||||
|
||||
QString Article::guid() const
|
||||
{
|
||||
return m_guid;
|
||||
|
@ -135,15 +116,6 @@ void Article::markAsRead()
|
|||
}
|
||||
}
|
||||
|
||||
QJsonObject Article::toJsonObject() const
|
||||
{
|
||||
auto jsonObj = QJsonObject::fromVariantHash(m_data);
|
||||
// JSON object doesn't support DateTime so we need to convert it
|
||||
jsonObj[KeyDate] = m_date.toString(Qt::RFC2822Date);
|
||||
|
||||
return jsonObj;
|
||||
}
|
||||
|
||||
bool Article::articleDateRecentThan(const Article *article, const QDateTime &date)
|
||||
{
|
||||
return article->date() > date;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue