aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilliam <william.os4y@gmail.com>2015-03-20 20:19:52 +0100
committerwilliam <william.os4y@gmail.com>2015-03-20 20:19:52 +0100
commit9c4e49050dc9230f3abd80e81de4a01cbff90e32 (patch)
tree10a76c0e3c558f5cbcd5112ba8b28a5f1384539e
parentDisplay the number of items in a directory in the statusBar (diff)
downloadlumina-9c4e49050dc9230f3abd80e81de4a01cbff90e32.tar.gz
lumina-9c4e49050dc9230f3abd80e81de4a01cbff90e32.tar.bz2
lumina-9c4e49050dc9230f3abd80e81de4a01cbff90e32.zip
Add in statusBar, side to the number of items displayed, the size of the files
-rw-r--r--lumina-fm/MainUI.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 1a8612c7..711022ec 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -448,7 +448,27 @@ void MainUI::setCurrentDir(QString dir){
if(isUserWritable){ ui->label_dir_stats->setText(""); }
else{ ui->label_dir_stats->setText(tr("Limited Access Directory"));
}
- QString strSize = QString(tr("Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size());
+ QFileInfoList fileList = fsmod->rootDirectory().entryInfoList();
+ int i = 0;
+ qreal totalSizes = 0;
+ foreach (QFileInfo fileInfo, fileList )
+ {
+ if (fileInfo.isFile()) {
+ totalSizes += fileInfo.size();
+ i += 1;
+ }
+ }
+ QString strSize = QString(tr("Items: %1")).arg(i);
+ if (i>0 and totalSizes>1024*1024*1024)
+ strSize += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2);
+ else if (i>0 and totalSizes>1024*1024)
+ strSize += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2);
+ else if (i>0 and totalSizes>1024)
+ strSize += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2);
+ else
+ if (i>0) { strSize += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);}
+
+
ui->statusbar->showMessage(strSize);
ui->tool_addToDir->setVisible(isUserWritable);
ui->tool_addNewFile->setVisible(isUserWritable);
bgstack15