From a05562cdc5ad5a36a9ace0701cde7f4fb2b651e2 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Mon, 27 Nov 2017 01:35:15 -0500 Subject: [PATCH] Add Time Active column --- src/webui/btjson.cpp | 2 ++ src/webui/www/public/scripts/dynamicTable.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 5979aede3..db7f318da 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -114,6 +114,7 @@ static const char KEY_TORRENT_LAST_SEEN_COMPLETE_TIME[] = "seen_complete"; static const char KEY_TORRENT_LAST_ACTIVITY_TIME[] = "last_activity"; static const char KEY_TORRENT_TOTAL_SIZE[] = "total_size"; static const char KEY_TORRENT_AUTO_TORRENT_MANAGEMENT[] = "auto_tmm"; +static const char KEY_TORRENT_TIME_ACTIVE[] = "time_active"; // Peer keys static const char KEY_PEER_IP[] = "ip"; @@ -389,6 +390,7 @@ namespace ret[KEY_TORRENT_RATIO_LIMIT] = torrent->maxRatio(); ret[KEY_TORRENT_LAST_SEEN_COMPLETE_TIME] = torrent->lastSeenComplete().toTime_t(); ret[KEY_TORRENT_AUTO_TORRENT_MANAGEMENT] = torrent->isAutoTMMEnabled(); + ret[KEY_TORRENT_TIME_ACTIVE] = torrent->activeTime(); if (torrent->isPaused() || torrent->isChecking()) ret[KEY_TORRENT_LAST_ACTIVITY_TIME] = 0; diff --git a/src/webui/www/public/scripts/dynamicTable.js b/src/webui/www/public/scripts/dynamicTable.js index c6e62058c..a7fe85e5b 100644 --- a/src/webui/www/public/scripts/dynamicTable.js +++ b/src/webui/www/public/scripts/dynamicTable.js @@ -754,6 +754,7 @@ var TorrentsTable = new Class({ this.newColumn('downloaded_session', '', 'QBT_TR(Session Download)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('uploaded_session', '', 'QBT_TR(Session Upload)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('amount_left', '', 'QBT_TR(Remaining)QBT_TR[CONTEXT=TorrentModel]', 100, false); + this.newColumn('time_active', '', 'QBT_TR(Time Active)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('save_path', '', 'QBT_TR(Save path)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('completed', '', 'QBT_TR(Completed)QBT_TR[CONTEXT=TorrentModel]', 100, false); this.newColumn('ratio_limit', '', 'QBT_TR(Ratio Limit)QBT_TR[CONTEXT=TorrentModel]', 100, false); @@ -1021,6 +1022,12 @@ var TorrentsTable = new Class({ else td.set('html', 'QBT_TR(%1 ago)QBT_TR[CONTEXT=TransferListDelegate]'.replace('%1', friendlyDuration((new Date()) / 1000 - val, true))); }; + + // time active + this.columns['time_active'].updateTd = function (td, row) { + var time = this.getRowValue(row); + td.set('html', friendlyDuration(time)); + }; }, applyFilter : function (row, filterName, categoryHash) {