Browse Source

RSS code clean up

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
82fbb351dd
  1. 34
      src/rss/rssmanager.cpp
  2. 14
      src/rss/rssmanager.h

34
src/rss/rssmanager.cpp

@ -48,7 +48,8 @@ RssManager::RssManager(): @@ -48,7 +48,8 @@ RssManager::RssManager():
m_refreshTimer.start(m_refreshInterval*60000);
}
RssManager::~RssManager() {
RssManager::~RssManager()
{
qDebug("Deleting RSSManager...");
delete m_downloadRules;
delete m_rssParser;
@ -67,7 +68,8 @@ RssParser* RssManager::rssParser() const @@ -67,7 +68,8 @@ RssParser* RssManager::rssParser() const
return m_rssParser;
}
void RssManager::updateRefreshInterval(uint val) {
void RssManager::updateRefreshInterval(uint val)
{
if (m_refreshInterval != val) {
m_refreshInterval = val;
m_refreshTimer.start(m_refreshInterval*60000);
@ -75,7 +77,8 @@ void RssManager::updateRefreshInterval(uint val) { @@ -75,7 +77,8 @@ void RssManager::updateRefreshInterval(uint val) {
}
}
void RssManager::loadStreamList() {
void RssManager::loadStreamList()
{
RssSettings settings;
const QStringList streamsUrl = settings.getRssFeedsUrls();
const QStringList aliases = settings.getRssFeedsAliases();
@ -113,35 +116,38 @@ void RssManager::forwardFeedContentChanged(const QString& url) @@ -113,35 +116,38 @@ void RssManager::forwardFeedContentChanged(const QString& url)
emit feedContentChanged(url);
}
void RssManager::forwardFeedInfosChanged(const QString &url, const QString &display_name, uint nbUnread) {
emit feedInfosChanged(url, display_name, nbUnread);
void RssManager::forwardFeedInfosChanged(const QString& url, const QString& displayName, uint unreadCount)
{
emit feedInfosChanged(url, displayName, unreadCount);
}
void RssManager::forwardFeedIconChanged(const QString &url, const QString &icon_path) {
emit feedIconChanged(url, icon_path);
void RssManager::forwardFeedIconChanged(const QString& url, const QString& iconPath)
{
emit feedIconChanged(url, iconPath);
}
void RssManager::moveFile(const RssFilePtr& file, const RssFolderPtr& dest_folder) {
void RssManager::moveFile(const RssFilePtr& file, const RssFolderPtr& destinationFolder)
{
RssFolder* src_folder = file->parent();
if (dest_folder != src_folder) {
if (destinationFolder != src_folder) {
// Remove reference in old folder
src_folder->takeChild(file->id());
// add to new Folder
dest_folder->addFile(file);
destinationFolder->addFile(file);
} else {
qDebug("Nothing to move, same destination folder");
}
}
void RssManager::saveStreamList() const {
void RssManager::saveStreamList() const
{
QStringList streamsUrl;
QStringList aliases;
RssFeedList streams = getAllFeeds();
foreach (const RssFeedPtr& stream, streams) {
QString stream_path = stream->pathHierarchy().join("\\");
if (stream_path.isNull()) {
if (stream_path.isNull())
stream_path = "";
}
qDebug("Saving stream path: %s", qPrintable(stream_path));
streamsUrl << stream_path;
aliases << stream->displayName();
@ -151,7 +157,7 @@ void RssManager::saveStreamList() const { @@ -151,7 +157,7 @@ void RssManager::saveStreamList() const {
settings.setRssFeedsAliases(aliases);
}
RssDownloadRuleList *RssManager::downloadRules() const
RssDownloadRuleList* RssManager::downloadRules() const
{
Q_ASSERT(m_downloadRules);
return m_downloadRules;

14
src/rss/rssmanager.h

@ -59,21 +59,21 @@ public slots: @@ -59,21 +59,21 @@ public slots:
void loadStreamList();
void saveStreamList() const;
void forwardFeedContentChanged(const QString& url);
void forwardFeedInfosChanged(const QString &url, const QString &aliasOrUrl, uint nbUnread);
void forwardFeedIconChanged(const QString &url, const QString &icon_path);
void moveFile(const RssFilePtr& file, const RssFolderPtr& dest_folder);
void forwardFeedInfosChanged(const QString& url, const QString& displayName, uint unreadCount);
void forwardFeedIconChanged(const QString& url, const QString& iconPath);
void moveFile(const RssFilePtr& file, const RssFolderPtr& destinationFolder);
void updateRefreshInterval(uint val);
signals:
void feedContentChanged(const QString& url);
void feedInfosChanged(const QString &url, const QString &display_name, uint nbUnread);
void feedIconChanged(const QString &url, const QString &icon_path);
void feedInfosChanged(const QString& url, const QString& displayName, uint unreadCount);
void feedIconChanged(const QString& url, const QString& iconPath);
private:
QTimer m_refreshTimer;
uint m_refreshInterval;
DownloadThread *m_rssDownloader;
RssDownloadRuleList *m_downloadRules;
DownloadThread* m_rssDownloader;
RssDownloadRuleList* m_downloadRules;
RssParser* m_rssParser;
};

Loading…
Cancel
Save