Commit d73b1440 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Fixing directory import.

parent e5579874
......@@ -206,10 +206,10 @@ ImportController::setUIMetaData( Media* media )
}
else
{
m_ui->durationValueLabel->setText( "--:--:--" );
m_ui->nameValueLabel->setText( "none" );
m_ui->resolutionValueLabel->setText( "-- x --" );
m_ui->fpsValueLabel->setText( "--" );
m_ui->durationValueLabel->setText( "--:--:--" );
m_ui->nameValueLabel->setText( "none" );
m_ui->resolutionValueLabel->setText( "-- x --" );
m_ui->fpsValueLabel->setText( "--" );
}
}
......@@ -230,11 +230,8 @@ ImportController::setUIMetaData( Clip* clip )
}
void
ImportController::forwardButtonClicked()
ImportController::importMedia( const QString &filePath )
{
QModelIndex index = m_ui->treeView->selectionModel()->currentIndex();
QString filePath = m_filesModel->fileInfo( index ).filePath();
foreach ( Media* media, m_temporaryMedias.values() )
if ( media->getFileInfo()->filePath() == filePath )
return ;
......@@ -251,6 +248,43 @@ ImportController::forwardButtonClicked()
m_mediaListController->addMedia( media );
}
void
ImportController::importDir( const QString &path )
{
QDir dir( path );
QFileInfoList files = dir.entryInfoList( QDir::NoDotAndDotDot | QDir::Readable
| QDir::AllEntries );
foreach ( QFileInfo fInfo, files )
{
if ( fInfo.isDir() == true )
importDir( fInfo.absolutePath() );
else
{
QString ext = fInfo.suffix();
if ( Media::AudioExtensions.contains( ext ) ||
Media::VideoExtensions.contains( ext ) ||
Media::ImageExtensions.contains( ext ) )
{
importMedia( fInfo.absoluteFilePath() );
}
}
}
}
void
ImportController::forwardButtonClicked()
{
QModelIndex index = m_ui->treeView->selectionModel()->currentIndex();
QString filePath = m_filesModel->fileInfo( index ).filePath();
if ( !m_filesModel->isDir( index ) )
importMedia( filePath );
else
importDir( filePath );
}
void
ImportController::treeViewClicked( const QModelIndex& index )
{
......@@ -267,8 +301,7 @@ ImportController::treeViewClicked( const QModelIndex& index )
void
ImportController::treeViewDoubleClicked( const QModelIndex& index )
{
if ( !m_filesModel->isDir( index ) )
forwardButtonClicked();
forwardButtonClicked();
}
void
......
......@@ -69,13 +69,15 @@ class ImportController : public QDialog
void restoreCurrentPath();
void collapseAllButCurrentPath();
void deleteTemporaryMedias();
void importMedia( const QString &filePath );
void importDir( const QString &path );
Ui::ImportController* m_ui;
PreviewWidget* m_preview;
StackViewController* m_stackNav;
TagWidget* m_tag;
ImportMediaListController* m_mediaListController;
ImportMediaListController* m_clipListController;
QDirModel* m_filesModel;
QDirModel* m_filesModel;
QFileSystemWatcher* m_fsWatcher;
QString m_currentlyWatchedDir;
QUuid m_currentUuid;
......
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