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:
Gabriele 2014-10-24 20:41:06 +01:00
parent a501f9d223
commit b1af99ffba
4 changed files with 22 additions and 1 deletions

View file

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