Browse Source

Send numeric status without translation

adaptive-webui-19844
Thomas Piccirello 6 years ago
parent
commit
7f349732ee
  1. 8
      src/base/bittorrent/trackerentry.h
  2. 13
      src/webui/api/torrentscontroller.cpp
  3. 21
      src/webui/www/private/scripts/prop-trackers.js

8
src/base/bittorrent/trackerentry.h

@ -44,10 +44,10 @@ namespace BitTorrent @@ -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);

13
src/webui/api/torrentscontroller.cpp

@ -386,22 +386,11 @@ void TorrentsController::trackersAction() @@ -386,22 +386,11 @@ void TorrentsController::trackersAction()
QHash<QString, BitTorrent::TrackerInfo> 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<int>(tracker.status())},
{KEY_TRACKER_PEERS_COUNT, data.numPeers},
{KEY_TRACKER_MSG, data.lastMessage.trimmed()},
{KEY_TRACKER_SEEDS_COUNT, tracker.nativeEntry().scrape_complete},

21
src/webui/www/private/scripts/prop-trackers.js

@ -90,10 +90,29 @@ var loadTrackersData = function() { @@ -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]",

Loading…
Cancel
Save