Changeset View
Changeset View
Standalone View
Standalone View
src/collectionpage/collectionquotawidget.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 44 | { | |||
---|---|---|---|---|---|
57 | // xgettext: no-c-format | 57 | // xgettext: no-c-format | ||
58 | mProgressBar->setFormat(i18n("%p% full")); | 58 | mProgressBar->setFormat(i18n("%p% full")); | ||
59 | layout->addWidget(mProgressBar, 1, 1); | 59 | layout->addWidget(mProgressBar, 1, 1); | ||
60 | layout->setRowStretch(2, 1); | 60 | layout->setRowStretch(2, 1); | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | void CollectionQuotaWidget::setQuotaInfo(qint64 current, qint64 maxValue) | 63 | void CollectionQuotaWidget::setQuotaInfo(qint64 current, qint64 maxValue) | ||
64 | { | 64 | { | ||
65 | mProgressBar->setMaximum(maxValue); | 65 | int perc = qBound(0, qRound(100.0 * current / qMax(1LL, maxValue)), 100); | ||
66 | mProgressBar->setValue(current); | 66 | mProgressBar->setValue(perc); | ||
67 | mUsage->setText(i18n("%1 of %2 used", KFormat().formatByteSize(qMax(0LL, current)), KFormat().formatByteSize(qMax(0LL, maxValue)))); | 67 | mUsage->setText(i18n("%1 of %2 used", KFormat().formatByteSize(qMax(0LL, current)), KFormat().formatByteSize(qMax(0LL, maxValue)))); | ||
68 | } | 68 | } |