1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-02 01:44:26 +00:00

- Slight RSS cleanup

This commit is contained in:
Christophe Dumez 2010-03-03 23:11:40 +00:00
parent 28a6afeb02
commit c48766aeb7

View File

@ -172,10 +172,10 @@ protected:
parts = rx.capturedTexts(); parts = rx.capturedTexts();
} }
bool ok[4]; bool ok[4];
int day = parts[nday].toInt(&ok[0]); const int day = parts[nday].toInt(&ok[0]);
int year = parts[nyear].toInt(&ok[1]); int year = parts[nyear].toInt(&ok[1]);
int hour = parts[nhour].toInt(&ok[2]); const int hour = parts[nhour].toInt(&ok[2]);
int minute = parts[nmin].toInt(&ok[3]); const int minute = parts[nmin].toInt(&ok[3]);
if (!ok[0] || !ok[1] || !ok[2] || !ok[3]) if (!ok[0] || !ok[1] || !ok[2] || !ok[3])
return QDateTime::currentDateTime(); return QDateTime::currentDateTime();
int second = 0; int second = 0;
@ -277,7 +277,6 @@ public:
if(xml.isEndElement() && xml.name() == "item") if(xml.isEndElement() && xml.name() == "item")
break; break;
qDebug("in item: <%s>", qPrintable(xml.name().toString()));
if(xml.isStartElement()) { if(xml.isStartElement()) {
if(xml.name() == "title") { if(xml.name() == "title") {
@ -340,9 +339,8 @@ public:
} }
static RssItem* fromHash(RssStream* parent, QHash<QString, QVariant> h) { static RssItem* fromHash(RssStream* parent, QHash<QString, QVariant> h) {
RssItem * item = new RssItem(parent, h["title"].toString(), h["torrent_url"].toString(), h["news_link"].toString(), return new RssItem(parent, h["title"].toString(), h["torrent_url"].toString(), h["news_link"].toString(),
h["description"].toString(), h["date"].toDateTime(), h["author"].toString(), h["read"].toBool()); h["description"].toString(), h["date"].toDateTime(), h["author"].toString(), h["read"].toBool());
return item;
} }
RssStream* getParent() const { RssStream* getParent() const {
@ -536,7 +534,7 @@ public:
list.insert(i, item); list.insert(i, item);
} }
static QList<RssItem*> sortNewsList(QList<RssItem*> news_list) { static QList<RssItem*> sortNewsList(const QList<RssItem*>& news_list) {
QList<RssItem*> new_list; QList<RssItem*> new_list;
foreach(RssItem *item, news_list) { foreach(RssItem *item, news_list) {
insertSortElem(new_list, item); insertSortElem(new_list, item);