mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 23:42:46 -07:00
Support creating .torrent with larger piece size
Warning: users are at their own discretion to create .torrent with >= 64 MiB piece size as not every torrent client supports it. Larger piece sizes are only available when using libtorrent 2.x. libtorrent 1.x is not efficient with memory usage and in order to avoid user complaints it is limited to 128 MiB. Also note that, as of this writing, libtorrent 2.0.9 has an internal limitation that only allows loading maximum 256 MiB piece size. And therefore > 256 MiB size options are forbidden for now. Closes #19527. PR #19535.
This commit is contained in:
parent
2dc1a7d66f
commit
4d2015cfed
4 changed files with 27 additions and 76 deletions
|
@ -259,12 +259,14 @@ QString Utils::Misc::unitString(const SizeUnit unit, const bool isSpeed)
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString Utils::Misc::friendlyUnit(const qint64 bytes, const bool isSpeed)
|
||||
QString Utils::Misc::friendlyUnit(const qint64 bytes, const bool isSpeed, const int precision)
|
||||
{
|
||||
const std::optional<SplitToFriendlyUnitResult> result = splitToFriendlyUnit(bytes);
|
||||
if (!result)
|
||||
return QCoreApplication::translate("misc", "Unknown", "Unknown (size)");
|
||||
return Utils::String::fromDouble(result->value, friendlyUnitPrecision(result->unit))
|
||||
|
||||
const int digitPrecision = (precision >= 0) ? precision : friendlyUnitPrecision(result->unit);
|
||||
return Utils::String::fromDouble(result->value, digitPrecision)
|
||||
+ C_NON_BREAKING_SPACE
|
||||
+ unitString(result->unit, isSpeed);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue