From a8fe20e682615b329dbe6520dbf985d42c207790 Mon Sep 17 00:00:00 2001 From: william os4y Date: Thu, 26 Feb 2015 21:49:55 +0100 Subject: display Items count in the bottom bar --- lumina-fm/MainUI.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index fe3240dc..9b7ebcc6 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -445,8 +445,15 @@ void MainUI::setCurrentDir(QString dir){ //if(olddir!=rawdir){ emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded //} - if(isUserWritable){ ui->label_dir_stats->setText(""); } - else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } + if(isUserWritable){ + if (DEBUG) {qDebug() << "# Items:" << fsmod->rootDirectory().entryInfoList().size();} + QString strSize = QString(tr("Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); + ui->label_dir_stats->setText(strSize); + } + else{ + QString strSize = QString(tr("Limited Access Directory. Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); + ui->label_dir_stats->setText(strSize); + } ui->tool_addToDir->setVisible(isUserWritable); ui->tool_addNewFile->setVisible(isUserWritable); ui->actionUpDir->setEnabled(dir!="/"); -- cgit From a5d95ee21de03ee0531847aafe3ab7e37bd517ab Mon Sep 17 00:00:00 2001 From: william Date: Fri, 20 Mar 2015 08:09:47 +0100 Subject: Display the number of items in a directory in the statusBar --- lumina-fm/MainUI.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 187922e1..1a8612c7 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -445,15 +445,11 @@ void MainUI::setCurrentDir(QString dir){ //if(olddir!=rawdir){ emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded //} - if(isUserWritable){ - if (DEBUG) {qDebug() << "# Items:" << fsmod->rootDirectory().entryInfoList().size();} - QString strSize = QString(tr("Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); - ui->label_dir_stats->setText(strSize); - } - else{ - QString strSize = QString(tr("Limited Access Directory. Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); - ui->label_dir_stats->setText(strSize); + if(isUserWritable){ ui->label_dir_stats->setText(""); } + else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } + QString strSize = QString(tr("Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); + ui->statusbar->showMessage(strSize); ui->tool_addToDir->setVisible(isUserWritable); ui->tool_addNewFile->setVisible(isUserWritable); ui->actionUpDir->setEnabled(dir!="/"); -- cgit From 9c4e49050dc9230f3abd80e81de4a01cbff90e32 Mon Sep 17 00:00:00 2001 From: william Date: Fri, 20 Mar 2015 20:19:52 +0100 Subject: Add in statusBar, side to the number of items displayed, the size of the files --- lumina-fm/MainUI.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 1a8612c7..711022ec 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -448,7 +448,27 @@ void MainUI::setCurrentDir(QString dir){ if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } - QString strSize = QString(tr("Items:")) + QString::number(fsmod->rootDirectory().entryInfoList().size()); + QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); + int i = 0; + qreal totalSizes = 0; + foreach (QFileInfo fileInfo, fileList ) + { + if (fileInfo.isFile()) { + totalSizes += fileInfo.size(); + i += 1; + } + } + QString strSize = QString(tr("Items: %1")).arg(i); + if (i>0 and totalSizes>1024*1024*1024) + strSize += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2); + else if (i>0 and totalSizes>1024*1024) + strSize += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2); + else if (i>0 and totalSizes>1024) + strSize += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2); + else + if (i>0) { strSize += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);} + + ui->statusbar->showMessage(strSize); ui->tool_addToDir->setVisible(isUserWritable); ui->tool_addNewFile->setVisible(isUserWritable); -- cgit From 3386ba378052c028cf34fd22f72101847365380a Mon Sep 17 00:00:00 2001 From: william Date: Sat, 21 Mar 2015 00:02:20 +0100 Subject: Add possibility to calculate the file size of the selected items. Refactoring of the procedure --- lumina-fm/MainUI.cpp | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 711022ec..a7043195 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -396,6 +396,27 @@ QString MainUI::getCurrentDir(){ return currentDir->whatsThis(); } +QString MainUI::ItemsInstatusBar(QFileInfoList fileList, QString message){ + int i = 0; + qreal totalSizes = 0; + foreach (QFileInfo fileInfo, fileList ) + { + if (fileInfo.isFile()) totalSizes += fileInfo.size(); + i += 1; + } + if (i==0) return ""; + QString strSize = QString(tr("%1: %2")).arg(message).arg(i); + if (i>0 and totalSizes>1024*1024*1024) + strSize += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2); + else if (i>0 and totalSizes>1024*1024) + strSize += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2); + else if (i>0 and totalSizes>1024) + strSize += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2); + else + if (totalSizes > 0) { strSize += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);} + return strSize; +} + void MainUI::setCurrentDir(QString dir){ if(dir.isEmpty()){ return; } if(syncTimer->isActive()){ syncTimer->stop(); } //already loading the info @@ -449,27 +470,9 @@ void MainUI::setCurrentDir(QString dir){ else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); - int i = 0; - qreal totalSizes = 0; - foreach (QFileInfo fileInfo, fileList ) - { - if (fileInfo.isFile()) { - totalSizes += fileInfo.size(); - i += 1; - } - } - QString strSize = QString(tr("Items: %1")).arg(i); - if (i>0 and totalSizes>1024*1024*1024) - strSize += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2); - else if (i>0 and totalSizes>1024*1024) - strSize += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2); - else if (i>0 and totalSizes>1024) - strSize += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2); - else - if (i>0) { strSize += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);} - + QString msgStatusBar = ItemsInstatusBar(fileList, tr("Items")); + if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); - ui->statusbar->showMessage(strSize); ui->tool_addToDir->setVisible(isUserWritable); ui->tool_addNewFile->setVisible(isUserWritable); ui->actionUpDir->setEnabled(dir!="/"); @@ -982,6 +985,9 @@ void MainUI::OpenContextMenu(const QPoint &pt){ void MainUI::ItemSelectionChanged(){ //Enable/disable the action buttons QFileInfoList sel = getSelectedItems(); + QString msgStatusBar = ItemsInstatusBar(sel, tr("Items selected")); + if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); + ui->tool_act_run->setEnabled(sel.length()==1); ui->tool_act_runwith->setEnabled(sel.length()==1); ui->tool_act_rm->setEnabled(!sel.isEmpty() && isUserWritable); -- cgit From bd557d962fa83b9fb7638d49c1ae2cdbc8508d7c Mon Sep 17 00:00:00 2001 From: william Date: Sat, 21 Mar 2015 13:45:30 +0100 Subject: Add display of the filesystem's capacity in the statusbar --- lumina-fm/MainUI.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index a7043195..d0684368 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -471,6 +471,12 @@ void MainUI::setCurrentDir(QString dir){ } QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); QString msgStatusBar = ItemsInstatusBar(fileList, tr("Items")); + //3 following lines should be in LOS + QStringList mountInfo = LUtils::getCmdOutput("df " + dir); + QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; + QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); + if (msgStatusBar.isEmpty()) msgStatusBar += tr("Capacity: ") + capacity; + else msgStatusBar += tr(", Capacity: ") + capacity; if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); ui->tool_addToDir->setVisible(isUserWritable); -- cgit From eacbc905796f89ad90197b0328692d8c500dbcf6 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 24 Mar 2015 09:22:27 +0100 Subject: create FileSystemCapacity and put it in LuminaOS --- lumina-fm/MainUI.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index d445a9cd..1f5a65d0 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -469,12 +469,11 @@ void MainUI::setCurrentDir(QString dir){ if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } + + //collect some statistics of dir and display them in statusbar QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); QString msgStatusBar = ItemsInstatusBar(fileList, tr("Items")); - //3 following lines should be in LOS - QStringList mountInfo = LUtils::getCmdOutput("df " + dir); - QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; - QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); + QString capacity = LOS::FileSystemCapacity(dir) ; if (msgStatusBar.isEmpty()) msgStatusBar += tr("Capacity: ") + capacity; else msgStatusBar += tr(", Capacity: ") + capacity; if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); -- cgit From 553105d997c3a29e9983ef1f1995d9593273de55 Mon Sep 17 00:00:00 2001 From: william Date: Wed, 25 Mar 2015 22:57:32 +0100 Subject: display some filesystem's information on the statusbar in a thread safe manier --- lumina-fm/MainUI.cpp | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 1f5a65d0..59cb09bf 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -12,6 +12,8 @@ #define DEBUG 0 MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ + //for Signal/slot we must register the Typedef of QFileInfoList + qRegisterMetaType("QFileInfoList"); ui->setupUi(this); if(DEBUG){ qDebug() << "Initilization:"; } //Be careful about the QSettings setup, it must match the lumina-desktop setup @@ -214,6 +216,10 @@ void MainUI::setupConnections(){ connect(worker, SIGNAL(ImagesAvailable(QStringList)), this, SLOT(AvailablePictures(QStringList)) ); connect(worker, SIGNAL(MultimediaAvailable(QStringList)), this, SLOT(AvailableMultimediaFiles(QStringList)) ); 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(worker, SIGNAL(Si_DisplayStatusBar(QString)), this, SLOT(DisplayStatusBar(QString)) ); //Action buttons on browser page connect(ui->tool_act_run, SIGNAL(clicked()), this, SLOT(OpenItem()) ); @@ -396,27 +402,6 @@ QString MainUI::getCurrentDir(){ return currentDir->whatsThis(); } -QString MainUI::ItemsInstatusBar(QFileInfoList fileList, QString message){ - int i = 0; - qreal totalSizes = 0; - foreach (QFileInfo fileInfo, fileList ) - { - if (fileInfo.isFile()) totalSizes += fileInfo.size(); - i += 1; - } - if (i==0) return ""; - QString strSize = QString(tr("%1: %2")).arg(message).arg(i); - if (i>0 and totalSizes>1024*1024*1024) - strSize += QString(tr(", size: %1 Gb")).arg(totalSizes/1024/1024/1024, 0,'f', 2); - else if (i>0 and totalSizes>1024*1024) - strSize += QString(tr(", size: %1 Mb")).arg(totalSizes/1024/1024, 0,'f',2); - else if (i>0 and totalSizes>1024) - strSize += QString(tr(", size: %1 Kb")).arg(totalSizes/1024, 0, 'f' , 2); - else - if (totalSizes > 0) { strSize += QString(tr(", size: %1 b")).arg(totalSizes, 0, 'f' , 2);} - return strSize; -} - void MainUI::setCurrentDir(QString dir){ if(dir.isEmpty()){ return; } if(syncTimer->isActive()){ syncTimer->stop(); } //already loading the info @@ -465,19 +450,12 @@ void MainUI::setCurrentDir(QString dir){ ui->tool_goToImages->setVisible(false); //if(olddir!=rawdir){ emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded + emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), rawdir, tr("Items")); //} if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } - //collect some statistics of dir and display them in statusbar - QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); - QString msgStatusBar = ItemsInstatusBar(fileList, tr("Items")); - QString capacity = LOS::FileSystemCapacity(dir) ; - if (msgStatusBar.isEmpty()) msgStatusBar += tr("Capacity: ") + capacity; - else msgStatusBar += tr(", Capacity: ") + capacity; - if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); - ui->tool_addToDir->setVisible(isUserWritable); ui->tool_addNewFile->setVisible(isUserWritable); ui->actionUpDir->setEnabled(dir!="/"); @@ -570,6 +548,11 @@ void MainUI::AvailableBackups(QString basedir, QStringList snapdirs){ ui->tool_goToRestore->setVisible(!snapDirs.isEmpty()); } +void MainUI::DisplayStatusBar(QString msg){ + qDebug() << "in main thread:" << msg; + ui->statusbar->showMessage(msg); +} + void MainUI::AvailablePictures(QStringList pics){ if(!pics.isEmpty()){ QString citem = ui->combo_image_name->currentText(); @@ -990,8 +973,9 @@ void MainUI::OpenContextMenu(const QPoint &pt){ void MainUI::ItemSelectionChanged(){ //Enable/disable the action buttons QFileInfoList sel = getSelectedItems(); - QString msgStatusBar = ItemsInstatusBar(sel, tr("Items selected")); - if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); + //display info related to files selected. + //TO CHECK: impact if filesystem is very slow + if (sel.size()>0) worker->createStatusBarMsg(sel, "", tr("Items selected")); ui->tool_act_run->setEnabled(sel.length()==1); ui->tool_act_runwith->setEnabled(sel.length()==1); -- cgit