use formattedDataSize for displaying sizes

This commit is contained in:
alison wright 2019-11-09 15:30:23 -05:00
parent 9c094fb094
commit 8975d15683
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include <QCoreApplication>
#include <QDebug>
#include <QLocale>
#include <QMetaEnum>
#include <algorithm>
@ -172,6 +173,10 @@ static inline T orThrow(Option<T> opt, Error err) {
}
}
static inline QString toBinSize(qint64 bytes) {
return QLocale().formattedDataSize(bytes, 2, QLocale::DataSizeSIFormat);
}
static inline QDebug operator<<(QDebug debug, std::string const &t) {
debug << QString::fromStdString(t);
return debug;

View File

@ -195,7 +195,7 @@ namespace Arc {
switch(col) {
case Column::Size:
if(auto file = node->getFile()) {
return QVariant{QString::number(file->size())};
return QVariant{toBinSize(file->size())};
}
break;
case Column::Type: