mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Keep RSS articles sorted by date in memory do avoid sorting them all the time
Optimization to address issue #34.
This commit is contained in:
parent
aecdc57cd4
commit
d1e30cacf8
8 changed files with 58 additions and 61 deletions
|
@ -91,24 +91,28 @@ void RssFolder::refresh() {
|
|||
}
|
||||
}
|
||||
|
||||
RssArticleList RssFolder::articleList() const {
|
||||
RssArticleList RssFolder::articleListByDateDesc() const {
|
||||
RssArticleList news;
|
||||
|
||||
RssFileHash::ConstIterator it = m_children.begin();
|
||||
RssFileHash::ConstIterator itend = m_children.end();
|
||||
for ( ; it != itend; ++it) {
|
||||
news << it.value()->articleList();
|
||||
int n = news.size();
|
||||
news << it.value()->articleListByDateDesc();
|
||||
std::inplace_merge(news.begin(), news.begin() + n, news.end(), rssArticleDateRecentThan);
|
||||
}
|
||||
return news;
|
||||
}
|
||||
|
||||
RssArticleList RssFolder::unreadArticleList() const {
|
||||
RssArticleList RssFolder::unreadArticleListByDateDesc() const {
|
||||
RssArticleList unread_news;
|
||||
|
||||
RssFileHash::ConstIterator it = m_children.begin();
|
||||
RssFileHash::ConstIterator itend = m_children.end();
|
||||
for ( ; it != itend; ++it) {
|
||||
unread_news << it.value()->unreadArticleList();
|
||||
int n = unread_news.size();
|
||||
unread_news << it.value()->unreadArticleListByDateDesc();
|
||||
std::inplace_merge(unread_news.begin(), unread_news.begin() + n, unread_news.end(), rssArticleDateRecentThan);
|
||||
}
|
||||
return unread_news;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue