mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-29 03:38:05 -06: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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user