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

@ -35,10 +35,13 @@
#include "rssfeed.h"
#include "rssarticle.h"
#include "rssdownloadrulelist.h"
#include "rssparser.h"
#include "downloadthread.h"
RssManager::RssManager():
m_rssDownloader(new DownloadThread(this)), m_downloadRules(new RssDownloadRuleList)
m_rssDownloader(new DownloadThread(this)),
m_downloadRules(new RssDownloadRuleList),
m_rssParser(new RssParser(this))
{
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
m_refreshInterval = RssSettings().getRSSRefreshInterval();
@ -48,16 +51,22 @@ RssManager::RssManager():
RssManager::~RssManager() {
qDebug("Deleting RSSManager...");
delete m_downloadRules;
delete m_rssParser;
saveItemsToDisk();
saveStreamList();
qDebug("RSSManager deleted");
}
DownloadThread *RssManager::rssDownloader() const
DownloadThread* RssManager::rssDownloader() const
{
return m_rssDownloader;
}
RssParser* RssManager::rssParser() const
{
return m_rssParser;
}
void RssManager::updateRefreshInterval(uint val) {
if (m_refreshInterval != val) {
m_refreshInterval = val;