Commit dbf34a43 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

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

This makes the loading of a directory almost immediat.
parent 853aebac
......@@ -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() );
}
}
......
......@@ -85,6 +85,7 @@ class ImportController : public QDialog
quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded;
ClipRenderer* m_clipRenderer;
QStringList m_nameFilters;
public slots:
void accept();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment