mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 03:39:39 +03:00
Move base RSS code to Core.
This commit is contained in:
parent
db459b2400
commit
405b06319d
24 changed files with 68 additions and 68 deletions
|
@ -36,6 +36,14 @@ HEADERS += \
|
|||
$$PWD/bittorrent/private/bandwidthscheduler.h \
|
||||
$$PWD/bittorrent/private/filterparserthread.h \
|
||||
$$PWD/bittorrent/private/statistics.h \
|
||||
$$PWD/rss/rssmanager.h \
|
||||
$$PWD/rss/rssfeed.h \
|
||||
$$PWD/rss/rssfolder.h \
|
||||
$$PWD/rss/rssfile.h \
|
||||
$$PWD/rss/rssarticle.h \
|
||||
$$PWD/rss/rssdownloadrule.h \
|
||||
$$PWD/rss/rssdownloadrulelist.h \
|
||||
$$PWD/rss/rssparser.h \
|
||||
$$PWD/utils/fs.h \
|
||||
$$PWD/utils/gzip.h \
|
||||
$$PWD/utils/misc.h \
|
||||
|
@ -79,6 +87,14 @@ SOURCES += \
|
|||
$$PWD/bittorrent/private/bandwidthscheduler.cpp \
|
||||
$$PWD/bittorrent/private/filterparserthread.cpp \
|
||||
$$PWD/bittorrent/private/statistics.cpp \
|
||||
$$PWD/rss/rssmanager.cpp \
|
||||
$$PWD/rss/rssfeed.cpp \
|
||||
$$PWD/rss/rssfolder.cpp \
|
||||
$$PWD/rss/rssarticle.cpp \
|
||||
$$PWD/rss/rssdownloadrule.cpp \
|
||||
$$PWD/rss/rssdownloadrulelist.cpp \
|
||||
$$PWD/rss/rssfile.cpp \
|
||||
$$PWD/rss/rssparser.cpp \
|
||||
$$PWD/utils/fs.cpp \
|
||||
$$PWD/utils/gzip.cpp \
|
||||
$$PWD/utils/misc.cpp \
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include <QDebug>
|
||||
#include <iostream>
|
||||
|
||||
#include "rssarticle.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
|
||||
// public constructor
|
||||
RssArticle::RssArticle(RssFeed* parent, const QString& guid):
|
|
@ -32,11 +32,11 @@
|
|||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
#include "rssdownloadrule.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "rssdownloadrule.h"
|
||||
|
||||
RssDownloadRule::RssDownloadRule(): m_enabled(false), m_useRegex(false), m_apstate(USE_GLOBAL)
|
||||
{
|
|
@ -32,9 +32,9 @@
|
|||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/qinisettings.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
|
||||
RssDownloadRuleList::RssDownloadRuleList()
|
||||
{
|
|
@ -29,21 +29,22 @@
|
|||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include "rssfeed.h"
|
||||
#include "rssmanager.h"
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/magneturi.h"
|
||||
#include "rssfolder.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/qinisettings.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssparser.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/logger.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssparser.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
|
||||
bool rssArticleDateRecentThan(const RssArticlePtr& left, const RssArticlePtr& right)
|
||||
{
|
||||
|
@ -227,12 +228,12 @@ QString RssFeed::url() const
|
|||
return m_url;
|
||||
}
|
||||
|
||||
QIcon RssFeed::icon() const
|
||||
QString RssFeed::iconPath() const
|
||||
{
|
||||
if (m_inErrorState)
|
||||
return QIcon(":/icons/oxygen/unavailable.png");
|
||||
return QLatin1String(":/icons/oxygen/unavailable.png");
|
||||
|
||||
return QIcon(m_icon);
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
bool RssFeed::hasCustomIcon() const
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual void rename(const QString &alias);
|
||||
virtual QString displayName() const;
|
||||
QString url() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual QString iconPath() const;
|
||||
bool hasCustomIcon() const;
|
||||
void setIconPath(const QString &pathHierarchy);
|
||||
RssArticlePtr getItem(const QString &guid) const;
|
|
@ -28,8 +28,8 @@
|
|||
* Contact: chris@qbittorrent.org, arnaud@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "rssfile.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rssfile.h"
|
||||
|
||||
QStringList RssFile::pathHierarchy() const {
|
||||
QStringList path;
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef RSSFILE_H
|
||||
#define RSSFILE_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QSharedPointer>
|
||||
|
@ -55,7 +54,7 @@ public:
|
|||
virtual uint unreadCount() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual QString iconPath() const = 0;
|
||||
virtual void rename(const QString &new_name) = 0;
|
||||
virtual void markAsRead() = 0;
|
||||
virtual RssFolder* parent() const = 0;
|
|
@ -30,12 +30,12 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include "guiiconprovider.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rssarticle.h"
|
||||
#include "base/iconprovider.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssfolder.h"
|
||||
|
||||
RssFolder::RssFolder(RssFolder *parent, const QString &name): m_parent(parent), m_name(name) {
|
||||
}
|
||||
|
@ -231,9 +231,9 @@ QString RssFolder::id() const
|
|||
return m_name;
|
||||
}
|
||||
|
||||
QIcon RssFolder::icon() const
|
||||
QString RssFolder::iconPath() const
|
||||
{
|
||||
return GuiIconProvider::instance()->getIcon("inode-directory");
|
||||
return IconProvider::instance()->getIconPath("inode-directory");
|
||||
}
|
||||
|
||||
bool RssFolder::hasChild(const QString &childId) {
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <QHash>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "rssfile.h"
|
||||
|
||||
class RssFolder;
|
||||
|
@ -61,7 +62,7 @@ public:
|
|||
QHash<QString, RssFeedPtr> getAllFeedsAsHash() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString id() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual QString iconPath() const;
|
||||
bool hasChild(const QString &childId);
|
||||
virtual RssArticleList articleListByDateDesc() const;
|
||||
virtual RssArticleList unreadArticleListByDateDesc() const;
|
|
@ -29,13 +29,14 @@
|
|||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include "rssmanager.h"
|
||||
|
||||
#include "base/preferences.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "rssparser.h"
|
||||
#include "rssmanager.h"
|
||||
|
||||
static const int MSECS_PER_MIN = 60000;
|
||||
|
|
@ -28,15 +28,14 @@
|
|||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "rssparser.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include "base/utils/fs.h"
|
||||
#include "rssparser.h"
|
||||
|
||||
struct ParsingJob {
|
||||
QString feedUrl;
|
||||
|
@ -343,10 +342,7 @@ void RssParser::parseAtomArticle(QXmlStreamReader& xml, const QString& feedUrl,
|
|||
|
||||
if (xml.isStartElement()) {
|
||||
if (xml.name() == "title") {
|
||||
// Workaround for CDATA (QString cannot parse html escapes on it's own)
|
||||
QTextDocument doc;
|
||||
doc.setHtml(xml.readElementText());
|
||||
article["title"] = doc.toPlainText().trimmed();
|
||||
article["title"] = xml.readElementText().trimmed();
|
||||
}
|
||||
else if (xml.name() == "link") {
|
||||
QString link = ( xml.attributes().isEmpty() ?
|
|
@ -31,12 +31,13 @@
|
|||
#ifndef RSSPARSER_H
|
||||
#define RSSPARSER_H
|
||||
|
||||
#include "rssarticle.h"
|
||||
#include <QMutex>
|
||||
#include <QQueue>
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "rssarticle.h"
|
||||
|
||||
struct ParsingJob;
|
||||
|
||||
class RssParser : public QThread
|
|
@ -36,10 +36,10 @@
|
|||
|
||||
#include "automatedrssdownloader.h"
|
||||
#include "ui_automatedrssdownloader.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "base/rss/rssdownloadrulelist.h"
|
||||
#include "base/preferences.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
#include "base/rss/rssmanager.h"
|
||||
#include "base/rss/rssfeed.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
#include <QWeakPointer>
|
||||
#include <QShortcut>
|
||||
#include <QRegExpValidator>
|
||||
#include "rssdownloadrule.h"
|
||||
|
||||
#include "base/rss/rssdownloadrule.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
* Contact: chris@qbittorrent.org, arnaud@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "feedlistwidget.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
#include "core/rss/rssmanager.h"
|
||||
#include "core/rss/rssfeed.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "feedlistwidget.h"
|
||||
|
||||
FeedListWidget::FeedListWidget(QWidget *parent, const RssManagerPtr& rssmanager): QTreeWidget(parent), m_rssManager(rssmanager) {
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
#include <QHash>
|
||||
#include <QUrl>
|
||||
|
||||
#include "rssfile.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssmanager.h"
|
||||
#include "base/rss/rssfile.h"
|
||||
#include "base/rss/rssfeed.h"
|
||||
#include "base/rss/rssmanager.h"
|
||||
|
||||
class FeedListWidget: public QTreeWidget {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -3,31 +3,15 @@ INCLUDEPATH += $$PWD
|
|||
HEADERS += $$PWD/rss_imp.h \
|
||||
$$PWD/rsssettingsdlg.h \
|
||||
$$PWD/feedlistwidget.h \
|
||||
$$PWD/rssmanager.h \
|
||||
$$PWD/rssfeed.h \
|
||||
$$PWD/rssfolder.h \
|
||||
$$PWD/rssfile.h \
|
||||
$$PWD/rssarticle.h \
|
||||
$$PWD/automatedrssdownloader.h \
|
||||
$$PWD/rssdownloadrule.h \
|
||||
$$PWD/rssdownloadrulelist.h \
|
||||
$$PWD/cookiesdlg.h \
|
||||
$$PWD/rssparser.h \
|
||||
$$PWD/htmlbrowser.h
|
||||
|
||||
SOURCES += $$PWD/rss_imp.cpp \
|
||||
$$PWD/rsssettingsdlg.cpp \
|
||||
$$PWD/feedlistwidget.cpp \
|
||||
$$PWD/rssmanager.cpp \
|
||||
$$PWD/rssfeed.cpp \
|
||||
$$PWD/rssfolder.cpp \
|
||||
$$PWD/rssarticle.cpp \
|
||||
$$PWD/automatedrssdownloader.cpp \
|
||||
$$PWD/rssdownloadrule.cpp \
|
||||
$$PWD/rssdownloadrulelist.cpp \
|
||||
$$PWD/cookiesdlg.cpp \
|
||||
$$PWD/rssfile.cpp \
|
||||
$$PWD/rssparser.cpp \
|
||||
$$PWD/htmlbrowser.cpp
|
||||
|
||||
FORMS += $$PWD/rss.ui \
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
#include "cookiesdlg.h"
|
||||
#include "base/preferences.h"
|
||||
#include "rsssettingsdlg.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssparser.h"
|
||||
#include "rssfeed.h"
|
||||
#include "base/rss/rssmanager.h"
|
||||
#include "base/rss/rssfolder.h"
|
||||
#include "base/rss/rssarticle.h"
|
||||
#include "base/rss/rssparser.h"
|
||||
#include "base/rss/rssfeed.h"
|
||||
#include "automatedrssdownloader.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
@ -478,7 +478,7 @@ QTreeWidgetItem* RSSImp::createFolderListItem(const RssFilePtr& rssFile)
|
|||
Q_ASSERT(rssFile);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem;
|
||||
item->setData(0, Qt::DisplayRole, QVariant(rssFile->displayName() + QString::fromUtf8(" (") + QString::number(rssFile->unreadCount()) + QString(")")));
|
||||
item->setData(0, Qt::DecorationRole, rssFile->icon());
|
||||
item->setData(0, Qt::DecorationRole, QIcon(rssFile->iconPath()));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ void RSSImp::updateFeedInfos(const QString& url, const QString& display_name, ui
|
|||
RssFeedPtr stream = qSharedPointerCast<RssFeed>(m_feedList->getRSSItem(item));
|
||||
item->setText(0, display_name + QString::fromUtf8(" (") + QString::number(nbUnread) + QString(")"));
|
||||
if (!stream->isLoading())
|
||||
item->setData(0, Qt::DecorationRole, QVariant(stream->icon()));
|
||||
item->setData(0, Qt::DecorationRole, QIcon(stream->iconPath()));
|
||||
// Update parent
|
||||
if (item->parent())
|
||||
updateItemInfos(item->parent());
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
#include <QPointer>
|
||||
#include <QShortcut>
|
||||
|
||||
#include "base/rss/rssfolder.h"
|
||||
#include "base/rss/rssmanager.h"
|
||||
#include "ui_rss.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rssmanager.h"
|
||||
|
||||
class FeedListWidget;
|
||||
|
||||
|
|
Loading…
Reference in a new issue