From 1785c54b83a6f3e39beaa5b3e0ad9da3054f0c92 Mon Sep 17 00:00:00 2001 From: Anton Lashkov Date: Sun, 30 Oct 2016 22:51:04 +0400 Subject: [PATCH 1/4] Fix mistake in getting value from model --- src/gui/transferlistsortmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index 2058ce91f..2a48bd843 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -131,7 +131,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex const bool seedingR = (prioR < 0); bool activeR = TorrentFilter::ActiveTorrent.match(model->torrentHandle(model->index(right.row()))); - bool activeL = TorrentFilter::ActiveTorrent.match(model->torrentHandle(model->index(right.row()))); + bool activeL = TorrentFilter::ActiveTorrent.match(model->torrentHandle(model->index(left.row()))); // Sorting rules prioritized. // 1. Active torrents at the top From a372d22fb2edbc7cbd1b27fee76ad31636cecc11 Mon Sep 17 00:00:00 2001 From: Anton Lashkov Date: Sun, 30 Oct 2016 22:51:34 +0400 Subject: [PATCH 2/4] Add missing `else` --- src/gui/rss/feedlistwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/rss/feedlistwidget.cpp b/src/gui/rss/feedlistwidget.cpp index 28feef1d2..54251ac02 100644 --- a/src/gui/rss/feedlistwidget.cpp +++ b/src/gui/rss/feedlistwidget.cpp @@ -67,7 +67,7 @@ void FeedListWidget::itemAboutToBeRemoved(QTreeWidgetItem *item) { Rss::FilePtr file = m_rssMapping.take(item); if (Rss::FeedPtr feed = qSharedPointerDynamicCast(file)) { m_feedsItems.remove(feed->id()); - } if (Rss::FolderPtr folder = qSharedPointerDynamicCast(file)) { + } else if (Rss::FolderPtr folder = qSharedPointerDynamicCast(file)) { Rss::FeedList feeds = folder->getAllFeeds(); foreach (const Rss::FeedPtr& feed, feeds) { m_feedsItems.remove(feed->id()); From 36901295b2221e021521d065c57250ca1206121d Mon Sep 17 00:00:00 2001 From: Anton Lashkov Date: Sun, 30 Oct 2016 22:52:27 +0400 Subject: [PATCH 3/4] Simplify `if` statement --- src/gui/properties/propertieswidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 5fbb2b625..f0393742e 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -194,7 +194,7 @@ void PropertiesWidget::showPiecesAvailability(bool show) avail_pieces_lbl->setVisible(show); pieces_availability->setVisible(show); avail_average_lbl->setVisible(show); - if (show || (!show && !downloaded_pieces->isVisible())) + if (show || !downloaded_pieces->isVisible()) line_2->setVisible(show); } @@ -203,7 +203,7 @@ void PropertiesWidget::showPiecesDownloaded(bool show) downloaded_pieces_lbl->setVisible(show); downloaded_pieces->setVisible(show); progress_lbl->setVisible(show); - if (show || (!show && !pieces_availability->isVisible())) + if (show || !pieces_availability->isVisible()) line_2->setVisible(show); } From 1233c5b67bd86f3b4031cf98b06955481f32e375 Mon Sep 17 00:00:00 2001 From: Anton Lashkov Date: Sun, 30 Oct 2016 22:53:23 +0400 Subject: [PATCH 4/4] Fix name of variable same as class member --- .../bittorrent/private/filterparserthread.cpp | 16 ++++++++-------- src/base/bittorrent/private/filterparserthread.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/base/bittorrent/private/filterparserthread.cpp b/src/base/bittorrent/private/filterparserthread.cpp index 21e188706..250893e0f 100644 --- a/src/base/bittorrent/private/filterparserthread.cpp +++ b/src/base/bittorrent/private/filterparserthread.cpp @@ -55,10 +55,10 @@ FilterParserThread::~FilterParserThread() } // Parser for eMule ip filter in DAT format -int FilterParserThread::parseDATFilterFile(QString m_filePath, libt::ip_filter &filter) +int FilterParserThread::parseDATFilterFile(QString filePath, libt::ip_filter &filter) { int ruleCount = 0; - QFile file(m_filePath); + QFile file(filePath); if (!file.exists()) return ruleCount; if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -149,10 +149,10 @@ int FilterParserThread::parseDATFilterFile(QString m_filePath, libt::ip_filter & } // Parser for PeerGuardian ip filter in p2p format -int FilterParserThread::parseP2PFilterFile(QString m_filePath, libt::ip_filter &filter) +int FilterParserThread::parseP2PFilterFile(QString filePath, libt::ip_filter &filter) { int ruleCount = 0; - QFile file(m_filePath); + QFile file(filePath); if (!file.exists()) return ruleCount; if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -257,10 +257,10 @@ int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name, } // Parser for PeerGuardian ip filter in p2p format -int FilterParserThread::parseP2BFilterFile(QString m_filePath, libt::ip_filter &filter) +int FilterParserThread::parseP2BFilterFile(QString filePath, libt::ip_filter &filter) { int ruleCount = 0; - QFile file(m_filePath); + QFile file(filePath); if (!file.exists()) return ruleCount; if (!file.open(QIODevice::ReadOnly)) { @@ -369,7 +369,7 @@ int FilterParserThread::parseP2BFilterFile(QString m_filePath, libt::ip_filter & // * eMule IP list (DAT): http://wiki.phoenixlabs.org/wiki/DAT_Format // * PeerGuardian Text (P2P): http://wiki.phoenixlabs.org/wiki/P2P_Format // * PeerGuardian Binary (P2B): http://wiki.phoenixlabs.org/wiki/P2B_Format -void FilterParserThread::processFilterFile(QString _filePath) +void FilterParserThread::processFilterFile(QString filePath) { if (isRunning()) { // Already parsing a filter, m_abort first @@ -378,7 +378,7 @@ void FilterParserThread::processFilterFile(QString _filePath) } m_abort = false; - m_filePath = _filePath; + m_filePath = filePath; // Run it start(); } diff --git a/src/base/bittorrent/private/filterparserthread.h b/src/base/bittorrent/private/filterparserthread.h index 9e3bdb6be..ed2bd13cf 100644 --- a/src/base/bittorrent/private/filterparserthread.h +++ b/src/base/bittorrent/private/filterparserthread.h @@ -54,7 +54,7 @@ public: int parseP2PFilterFile(QString filePath, libtorrent::ip_filter &filter); int getlineInStream(QDataStream &stream, std::string &name, char delim); int parseP2BFilterFile(QString filePath, libtorrent::ip_filter &filter); - void processFilterFile(QString _filePath); + void processFilterFile(QString filePath); signals: void IPFilterParsed(int ruleCount);