Browse Source

Code clean up

adaptive-webui-19844
Christophe Dumez 13 years ago
parent
commit
a2d9cce181
  1. 2
      src/dnsupdater.cpp
  2. 2
      src/preferences/options_imp.cpp
  3. 2
      src/qtlibtorrent/qbtsession.cpp
  4. 6
      src/rss/rssarticle.cpp
  5. 16
      src/rss/rssfeed.cpp
  6. 1
      src/rss/rssfeed.h

2
src/dnsupdater.cpp

@ -175,7 +175,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
QString code = reply.split(" ").first(); QString code = reply.split(" ").first();
qDebug() << Q_FUNC_INFO << "Code:" << code; qDebug() << Q_FUNC_INFO << "Code:" << code;
if (code == "good" || code == "nochg") { if (code == "good" || code == "nochg") {
QBtSession::instance()->addConsoleMessage(tr("Your dynamic DNS was successfuly updated."), "green"); QBtSession::instance()->addConsoleMessage(tr("Your dynamic DNS was successfully updated."), "green");
return; return;
} }
if (code == "911" || code == "dnserr") { if (code == "911" || code == "dnserr") {

2
src/preferences/options_imp.cpp

@ -1221,7 +1221,7 @@ void options_imp::handleIPFilterParsed(bool error, int ruleCount)
if (error) { if (error) {
QMessageBox::warning(this, tr("Parsing error"), tr("Failed to parse the provided IP filter")); QMessageBox::warning(this, tr("Parsing error"), tr("Failed to parse the provided IP filter"));
} else { } else {
QMessageBox::information(this, tr("Successfully refreshed"), tr("Successfuly parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount)); QMessageBox::information(this, tr("Successfully refreshed"), tr("Successfully parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
} }
m_refreshingIpFilter = false; m_refreshingIpFilter = false;
disconnect(QBtSession::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int))); disconnect(QBtSession::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int)));

2
src/qtlibtorrent/qbtsession.cpp

@ -2775,7 +2775,7 @@ qlonglong QBtSession::getETA(const QString &hash) const
void QBtSession::handleIPFilterParsed(int ruleCount) void QBtSession::handleIPFilterParsed(int ruleCount)
{ {
addConsoleMessage(tr("Successfuly parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount)); addConsoleMessage(tr("Successfully parsed the provided IP filter: %1 rules were applied.", "%1 is a number").arg(ruleCount));
emit ipFilterParsed(false, ruleCount); emit ipFilterParsed(false, ruleCount);
} }

6
src/rss/rssarticle.cpp

@ -284,7 +284,7 @@ QString RssArticle::author() const {
return m_author; return m_author;
} }
QString RssArticle::torrentUrl() const{ QString RssArticle::torrentUrl() const {
return m_torrentUrl; return m_torrentUrl;
} }
@ -292,7 +292,7 @@ QString RssArticle::link() const {
return m_link; return m_link;
} }
QString RssArticle::description() const{ QString RssArticle::description() const {
if (m_description.isNull()) if (m_description.isNull())
return ""; return "";
return m_description; return m_description;
@ -302,7 +302,7 @@ QDateTime RssArticle::date() const {
return m_date; return m_date;
} }
bool RssArticle::isRead() const{ bool RssArticle::isRead() const {
return m_read; return m_read;
} }

16
src/rss/rssfeed.cpp

@ -120,10 +120,6 @@ void RssFeed::removeAllSettings() {
} }
} }
bool RssFeed::itemAlreadyExists(const QString &guid) const {
return m_articles.contains(guid);
}
void RssFeed::setLoading(bool val) { void RssFeed::setLoading(bool val) {
m_loading = val; m_loading = val;
} }
@ -231,8 +227,12 @@ void RssFeed::parseRSSChannel(QXmlStreamReader& xml)
} }
else if (xml.name() == "item") { else if (xml.name() == "item") {
RssArticlePtr article = xmlToRssArticle(this, xml); RssArticlePtr article = xmlToRssArticle(this, xml);
if (article && !itemAlreadyExists(article->guid())) if (article) {
m_articles.insert(article->guid(), article); QString guid = article->guid();
if (m_articles.contains(guid) && m_articles[guid]->isRead())
article->markAsRead();
m_articles[guid] = article;
}
} else } else
xml.skipCurrentElement(); xml.skipCurrentElement();
} }
@ -335,14 +335,14 @@ bool RssFeed::parseXmlFile(const QString &file_path) {
// read and store the downloaded rss' informations // read and store the downloaded rss' informations
void RssFeed::handleFinishedDownload(const QString& url, const QString &file_path) { void RssFeed::handleFinishedDownload(const QString& url, const QString &file_path) {
if (url == m_url) { if (url == m_url) {
qDebug() << Q_FUNC_INFO << "Successfuly downloaded RSS feed at" << url; qDebug() << Q_FUNC_INFO << "Successfully downloaded RSS feed at" << url;
m_downloadFailure = false; m_downloadFailure = false;
m_loading = false; m_loading = false;
// Parse the download RSS // Parse the download RSS
if (parseXmlFile(file_path)) { if (parseXmlFile(file_path)) {
m_refreshed = true; m_refreshed = true;
m_manager->forwardFeedInfosChanged(m_url, displayName(), unreadCount()); // XXX: Ugly m_manager->forwardFeedInfosChanged(m_url, displayName(), unreadCount()); // XXX: Ugly
qDebug() << Q_FUNC_INFO << "Feed parsed successfuly"; qDebug() << Q_FUNC_INFO << "Feed parsed successfully";
} }
} }
else if (url == m_iconUrl) { else if (url == m_iconUrl) {

1
src/rss/rssfeed.h

@ -55,7 +55,6 @@ public:
void refresh(); void refresh();
virtual QString id() const { return m_url; } virtual QString id() const { return m_url; }
virtual void removeAllSettings(); virtual void removeAllSettings();
bool itemAlreadyExists(const QString &guid) const;
virtual void saveItemsToDisk(); virtual void saveItemsToDisk();
void setLoading(bool val); void setLoading(bool val);
bool isLoading() const; bool isLoading() const;

Loading…
Cancel
Save