mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 21:46:03 +03:00
Do display floating points with precision of 1
For several GB of quota, we might end up showing <1% far too long. So show one decimal number, unless it's zero.
This commit is contained in:
parent
4fde3f4a65
commit
d2657bc154
1 changed files with 2 additions and 12 deletions
|
@ -465,18 +465,8 @@ void Application::slotRefreshQuotaDisplay( qint64 total, qint64 used )
|
|||
return;
|
||||
}
|
||||
|
||||
double percent = used/(double)total * 100;
|
||||
QString percentFormatted;
|
||||
// Don't display floating point numbers. Nobody cares.
|
||||
if ((int)percent == 0) {
|
||||
if (percent == .0) {
|
||||
percentFormatted = QLatin1String("0");
|
||||
} else {
|
||||
percentFormatted = QLatin1String("<1");
|
||||
}
|
||||
} else {
|
||||
percentFormatted = QString::number((int)percent);
|
||||
}
|
||||
double percent = used/(double)total*100;
|
||||
QString percentFormatted = Utility::compactFormatDouble(percent, 1);
|
||||
QString totalFormatted = Utility::octetsToString(total);
|
||||
_actionQuota->setText(tr("%1% of %2 used").arg(percentFormatted).arg(totalFormatted));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue