diff --git a/src/base/bittorrent/trackerentry.h b/src/base/bittorrent/trackerentry.h index fcaf9af7d..e2930e0a9 100644 --- a/src/base/bittorrent/trackerentry.h +++ b/src/base/bittorrent/trackerentry.h @@ -44,10 +44,10 @@ namespace BitTorrent public: enum Status { - NotContacted, - Working, - Updating, - NotWorking + NotContacted = 1, + Working = 2, + Updating = 3, + NotWorking = 4 }; TrackerEntry(const QString &url); diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index c864b21ce..6edbe1d31 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -386,22 +386,11 @@ void TorrentsController::trackersAction() QHash trackersData = torrent->trackerInfos(); for (const BitTorrent::TrackerEntry &tracker : asConst(torrent->trackers())) { const BitTorrent::TrackerInfo data = trackersData.value(tracker.url()); - QString status; - switch (tracker.status()) { - case BitTorrent::TrackerEntry::NotContacted: - status = tr("Not contacted yet"); break; - case BitTorrent::TrackerEntry::Updating: - status = tr("Updating..."); break; - case BitTorrent::TrackerEntry::Working: - status = tr("Working"); break; - case BitTorrent::TrackerEntry::NotWorking: - status = tr("Not working"); break; - } trackerList << QVariantMap { {KEY_TRACKER_URL, tracker.url()}, {KEY_TRACKER_TIER, tracker.tier()}, - {KEY_TRACKER_STATUS, status}, + {KEY_TRACKER_STATUS, static_cast(tracker.status())}, {KEY_TRACKER_PEERS_COUNT, data.numPeers}, {KEY_TRACKER_MSG, data.lastMessage.trimmed()}, {KEY_TRACKER_SEEDS_COUNT, tracker.nativeEntry().scrape_complete}, diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js index f61f9a1be..84d053153 100644 --- a/src/webui/www/private/scripts/prop-trackers.js +++ b/src/webui/www/private/scripts/prop-trackers.js @@ -90,10 +90,29 @@ var loadTrackersData = function() { if (trackers) { // Update Trackers data trackers.each(function(tracker) { + var status; + switch (tracker.status) { + case 0: + status = "QBT_TR(Disabled)QBT_TR[CONTEXT=TrackerListWidget]"; + break; + case 1: + status = "QBT_TR(Not contacted yet)QBT_TR[CONTEXT=TrackerListWidget]"; + break; + case 2: + status = "QBT_TR(Working)QBT_TR[CONTEXT=TrackerListWidget]"; + break; + case 3: + status = "QBT_TR(Updating...)QBT_TR[CONTEXT=TrackerListWidget]"; + break; + case 4: + status = "QBT_TR(Not working)QBT_TR[CONTEXT=TrackerListWidget]"; + break; + } + var row = [ tracker.tier, escapeHtml(tracker.url), - tracker.status, + status, tracker.num_peers, (tracker.num_seeds >= 0) ? tracker.num_seeds : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]", (tracker.num_leeches >= 0) ? tracker.num_leeches : "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]",