From d3bdeaab3f46a942b6bad8e16afab73ceb27891c Mon Sep 17 00:00:00 2001 From: thalieht Date: Fri, 7 Jan 2022 09:22:51 +0200 Subject: [PATCH] Replace "seeding_duration" with "finished_duration" everywhere Closes #10223. PR #13601. --- src/base/bittorrent/session.cpp | 2 +- src/base/bittorrent/torrent.h | 1 - src/base/bittorrent/torrentimpl.cpp | 8 +------- src/base/bittorrent/torrentimpl.h | 1 - src/gui/properties/propertieswidget.cpp | 2 +- src/gui/transferlistmodel.cpp | 4 ++-- src/webui/api/serialize/serialize_torrent.cpp | 2 +- src/webui/api/torrentscontroller.cpp | 2 +- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 20adfecb9..372b410a1 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1651,7 +1651,7 @@ void Session::processShareLimits() if (torrent->seedingTimeLimit() != Torrent::NO_SEEDING_TIME_LIMIT) { - const qlonglong seedingTimeInMinutes = torrent->seedingTime() / 60; + const qlonglong seedingTimeInMinutes = torrent->finishedTime() / 60; int seedingTimeLimit = torrent->seedingTimeLimit(); if (seedingTimeLimit == Torrent::USE_GLOBAL_SEEDING_TIME) { diff --git a/src/base/bittorrent/torrent.h b/src/base/bittorrent/torrent.h index cd3c9345a..273a25c2d 100644 --- a/src/base/bittorrent/torrent.h +++ b/src/base/bittorrent/torrent.h @@ -223,7 +223,6 @@ namespace BitTorrent virtual qlonglong totalUpload() const = 0; virtual qlonglong activeTime() const = 0; virtual qlonglong finishedTime() const = 0; - virtual qlonglong seedingTime() const = 0; virtual qlonglong eta() const = 0; virtual QVector filesProgress() const = 0; virtual int seedsCount() const = 0; diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 48597dab5..d5f99528c 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -221,7 +221,6 @@ namespace status.flags = params.flags; status.active_duration = lt::seconds {params.active_time}; status.finished_duration = lt::seconds {params.finished_time}; - status.seeding_duration = lt::seconds {params.seeding_time}; status.num_complete = params.num_complete; status.num_incomplete = params.num_incomplete; status.all_time_download = params.total_downloaded; @@ -1066,11 +1065,6 @@ qlonglong TorrentImpl::finishedTime() const return lt::total_seconds(m_nativeStatus.finished_duration); } -qlonglong TorrentImpl::seedingTime() const -{ - return lt::total_seconds(m_nativeStatus.seeding_duration); -} - qlonglong TorrentImpl::eta() const { if (isPaused()) return MAX_ETA; @@ -1099,7 +1093,7 @@ qlonglong TorrentImpl::eta() const if (maxSeedingTimeValue >= 0) { - seedingTimeEta = (maxSeedingTimeValue * 60) - seedingTime(); + seedingTimeEta = (maxSeedingTimeValue * 60) - finishedTime(); if (seedingTimeEta < 0) seedingTimeEta = 0; } diff --git a/src/base/bittorrent/torrentimpl.h b/src/base/bittorrent/torrentimpl.h index d419514db..c6cb91432 100644 --- a/src/base/bittorrent/torrentimpl.h +++ b/src/base/bittorrent/torrentimpl.h @@ -158,7 +158,6 @@ namespace BitTorrent qlonglong totalUpload() const override; qlonglong activeTime() const override; qlonglong finishedTime() const override; - qlonglong seedingTime() const override; qlonglong eta() const override; QVector filesProgress() const override; int seedsCount() const override; diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 829a58311..0ca722131 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -439,7 +439,7 @@ void PropertiesWidget::loadDynamicData() if (m_torrent->isSeed()) elapsedString = tr("%1 (seeded for %2)", "e.g. 4m39s (seeded for 3m10s)") .arg(Utils::Misc::userFriendlyDuration(m_torrent->activeTime()) - , Utils::Misc::userFriendlyDuration(m_torrent->seedingTime())); + , Utils::Misc::userFriendlyDuration(m_torrent->finishedTime())); else elapsedString = Utils::Misc::userFriendlyDuration(m_torrent->activeTime()); m_ui->labelElapsedVal->setText(elapsedString); diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp index 712f8a4a0..abb336d81 100644 --- a/src/gui/transferlistmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -390,7 +390,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons case TR_AMOUNT_LEFT: return unitString(torrent->remainingSize()); case TR_TIME_ELAPSED: - return timeElapsedString(torrent->activeTime(), torrent->seedingTime()); + return timeElapsedString(torrent->activeTime(), torrent->finishedTime()); case TR_SAVE_PATH: return Utils::Fs::toNativePath(torrent->savePath()); case TR_COMPLETED: @@ -459,7 +459,7 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co case TR_AMOUNT_LEFT: return torrent->remainingSize(); case TR_TIME_ELAPSED: - return !alt ? torrent->activeTime() : torrent->seedingTime(); + return !alt ? torrent->activeTime() : torrent->finishedTime(); case TR_SAVE_PATH: return Utils::Fs::toNativePath(torrent->savePath()); case TR_COMPLETED: diff --git a/src/webui/api/serialize/serialize_torrent.cpp b/src/webui/api/serialize/serialize_torrent.cpp index 3317c591d..204f3d3a2 100644 --- a/src/webui/api/serialize/serialize_torrent.cpp +++ b/src/webui/api/serialize/serialize_torrent.cpp @@ -153,7 +153,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent) {KEY_TORRENT_LAST_SEEN_COMPLETE_TIME, torrent.lastSeenComplete().toSecsSinceEpoch()}, {KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()}, {KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()}, - {KEY_TORRENT_SEEDING_TIME, torrent.seedingTime()}, + {KEY_TORRENT_SEEDING_TIME, torrent.finishedTime()}, {KEY_TORRENT_LAST_ACTIVITY_TIME, getLastActivityTime()}, {KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()}, diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 46dc23528..91c8586d3 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -390,7 +390,7 @@ void TorrentsController::propertiesAction() dataDict[KEY_TORRENT_INFOHASHV1] = torrent->infoHash().v1().toString(); dataDict[KEY_TORRENT_INFOHASHV2] = torrent->infoHash().v2().toString(); dataDict[KEY_PROP_TIME_ELAPSED] = torrent->activeTime(); - dataDict[KEY_PROP_SEEDING_TIME] = torrent->seedingTime(); + dataDict[KEY_PROP_SEEDING_TIME] = torrent->finishedTime(); dataDict[KEY_PROP_ETA] = static_cast(torrent->eta()); dataDict[KEY_PROP_CONNECT_COUNT] = torrent->connectionsCount(); dataDict[KEY_PROP_CONNECT_COUNT_LIMIT] = torrent->connectionsLimit();