Move RSS parsing to another thread to avoid freezing the UI

RSS items are now displayed as soon as they have been parsed
instead of displaying all of them in one batch once the whole
feed is parsed.

First step to address issue #34.
This commit is contained in:
Christophe Dumez
2012-08-18 18:06:29 +03:00
parent 820d94e014
commit c50c9239ea
10 changed files with 529 additions and 374 deletions

View File

@@ -33,6 +33,7 @@
#include <QHash>
#include <QSharedPointer>
#include <QVariantHash>
#include <QXmlStreamReader>
#include "rssfile.h"
@@ -76,13 +77,12 @@ public:
private slots:
void handleFinishedDownload(const QString& url, const QString &file_path);
void handleDownloadFailure(const QString &url, const QString& error);
void handleFeedTitle(const QString& feedUrl, const QString& title);
void handleNewArticle(const QString& feedUrl, const QVariantHash& article);
void handleFeedParsingFinished(const QString& feedUrl, const QString& error);
private:
bool parseRSS(QIODevice* device);
void parseRSSChannel(QXmlStreamReader& xml);
void removeOldArticles();
bool parseXmlFile(const QString &file_path);
void downloadMatchingArticleTorrents();
QString iconUrl() const;
void loadItemsFromDisk();
@@ -97,7 +97,7 @@ private:
QString m_iconUrl;
bool m_read;
bool m_refreshed;
bool m_downloadFailure;
bool m_inErrorState;
bool m_loading;
};