Merge pull request #123 from g4z3r/ogl

correct sizes and dates in FileDialog
This commit is contained in:
Vadim Lopatin 2015-12-19 06:40:06 +03:00
commit fc5407f1ec
1 changed files with 7 additions and 2 deletions

View File

@ -216,8 +216,13 @@ class FileDialog : Dialog, CustomGridCellAdapter {
else
resname = "text-plain";
_fileList.setCellText(0, i, toUTF32(resname));
sz = to!string(_entries[i].size);
date = "2014-01-01 00:00:00";
double size = _entries[i].size;
import std.format : format;
sz = size < 1024 ? to!string(size) ~ " B" :
(size < 1024*1024 ? "%.1f".format(size/1024) ~ " KB" :
(size < 1024*1024*1024 ? "%.1f".format(size/(1024*1024)) ~ " MB" :
"%.1f".format(size/(1024*1024*1024)) ~ " GB"));
date = _entries[i].timeLastModified.toSimpleString();
}
_fileList.setCellText(2, i, toUTF32(sz));
_fileList.setCellText(3, i, toUTF32(date));