aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm
diff options
context:
space:
mode:
authorChristopher Roy Bratusek <nano@jpberlin.de>2015-04-18 21:13:49 +0200
committerChristopher Roy Bratusek <nano@jpberlin.de>2015-04-18 21:13:49 +0200
commit66c44f3497d80c9c604d90c406121555694c7d54 (patch)
treee59a7aab71716a3fa9548923b0c2835ca4dae907 /lumina-fm
parentMerge pull request #87 from william-os4y/search (diff)
downloadlumina-66c44f3497d80c9c604d90c406121555694c7d54.tar.gz
lumina-66c44f3497d80c9c604d90c406121555694c7d54.tar.bz2
lumina-66c44f3497d80c9c604d90c406121555694c7d54.zip
lumina-fm show separated number of folders and files in status bar
Diffstat (limited to 'lumina-fm')
-rw-r--r--lumina-fm/BackgroundWorker.cpp10
-rw-r--r--lumina-fm/BackgroundWorker.h2
-rw-r--r--lumina-fm/MainUI.cpp10
-rw-r--r--lumina-fm/MainUI.h2
4 files changed, 15 insertions, 9 deletions
diff --git a/lumina-fm/BackgroundWorker.cpp b/lumina-fm/BackgroundWorker.cpp
index 125e0e1c..76b8ff8c 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 += 1;
totalSizes += fileList[i].size(); //in Bytes
}
+ else { numberFolders += 1; }
}
//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]);
diff --git a/lumina-fm/BackgroundWorker.h b/lumina-fm/BackgroundWorker.h
index d50612fa..72060cad 100644
--- a/lumina-fm/BackgroundWorker.h
+++ b/lumina-fm/BackgroundWorker.h
@@ -34,7 +34,7 @@ public slots:
//Kickoff processes with these slots
// and then listen for the appropriate signals when finished
void startDirChecks(QString path);
- void createStatusBarMsg(QFileInfoList fileList, QString path, QString message);
+ void createStatusBarMsg(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);
signals:
void ImagesAvailable(QStringList files);
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 604e4c9c..0c38ae34 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -219,7 +219,7 @@ void MainUI::setupConnections(){
connect(worker, SIGNAL(SnapshotsAvailable(QString, QStringList)), this, SLOT(AvailableBackups(QString, QStringList)) );
//Background worker class for statusbar
- connect(this, SIGNAL(Si_AdaptStatusBar(QFileInfoList, QString, QString)), worker, SLOT(createStatusBarMsg(QFileInfoList, QString, QString)) );
+ connect(this, SIGNAL(Si_AdaptStatusBar(QFileInfoList, QString, QString, QString)), worker, SLOT(createStatusBarMsg(QFileInfoList, QString, QString, QString)) );
connect(worker, SIGNAL(Si_DisplayStatusBar(QString)), this, SLOT(DisplayStatusBar(QString)) );
//Action buttons on browser page
@@ -850,7 +850,7 @@ void MainUI::currentDirectoryLoaded(){
ui->tool_goToRestore->setVisible(false);
ui->tool_goToImages->setVisible(false);
emit DirChanged(getCurrentDir());
- emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Items"));
+ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files"));
ItemSelectionChanged();
}
@@ -983,9 +983,9 @@ void MainUI::ItemSelectionChanged(){
QFileInfoList sel = getSelectedItems();
//display info related to files selected.
//TO CHECK: impact if filesystem is very slow
- if(sel.size()>0){ emit Si_AdaptStatusBar(sel, "", tr("Items selected")); }
- else{ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Items")); }
-
+ if(sel.size()>0){ emit Si_AdaptStatusBar(sel, "", tr("Selected Folders"), tr("Files"));}
+ else{ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files")); }
+
ui->tool_act_run->setEnabled(sel.length()==1);
ui->tool_act_runwith->setEnabled(sel.length()==1);
ui->tool_act_rm->setEnabled(!sel.isEmpty() && isUserWritable);
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index d88492d6..58f03ee8 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -225,7 +225,7 @@ private slots:
signals:
void DirChanged(QString path);
- void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString message);
+ void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);
protected:
void resizeEvent(QResizeEvent*);
bgstack15