mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Add "Last Activity" column to transfer list
This column shows the time elapsed since the related torrent has received or sent a chunk. Closes #517.
This commit is contained in:
parent
a501f9d223
commit
b1af99ffba
4 changed files with 22 additions and 1 deletions
|
@ -201,6 +201,18 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
case TorrentModelItem::TR_LAST_ACTIVITY: {
|
||||
QString elapsedString;
|
||||
long long elapsed = index.data().toLongLong();
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
if (elapsed == 0)
|
||||
// Show '< 1m ago' when elapsed time is 0
|
||||
elapsed = 1;
|
||||
elapsedString = tr("%1 ago", "e.g.: 1h 20m ago").arg(misc::userFriendlyDuration(elapsed));
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, elapsedString);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue