aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/BackgroundWorker.cpp
diff options
context:
space:
mode:
authorwi <william.os4y@gmail.com>2015-04-20 21:53:25 +0200
committerwi <william.os4y@gmail.com>2015-04-20 21:53:25 +0200
commita33566d53dab6f5bf3d4b6663014b6b548446525 (patch)
tree6e57deaa6afc289cb6a51a523e2fb1530830bd9c /lumina-fm/BackgroundWorker.cpp
parentThis is a complete adaptation of lumina-fileinfo. (diff)
parentAdd a special flag to prevent the lumina-open crash handler from starting up ... (diff)
downloadlumina-a33566d53dab6f5bf3d4b6663014b6b548446525.tar.gz
lumina-a33566d53dab6f5bf3d4b6663014b6b548446525.tar.bz2
lumina-a33566d53dab6f5bf3d4b6663014b6b548446525.zip
Merge remote-tracking branch 'upstream/master' into deskEditor
Diffstat (limited to 'lumina-fm/BackgroundWorker.cpp')
-rw-r--r--lumina-fm/BackgroundWorker.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lumina-fm/BackgroundWorker.cpp b/lumina-fm/BackgroundWorker.cpp
index 125e0e1c..02d2f02e 100644
--- a/lumina-fm/BackgroundWorker.cpp
+++ b/lumina-fm/BackgroundWorker.cpp
@@ -88,14 +88,19 @@ void BackgroundWorker::startDirChecks(QString path){
}
-void BackgroundWorker::createStatusBarMsg(QFileInfoList fileList, QString path, QString message){
+void BackgroundWorker::createStatusBarMsg(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles){
+
//collect some statistics of dir and display them in statusbar
//Get the total size of the items
double totalSizes = 0;
+ int numberFolders = 0;
+ int numberFiles = 0;
for(int i=0; i<fileList.length(); i++){
if(!fileList[i].isDir()){
+ numberFiles++;
totalSizes += fileList[i].size(); //in Bytes
}
+ else { numberFolders++; }
}
//Convert the size into display units
static QStringList units = QStringList() << tr("B") << tr("KB") << tr("MB") << tr("GB") << tr("TB");
@@ -105,7 +110,8 @@ void BackgroundWorker::createStatusBarMsg(QFileInfoList fileList, QString path,
totalSizes = totalSizes/1024;
}
//Assemble the message
- QString msgStatusBar = QString(tr("%1: %2")).arg(message).arg(fileList.length());
+ QString msgStatusBar = QString(tr("%1: %2 / %3: %4")).arg(messageFolders).arg(numberFolders).arg(messageFiles).arg(numberFiles);
+
if(totalSizes > 0){
totalSizes = qRound(totalSizes*100)/100.0; //round to 2 decimel places
msgStatusBar += " "+QString(tr("Total size: %1 %2")).arg(QString::number(totalSizes), units[cunit]);
bgstack15