mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
commit
63b0a5b78c
@ -147,7 +147,7 @@ install:
|
|||||||
|
|
||||||
sudo dpkg -i "$HOME/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb" "$HOME/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb"
|
sudo dpkg -i "$HOME/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb" "$HOME/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb"
|
||||||
fi
|
fi
|
||||||
- |
|
- |
|
||||||
if [ "$libt_branch" = "RC_1_1" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
if [ "$libt_branch" = "RC_1_1" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
wget https://builds.shiki.hu/travis/brew/1_1/version
|
wget https://builds.shiki.hu/travis/brew/1_1/version
|
||||||
if ! cmp --quiet "version" "$HOME/travis/brew/1_1/version" ; then
|
if ! cmp --quiet "version" "$HOME/travis/brew/1_1/version" ; then
|
||||||
|
@ -80,13 +80,13 @@ namespace
|
|||||||
if (sizeInBytes < 0) return false;
|
if (sizeInBytes < 0) return false;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
auto rawVal = static_cast<qreal>(sizeInBytes);
|
val = static_cast<qreal>(sizeInBytes);
|
||||||
|
|
||||||
while ((rawVal >= 1024.) && (i <= static_cast<int>(Utils::Misc::SizeUnit::ExbiByte))) {
|
while ((val >= 1024.) && (i <= static_cast<int>(Utils::Misc::SizeUnit::ExbiByte))) {
|
||||||
rawVal /= 1024.;
|
val /= 1024.;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
val = rawVal;
|
|
||||||
unit = static_cast<Utils::Misc::SizeUnit>(i);
|
unit = static_cast<Utils::Misc::SizeUnit>(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -250,13 +250,20 @@ QString Utils::Misc::friendlyUnit(const qint64 bytesValue, const bool isSpeed)
|
|||||||
+ unitString(unit, isSpeed);
|
+ unitString(unit, isSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::Misc::friendlyUnitPrecision(SizeUnit unit)
|
int Utils::Misc::friendlyUnitPrecision(const SizeUnit unit)
|
||||||
{
|
{
|
||||||
// friendlyUnit's number of digits after the decimal point
|
// friendlyUnit's number of digits after the decimal point
|
||||||
if (unit == SizeUnit::Byte) return 0;
|
switch (unit) {
|
||||||
if (unit <= SizeUnit::MebiByte) return 1;
|
case SizeUnit::Byte:
|
||||||
if (unit == SizeUnit::GibiByte) return 2;
|
return 0;
|
||||||
return 3;
|
case SizeUnit::KibiByte:
|
||||||
|
case SizeUnit::MebiByte:
|
||||||
|
return 1;
|
||||||
|
case SizeUnit::GibiByte:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qlonglong Utils::Misc::sizeInBytes(qreal size, const Utils::Misc::SizeUnit unit)
|
qlonglong Utils::Misc::sizeInBytes(qreal size, const Utils::Misc::SizeUnit unit)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user