Added backup manager.

This commit is contained in:
codestation
2013-08-28 17:53:02 -04:30
parent 3530e28b43
commit b6b482046d
8 changed files with 51 additions and 10 deletions

View File

@@ -155,3 +155,23 @@ QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata
}
return data;
}
QString readable_size(quint64 size, bool use_gib)
{
QStringList list;
list << "KiB" << "MiB";
if(use_gib) {
list << "GiB";
}
QStringListIterator i(list);
QString unit("bytes");
float size_f = size;
while(size_f >= 1024.0 && i.hasNext()) {
unit = i.next();
size_f /= 1024.0;
}
return QString().setNum(size_f,'f',2) + " " + unit;
}