use formattedDataSize for displaying sizes
This commit is contained in:
parent
9c094fb094
commit
8975d15683
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QLocale>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
|
||||||
#include <algorithm>
|
#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) {
|
static inline QDebug operator<<(QDebug debug, std::string const &t) {
|
||||||
debug << QString::fromStdString(t);
|
debug << QString::fromStdString(t);
|
||||||
return debug;
|
return debug;
|
||||||
|
|
|
@ -195,7 +195,7 @@ namespace Arc {
|
||||||
switch(col) {
|
switch(col) {
|
||||||
case Column::Size:
|
case Column::Size:
|
||||||
if(auto file = node->getFile()) {
|
if(auto file = node->getFile()) {
|
||||||
return QVariant{QString::number(file->size())};
|
return QVariant{toBinSize(file->size())};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user