aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-fileinfo/dialog.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lumina-fileinfo/dialog.cpp b/lumina-fileinfo/dialog.cpp
index 6141b961..335d05aa 100644
--- a/lumina-fileinfo/dialog.cpp
+++ b/lumina-fileinfo/dialog.cpp
@@ -154,15 +154,12 @@ void Dialog::LoadDesktopFile(QString input)
else{ type = info.suffix().toUpper(); }
if(info.isHidden()){ type = QString(tr("Hidden %1")).arg(type); }
ui->label_file_type->setText(type);
- double bytes = info.size();
- QStringList lab; lab << "B" << "KB" << "MB" << "GB" << "TB" << "PB";
- int i=0;
- while(i<lab.length() && bytes>1024){
- bytes = bytes/1024;
- i++; //next label
+ //Calculate the size of the file/dir
+ QString sz;
+ if(!info.isDir()){
+ sz = LUtils::BytesToDisplaySize(info.size());
}
- //convert the size to two decimel places and add the label
- QString sz = QString::number( qRound(bytes*100)/100.0 )+lab[i];
+ // TO-DO calculate the total size of all files within this directory (in a background thread)
ui->label_file_size->setText( sz );
ui->label_file_owner->setText(info.owner());
ui->label_file_group->setText(info.group());
bgstack15