1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-09 06:17:58 +00:00

Check cheaper conditional first

This commit is contained in:
thalieht 2020-10-11 20:22:27 +03:00
parent 95b452a3e9
commit 9d25405144

View File

@ -239,19 +239,19 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
const auto availabilityString = [hideValues](const qreal value) -> QString
{
return ((value <= 0) && hideValues)
return (hideValues && (value <= 0))
? QString {} : Utils::String::fromDouble(value, 3);
};
const auto unitString = [hideValues](const qint64 value, const bool isSpeedUnit = false) -> QString
{
return ((value == 0) && hideValues)
return (hideValues && (value == 0))
? QString {} : Utils::Misc::friendlyUnit(value, isSpeedUnit);
};
const auto limitString = [hideValues](const qint64 value) -> QString
{
if ((value == 0) && hideValues)
if (hideValues && (value == 0))
return {};
return (value > 0)
@ -261,14 +261,14 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
const auto amountString = [hideValues](const qint64 value, const qint64 total) -> QString
{
return ((value == 0) && (total == 0) && hideValues)
return (hideValues && (value == 0) && (total == 0))
? QString {}
: QString::number(value) + " (" + QString::number(total) + ')';
};
const auto ratioString = [hideValues](const qreal value) -> QString
{
if ((value <= 0) && hideValues)
if (hideValues && (value <= 0))
return {};
return ((static_cast<int>(value) == -1) || (value > BitTorrent::TorrentHandle::MAX_RATIO))