diff options
author | Ken Moore <moorekou@gmail.com> | 2015-08-27 08:18:31 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-08-27 08:18:31 -0400 |
commit | e2d78d681f2ef468bc13c3dc8224afbb8cf07ecf (patch) | |
tree | 9651577e14a21ce5120d7d6c362e00a85c4fe4d7 | |
parent | Ensure that the current directory loading is stopped when starting to load a ... (diff) | |
download | lumina-e2d78d681f2ef468bc13c3dc8224afbb8cf07ecf.tar.gz lumina-e2d78d681f2ef468bc13c3dc8224afbb8cf07ecf.tar.bz2 lumina-e2d78d681f2ef468bc13c3dc8224afbb8cf07ecf.zip |
Re-enable the directory statistics output for lumina-fm.
-rw-r--r-- | lumina-fm/widgets/DirWidget.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp index 256722d7..f1135694 100644 --- a/lumina-fm/widgets/DirWidget.cpp +++ b/lumina-fm/widgets/DirWidget.cpp @@ -152,6 +152,9 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){ if(CDIR.endsWith("/")){ CDIR.chop(1); } CLIST = list; //save for laterr canmodify = QFileInfo(CDIR).isWritable(); + //Clear the status text + if(!canmodify){ui->label_status->setText(tr("(Limited Access) ")); } + else{ ui->label_status->setText(""); } //Hide the extra buttons for a moment ui->tool_goToPlayer->setVisible(false); ui->tool_goToImages->setVisible(false); @@ -206,10 +209,15 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){ //Now fill the display widget bool hasimages, hasmultimedia; hasimages = hasmultimedia = false; + int numdirs = 0; + qint64 filebytes = 0; for(int i=0; i<list.length(); i++){ if(stopload){ ui->actionStopLoad->setVisible(false); return; } //stop right now - hasimages = hasimages || list[i].isImage(); - hasmultimedia = hasmultimedia || list[i].isAVFile(); + if(!hasimages && list[i].isImage()){ hasimages = true; ui->tool_goToImages->setVisible(true); } + else if(!hasmultimedia && list[i].isAVFile()){ hasmultimedia = true; ui->tool_goToPlayer->setVisible(true); } + //Update statistics + if(list[i].isDir()){ numdirs++; } + else{ filebytes += list[i].size(); } //watcher->addPath(list[i].absoluteFilePath()); if(showDetails){ //Now create all the individual items for the details tree @@ -279,8 +287,23 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){ //Now Re-enable buttons as necessary ui->tool_goToPlayer->setVisible(hasmultimedia); ui->tool_goToImages->setVisible(hasimages); - if(canmodify){ ui->label_status->setText(""); } - else{ ui->label_status->setText(tr("Restricted Access")); } + //Assemble any status message + QString stats = QString(tr("Capacity: %1")).arg(LOS::FileSystemCapacity(CDIR)); + if(list.length()>0){ + stats.prepend("\t"); + if(numdirs < list.length()){ + //Has Files + stats.prepend( QString(tr("Files: %1 (%2)")).arg(QString::number(list.length()-numdirs), LUtils::BytesToDisplaySize(filebytes)) ); + } + if(numdirs > 0){ + //Has Dirs + if(numdirs<list.length()){ stats.prepend(" / "); }//has files output already + stats.prepend( QString(tr("Dirs: %1")).arg(QString::number(numdirs)) ); + } + + } + if(!canmodify){stats.prepend(tr("(Limited Access) ")); } + ui->label_status->setText( QString(ui->label_status->text()+stats).simplified() ); } void DirWidget::LoadSnaps(QString basedir, QStringList snaps){ |