more unfinished changes, process tab for dashboard
This commit is contained in:
@@ -14,6 +14,24 @@ bool finitePositive(qreal v) {
|
||||
|
||||
namespace ZShell::services::usagefmt {
|
||||
|
||||
FormatResult UsageFmt::formatKib(qreal kib) const {
|
||||
if (!finitePositive(kib)) {
|
||||
return {0.0, 0.0, "KiB"};
|
||||
}
|
||||
|
||||
if (kib >= kGib) {
|
||||
return {kib / kGib, 0.0, "GiB"};
|
||||
}
|
||||
if (kib >= kMib) {
|
||||
return {kib / kMib, 0.0, "MiB"};
|
||||
}
|
||||
if (kib >= kKib) {
|
||||
return {kib / kKib, 0.0, "KiB"};
|
||||
}
|
||||
|
||||
return {kib, 0.0, "KiB"};
|
||||
}
|
||||
|
||||
FormatResult UsageFmt::formatKib(qreal kib, qreal total) const {
|
||||
if (!finitePositive(kib) || !finitePositive(total)) {
|
||||
return {0.0, 0.0, "KiB"};
|
||||
|
||||
Reference in New Issue
Block a user