Add Time Active column

This commit is contained in:
Thomas Piccirello 2017-11-27 01:35:15 -05:00
parent ee37f1db3d
commit a05562cdc5
2 changed files with 9 additions and 0 deletions

View file

@ -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;

View file

@ -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) {