mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Show "last activity" value under all circumstances
This commit is contained in:
parent
a4ce5d1687
commit
6864e13e6f
@ -403,7 +403,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
|
|||||||
case TR_SEEN_COMPLETE_DATE:
|
case TR_SEEN_COMPLETE_DATE:
|
||||||
return QLocale().toString(torrent->lastSeenComplete().toLocalTime(), QLocale::ShortFormat);
|
return QLocale().toString(torrent->lastSeenComplete().toLocalTime(), QLocale::ShortFormat);
|
||||||
case TR_LAST_ACTIVITY:
|
case TR_LAST_ACTIVITY:
|
||||||
return lastActivityString((torrent->isPaused() || torrent->isChecking()) ? -1 : torrent->timeSinceActivity());
|
return lastActivityString(torrent->timeSinceActivity());
|
||||||
case TR_AVAILABILITY:
|
case TR_AVAILABILITY:
|
||||||
return availabilityString(torrent->distributedCopies());
|
return availabilityString(torrent->distributedCopies());
|
||||||
case TR_TOTAL_SIZE:
|
case TR_TOTAL_SIZE:
|
||||||
@ -474,7 +474,7 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co
|
|||||||
case TR_SEEN_COMPLETE_DATE:
|
case TR_SEEN_COMPLETE_DATE:
|
||||||
return torrent->lastSeenComplete();
|
return torrent->lastSeenComplete();
|
||||||
case TR_LAST_ACTIVITY:
|
case TR_LAST_ACTIVITY:
|
||||||
return (torrent->isPaused() || torrent->isChecking()) ? -1 : torrent->timeSinceActivity();
|
return torrent->timeSinceActivity();
|
||||||
case TR_AVAILABILITY:
|
case TR_AVAILABILITY:
|
||||||
return torrent->distributedCopies();
|
return torrent->distributedCopies();
|
||||||
case TR_TOTAL_SIZE:
|
case TR_TOTAL_SIZE:
|
||||||
|
@ -95,13 +95,6 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|||||||
return (ratio > BitTorrent::Torrent::MAX_RATIO) ? -1 : ratio;
|
return (ratio > BitTorrent::Torrent::MAX_RATIO) ? -1 : ratio;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto adjustLastActivity = [&torrent](const qlonglong value) -> qlonglong
|
|
||||||
{
|
|
||||||
return (torrent.isPaused() || torrent.isChecking())
|
|
||||||
? 0
|
|
||||||
: (QDateTime::currentDateTime().toSecsSinceEpoch() - value);
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// TODO: Add fields for real SHA1 and SHA256 hashes
|
// TODO: Add fields for real SHA1 and SHA256 hashes
|
||||||
{KEY_TORRENT_ID, QString(torrent.id().toString())},
|
{KEY_TORRENT_ID, QString(torrent.id().toString())},
|
||||||
@ -149,7 +142,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|||||||
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()},
|
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()},
|
||||||
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()},
|
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()},
|
||||||
{KEY_TORRENT_SEEDING_TIME, torrent.seedingTime()},
|
{KEY_TORRENT_SEEDING_TIME, torrent.seedingTime()},
|
||||||
{KEY_TORRENT_LAST_ACTIVITY_TIME, adjustLastActivity(torrent.timeSinceActivity())},
|
{KEY_TORRENT_LAST_ACTIVITY_TIME, (QDateTime::currentDateTime().toSecsSinceEpoch() - torrent.timeSinceActivity())},
|
||||||
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()},
|
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()},
|
||||||
|
|
||||||
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()}
|
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()}
|
||||||
|
Loading…
Reference in New Issue
Block a user