[vlmc-devel] commit: Import: Don't try to import non-media files. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri Apr 16 01:16:06 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Apr 16 01:07:26 2010 +0200| [dbf34a4390b20e274d52beb5a8f7b821e4ce113a] | committer: Hugo Beauzée-Luyssen 

Import: Don't try to import non-media files.

This makes the loading of a directory almost immediat.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=dbf34a4390b20e274d52beb5a8f7b821e4ce113a
---

 src/Gui/import/ImportController.cpp |   18 ++++--------------
 src/Gui/import/ImportController.h   |    1 +
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index c558f3d..0bd4b5c 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -58,12 +58,11 @@ ImportController::ImportController(QWidget *parent) :
     m_filesModel = new QFileSystemModel( this );
     m_stackNav->pushViewController( m_mediaListView );
 
-    QStringList filters;
-    filters << Media::AudioExtensions.split(' ', QString::SkipEmptyParts)
+    m_nameFilters << Media::AudioExtensions.split(' ', QString::SkipEmptyParts)
             << Media::VideoExtensions.split(' ', QString::SkipEmptyParts)
             << Media::ImageExtensions.split(' ', QString::SkipEmptyParts);
     m_filesModel->setFilter( QDir::AllDirs | QDir::AllEntries | QDir::NoDotAndDotDot );
-    m_filesModel->setNameFilters( filters );
+    m_filesModel->setNameFilters( m_nameFilters );
     m_filesModel->setRootPath( "/" );
     m_filesModel->setNameFilterDisables( false );
 
@@ -194,7 +193,7 @@ void
 ImportController::importDir( const QString &path )
 {
     QDir            dir( path );
-    QFileInfoList   files = dir.entryInfoList( QDir::NoDotAndDotDot | QDir::Readable
+    QFileInfoList   files = dir.entryInfoList( m_nameFilters, QDir::NoDotAndDotDot | QDir::Readable
                                                | QDir::AllEntries );
 
     foreach ( QFileInfo fInfo, files )
@@ -202,16 +201,7 @@ ImportController::importDir( const QString &path )
         if ( fInfo.isDir() == true )
             importDir( fInfo.absoluteFilePath() );
         else
-        {
-            QString ext = fInfo.suffix();
-
-            if ( Media::AudioExtensions.contains( ext ) ||
-                 Media::VideoExtensions.contains( ext ) ||
-                 Media::ImageExtensions.contains( ext ) )
-            {
-                importMedia( fInfo.absoluteFilePath() );
-            }
-        }
+            importMedia( fInfo.absoluteFilePath() );
     }
 }
 
diff --git a/src/Gui/import/ImportController.h b/src/Gui/import/ImportController.h
index 64a41c3..6d8c761 100644
--- a/src/Gui/import/ImportController.h
+++ b/src/Gui/import/ImportController.h
@@ -85,6 +85,7 @@ class ImportController : public QDialog
         quint32                     m_nbMediaToLoad;
         quint32                     m_nbMediaLoaded;
         ClipRenderer*               m_clipRenderer;
+        QStringList                 m_nameFilters;
 
     public slots:
         void        accept();



More information about the Vlmc-devel mailing list