1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-27 23:14:31 +00:00

Replace a series of if() by switch()

This commit is contained in:
Chocobo1 2019-12-18 15:05:42 +08:00
parent 90308c2ae5
commit bb73fa5dbe
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
2 changed files with 9 additions and 7 deletions

View File

@ -583,16 +583,18 @@ QString TrackerFiltersList::getHost(const QString &tracker) const
return longHost.mid(index + 1);
}
QStringList TrackerFiltersList::getHashes(int row)
QStringList TrackerFiltersList::getHashes(const int row) const
{
if (row == 1)
switch (row) {
case 1:
return m_trackers.value("");
if (row == 2)
case 2:
return m_errors.keys();
if (row == 3)
case 3:
return m_warnings.keys();
return m_trackers.value(trackerFromRow(row));
default:
return m_trackers.value(trackerFromRow(row));
}
}
TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)

View File

@ -126,7 +126,7 @@ private:
QString trackerFromRow(int row) const;
int rowFromTracker(const QString &tracker) const;
QString getHost(const QString &tracker) const;
QStringList getHashes(int row);
QStringList getHashes(int row) const;
void downloadFavicon(const QString &url);
QHash<QString, QStringList> m_trackers;