From 2d12c126eb8b422dba19a12306dd91ba9c2a4599 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 26 Sep 2017 01:14:49 +0800 Subject: [PATCH] Fix "Time active" field in transfer list The "Time active" field was broken, displaying nothing when in downloading state. Also change type to int to match the return types of TorrentHandle::activeTime() & TorrentHandle::seedingTime() --- src/gui/transferlistdelegate.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index 6187cc245..995fb89f1 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -122,13 +122,13 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem break; } case TorrentModel::TR_TIME_ELAPSED: { - qlonglong elapsedTime = index.data().toLongLong(); - qlonglong seedingTime = index.data(Qt::UserRole).toLongLong(); - QString txt; - if (seedingTime > 0) - txt += tr("%1 (seeded for %2)", "e.g. 4m39s (seeded for 3m10s)") - .arg(Utils::Misc::userFriendlyDuration(elapsedTime)) - .arg(Utils::Misc::userFriendlyDuration(seedingTime)); + const int elapsedTime = index.data().toInt(); + const int seedingTime = index.data(Qt::UserRole).toInt(); + const QString txt = (seedingTime > 0) + ? tr("%1 (seeded for %2)", "e.g. 4m39s (seeded for 3m10s)") + .arg(Utils::Misc::userFriendlyDuration(elapsedTime)) + .arg(Utils::Misc::userFriendlyDuration(seedingTime)) + : Utils::Misc::userFriendlyDuration(elapsedTime); QItemDelegate::drawDisplay(painter, opt, opt.rect, txt); break; }