diff options
author | Ken Moore <moorekou@gmail.com> | 2015-04-20 09:19:04 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-04-20 09:19:04 -0400 |
commit | 6810cc5ee38d47d7a30cff18067c612857a195e9 (patch) | |
tree | 19a6282f2741e9468e3100008c005c46120e66e1 /lumina-fm/BackgroundWorker.cpp | |
parent | Merge pull request #88 from Nanolx/master (diff) | |
parent | use ++ in createStatusBarMgs over += 1 (diff) | |
download | lumina-6810cc5ee38d47d7a30cff18067c612857a195e9.tar.gz lumina-6810cc5ee38d47d7a30cff18067c612857a195e9.tar.bz2 lumina-6810cc5ee38d47d7a30cff18067c612857a195e9.zip |
Merge pull request #90 from Nanolx/lumina-fm-info
lumina-fm show separated number of folders and files in status bar
Diffstat (limited to 'lumina-fm/BackgroundWorker.cpp')
-rw-r--r-- | lumina-fm/BackgroundWorker.cpp | 10 |
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]); |