mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
RSS code clean up
This commit is contained in:
parent
1905a6f0d1
commit
32a6c89c8c
@ -508,7 +508,7 @@ void RSSImp::refreshTextBrowser() {
|
||||
m_currentArticle = item;
|
||||
}
|
||||
RssFeed *stream = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString());
|
||||
RssArticle &article = stream->getItem(item->data(Article::IdRole).toString());
|
||||
RssArticle article = stream->getItem(item->data(Article::IdRole).toString());
|
||||
QString html;
|
||||
html += "<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>";
|
||||
html += "<div style='background-color: #678db2; font-weight: bold; color: #fff;'>"+article.title() + "</div>";
|
||||
|
@ -190,6 +190,11 @@ QDateTime RssArticle::parseDate(const QString &string) {
|
||||
return result;
|
||||
}
|
||||
|
||||
RssArticle::RssArticle():
|
||||
d(new RssArticleData(0))
|
||||
{
|
||||
}
|
||||
|
||||
// public constructor
|
||||
RssArticle::RssArticle(RssFeed* parent, QXmlStreamReader& xml):
|
||||
d(new RssArticleData(parent))
|
||||
|
@ -43,8 +43,9 @@ class RssArticleData;
|
||||
class RssArticle {
|
||||
|
||||
public:
|
||||
RssArticle();
|
||||
RssArticle(RssFeed* parent, QXmlStreamReader& xml);
|
||||
RssArticle(RssFeed* parent = 0, const QString &guid = QString());
|
||||
RssArticle(RssFeed* parent, const QString &guid);
|
||||
RssArticle(const RssArticle& other); // Copy constructor
|
||||
RssArticle& operator=(const RssArticle& other);
|
||||
~RssArticle();
|
||||
|
@ -177,8 +177,8 @@ void RssFeed::setIconPath(const QString &path) {
|
||||
m_icon = path;
|
||||
}
|
||||
|
||||
RssArticle& RssFeed::getItem(const QString &guid) {
|
||||
return m_articles[guid];
|
||||
const RssArticle RssFeed::getItem(const QString &guid) const {
|
||||
return m_articles.value(guid);
|
||||
}
|
||||
|
||||
uint RssFeed::count() const{
|
||||
@ -300,7 +300,7 @@ void RssFeed::downloadMatchingArticleTorrents() {
|
||||
Q_ASSERT(RssSettings().isRssDownloadingEnabled());
|
||||
QHash<QString, RssArticle>::iterator it;
|
||||
for (it = m_articles.begin(); it != m_articles.end(); it++) {
|
||||
RssArticle &item = it.value();
|
||||
RssArticle item = it.value();
|
||||
if(item.isRead()) continue;
|
||||
QString torrent_url;
|
||||
if(item.hasAttachment())
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
QString icon() const;
|
||||
bool hasCustomIcon() const;
|
||||
void setIconPath(const QString &pathHierarchy);
|
||||
RssArticle& getItem(const QString &guid);
|
||||
const RssArticle getItem(const QString &guid) const;
|
||||
uint count() const;
|
||||
void markAsRead();
|
||||
uint unreadCount() const;
|
||||
|
@ -39,8 +39,7 @@
|
||||
|
||||
RssManager* RssManager::m_instance = 0;
|
||||
|
||||
RssManager::RssManager(): RssFolder() {
|
||||
m_rssDownloader = new DownloadThread(this);
|
||||
RssManager::RssManager(): m_rssDownloader(new DownloadThread(this)) {
|
||||
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
|
||||
m_refreshInterval = RssSettings().getRSSRefreshInterval();
|
||||
m_refreshTimer.start(m_refreshInterval*60000);
|
||||
|
Loading…
Reference in New Issue
Block a user