fix: details dialog "available" percent can be off (#2025)

It's often off by a little bit because it fails to account for blocks
we've downloaded but haven't been verified yet. Copied the fix from the
GTK client.
This commit is contained in:
Charles Kerr 2021-10-23 23:45:10 -05:00 committed by GitHub
parent d70c8387b3
commit 1413346fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -488,7 +488,7 @@ void DetailsDialog::refreshUI()
have_verified += v;
size_when_done += t->sizeWhenDone();
left_until_done += t->leftUntilDone();
available += t->sizeWhenDone() - t->leftUntilDone() + t->desiredAvailable();
available += t->sizeWhenDone() - t->leftUntilDone() + t->haveUnverified() + t->desiredAvailable();
}
}

View File

@ -581,7 +581,7 @@ std::vector<std::string_view> const& Session::getKeyNames(TorrentProperties prop
};
// changing fields needed by the details dialog
static auto constexpr DetailStatKeys = std::array<tr_quark, 17>{
static auto constexpr DetailStatKeys = std::array<tr_quark, 18>{
TR_KEY_activityDate, //
TR_KEY_bandwidthPriority, //
TR_KEY_corruptEver, //
@ -590,6 +590,7 @@ std::vector<std::string_view> const& Session::getKeyNames(TorrentProperties prop
TR_KEY_downloadLimit, //
TR_KEY_downloadLimited, //
TR_KEY_fileStats, //
TR_KEY_haveUnchecked, //
TR_KEY_honorsSessionLimits, //
TR_KEY_peer_limit, //
TR_KEY_peers, //