aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/BackgroundWorker.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-03-26 15:22:21 -0400
committerKen Moore <moorekou@gmail.com>2015-03-26 15:22:21 -0400
commitf6891cc964fb3f2b1e769be0aa9b24219cac79c1 (patch)
tree6eda92367dc7e22f701b070d14b28ed82163934d /lumina-fm/BackgroundWorker.cpp
parentActually move the file/dir copy onto itself check earlier in the procedure, t... (diff)
parentMerge remote-tracking branch 'upstream/master' into fmNumbers (diff)
downloadlumina-f6891cc964fb3f2b1e769be0aa9b24219cac79c1.tar.gz
lumina-f6891cc964fb3f2b1e769be0aa9b24219cac79c1.tar.bz2
lumina-f6891cc964fb3f2b1e769be0aa9b24219cac79c1.zip
Merge pull request #77 from william-os4y/fmNumbers
include some information about the files in the statusbar
Diffstat (limited to 'lumina-fm/BackgroundWorker.cpp')
-rw-r--r--lumina-fm/BackgroundWorker.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/lumina-fm/BackgroundWorker.cpp b/lumina-fm/BackgroundWorker.cpp
index 1438f71e..c8d7cb17 100644
--- a/lumina-fm/BackgroundWorker.cpp
+++ b/lumina-fm/BackgroundWorker.cpp
@@ -85,4 +85,31 @@ void BackgroundWorker::startDirChecks(QString path){
if(!snapDirs.isEmpty()){ emit SnapshotsAvailable(baseSnapDir, snapDirs); }
qDebug() << "Found snapshots";
}
-} \ No newline at end of file
+}
+
+
+void BackgroundWorker::createStatusBarMsg(QFileInfoList fileList, QString path, QString message){
+ //collect some statistics of dir and display them in statusbar
+ int i = 0;
+ qreal totalSizes = 0;
+ foreach (QFileInfo fileInfo, fileList )
+ {
+ if (fileInfo.isFile()) totalSizes += fileInfo.size();
+ i += 1;
+ }
+ QString msgStatusBar = QString(tr("%1: %2")).arg(message).arg(i);
+ if (i>0 and totalSizes>1024*1024*1024)
+ msgStatusBar += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2);
+ else if (i>0 and totalSizes>1024*1024)
+ msgStatusBar += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2);
+ else if (i>0 and totalSizes>1024)
+ msgStatusBar += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2);
+ else
+ if (totalSizes > 0) { msgStatusBar += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);}
+ if (!path.isEmpty()) { //path could be empty when fileList is based on user's selection
+ QString capacity = LOS::FileSystemCapacity(path) ;
+ if (msgStatusBar.isEmpty()) msgStatusBar += tr("Capacity: ") + capacity;
+ else msgStatusBar += tr(", Capacity: ") + capacity;
+ }
+ if (!msgStatusBar.isEmpty()) emit Si_DisplayStatusBar(msgStatusBar);
+}
bgstack15