mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Simplify map initialization
This commit is contained in:
parent
33351e3d8d
commit
9e1f7a72b7
@ -385,8 +385,6 @@ void TorrentsController::trackersAction()
|
|||||||
|
|
||||||
QHash<QString, BitTorrent::TrackerInfo> trackersData = torrent->trackerInfos();
|
QHash<QString, BitTorrent::TrackerInfo> trackersData = torrent->trackerInfos();
|
||||||
for (const BitTorrent::TrackerEntry &tracker : asConst(torrent->trackers())) {
|
for (const BitTorrent::TrackerEntry &tracker : asConst(torrent->trackers())) {
|
||||||
QVariantMap trackerDict;
|
|
||||||
trackerDict[KEY_TRACKER_URL] = tracker.url();
|
|
||||||
const BitTorrent::TrackerInfo data = trackersData.value(tracker.url());
|
const BitTorrent::TrackerInfo data = trackersData.value(tracker.url());
|
||||||
QString status;
|
QString status;
|
||||||
switch (tracker.status()) {
|
switch (tracker.status()) {
|
||||||
@ -399,16 +397,17 @@ void TorrentsController::trackersAction()
|
|||||||
case BitTorrent::TrackerEntry::NotWorking:
|
case BitTorrent::TrackerEntry::NotWorking:
|
||||||
status = tr("Not working"); break;
|
status = tr("Not working"); break;
|
||||||
}
|
}
|
||||||
trackerDict[KEY_TRACKER_TIER] = tracker.tier();
|
|
||||||
trackerDict[KEY_TRACKER_STATUS] = status;
|
|
||||||
trackerDict[KEY_TRACKER_PEERS_COUNT] = data.numPeers;
|
|
||||||
trackerDict[KEY_TRACKER_MSG] = data.lastMessage.trimmed();
|
|
||||||
|
|
||||||
trackerDict[KEY_TRACKER_SEEDS_COUNT] = tracker.nativeEntry().scrape_complete;
|
trackerList << QVariantMap {
|
||||||
trackerDict[KEY_TRACKER_LEECHES_COUNT] = tracker.nativeEntry().scrape_incomplete;
|
{KEY_TRACKER_URL, tracker.url()},
|
||||||
trackerDict[KEY_TRACKER_DOWNLOADED_COUNT] = tracker.nativeEntry().scrape_downloaded;
|
{KEY_TRACKER_TIER, tracker.tier()},
|
||||||
|
{KEY_TRACKER_STATUS, status},
|
||||||
trackerList.append(trackerDict);
|
{KEY_TRACKER_PEERS_COUNT, data.numPeers},
|
||||||
|
{KEY_TRACKER_MSG, data.lastMessage.trimmed()},
|
||||||
|
{KEY_TRACKER_SEEDS_COUNT, tracker.nativeEntry().scrape_complete},
|
||||||
|
{KEY_TRACKER_LEECHES_COUNT, tracker.nativeEntry().scrape_incomplete},
|
||||||
|
{KEY_TRACKER_DOWNLOADED_COUNT, tracker.nativeEntry().scrape_downloaded}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
setResult(QJsonArray::fromVariantList(trackerList));
|
setResult(QJsonArray::fromVariantList(trackerList));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user