#include "BackgroundWorker.h" #include #include #include #include #include BackgroundWorker::BackgroundWorker() : QObject(){ } BackgroundWorker::~BackgroundWorker(){ } void BackgroundWorker::startDirChecks(QString path){ QDir dir(path); //Make sure to remove any symlinks or redundency in the path if(dir.canonicalPath()!=path){ path = dir.canonicalPath(); dir.cd(path); } qDebug() << "Starting Dir Checks:" << path; //First check for image files if(imgFilter.isEmpty()){ //Initial Run - load supported image extensions QList fmt = QImageReader::supportedImageFormats(); for(int i=0; i 1024){ cunit++; totalSizes = totalSizes/1024; } //Assemble the message QString msgStatusBar = QString(tr("%1: %2")).arg(message).arg(fileList.length()); 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]); } //If a path given, get the total capacity of it (percantage) if (!path.isEmpty()) { //path could be empty when fileList is based on user's selection QString capacity = LOS::FileSystemCapacity(path) ; if (msgStatusBar.isEmpty()) msgStatusBar += QString(tr("Capacity: %1")).arg(capacity); else msgStatusBar += " "+QString(tr("Capacity: %1")).arg(capacity); } //Emit the signal to show this on the UI if (!msgStatusBar.isEmpty()){ emit Si_DisplayStatusBar(msgStatusBar); } }