Browse Source

use formattedDataSize for displaying sizes

master
Alison Watson 1 year ago
parent
commit
8975d15683
2 changed files with 6 additions and 1 deletions
  1. +5
    -0
      source/common.h
  2. +1
    -1
      source/quam/archive.cc

+ 5
- 0
source/common.h 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;


+ 1
- 1
source/quam/archive.cc 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:


Loading…
Cancel
Save