Commit eccdd339 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Import: Progressbar is functionnal again

parent a80651d1
...@@ -38,7 +38,9 @@ ImportController::ImportController(QWidget *parent) : ...@@ -38,7 +38,9 @@ ImportController::ImportController(QWidget *parent) :
QDialog(parent), QDialog(parent),
m_ui(new Ui::ImportController), m_ui(new Ui::ImportController),
m_clipListController( 0 ), m_clipListController( 0 ),
m_controllerSwitched( false ) m_controllerSwitched( false ),
m_nbMediaToLoad( 0 ),
m_nbMediaLoaded( 0 )
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_preview = new PreviewWidget( new ClipRenderer, m_ui->previewContainer ); m_preview = new PreviewWidget( new ClipRenderer, m_ui->previewContainer );
...@@ -226,6 +228,8 @@ ImportController::setUIMetaData( Clip* clip ) ...@@ -226,6 +228,8 @@ ImportController::setUIMetaData( Clip* clip )
void void
ImportController::importMedia( const QString &filePath ) ImportController::importMedia( const QString &filePath )
{ {
++m_nbMediaToLoad;
m_progressDialog->setMaximum( m_nbMediaToLoad );
foreach ( Media* media, m_temporaryMedias.values() ) foreach ( Media* media, m_temporaryMedias.values() )
if ( media->getFileInfo()->filePath() == filePath ) if ( media->getFileInfo()->filePath() == filePath )
return ; return ;
...@@ -237,6 +241,8 @@ ImportController::importMedia( const QString &filePath ) ...@@ -237,6 +241,8 @@ ImportController::importMedia( const QString &filePath )
this, SLOT( updateMediaRequested( Media* ) ) ); this, SLOT( updateMediaRequested( Media* ) ) );
connect( media, SIGNAL( snapshotComputed( Media* ) ), connect( media, SIGNAL( snapshotComputed( Media* ) ),
this, SLOT( updateMediaRequested( Media* ) ) ); this, SLOT( updateMediaRequested( Media* ) ) );
connect( media, SIGNAL( snapshotComputed( Media* ) ),
this, SLOT( mediaLoaded() ) );
m_temporaryMedias[media->getUuid()] = media; m_temporaryMedias[media->getUuid()] = media;
MetaDataManager::getInstance()->computeMediaMetadata( media ); MetaDataManager::getInstance()->computeMediaMetadata( media );
m_mediaListController->addMedia( media ); m_mediaListController->addMedia( media );
...@@ -423,13 +429,16 @@ ImportController::restoreCurrentPath() ...@@ -423,13 +429,16 @@ ImportController::restoreCurrentPath()
} }
void void
ImportController::progressDialogMax( int max ) ImportController::mediaLoaded()
{ {
m_progressDialog->setMaximum( max ); ++m_nbMediaLoaded;
} if ( m_nbMediaLoaded == m_nbMediaToLoad )
{
m_nbMediaLoaded = 0;
m_nbMediaToLoad = 0;
m_progressDialog->hide();
}
else
m_progressDialog->setValue( m_nbMediaLoaded );
void
ImportController::progressDialogValue( int value )
{
m_progressDialog->setValue( value );
} }
...@@ -84,6 +84,8 @@ class ImportController : public QDialog ...@@ -84,6 +84,8 @@ class ImportController : public QDialog
bool m_controllerSwitched; bool m_controllerSwitched;
QProgressDialog* m_progressDialog; QProgressDialog* m_progressDialog;
QHash< QUuid, Media*> m_temporaryMedias; QHash< QUuid, Media*> m_temporaryMedias;
quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded;
public slots: public slots:
void updateMediaRequested( Media* media ); void updateMediaRequested( Media* media );
...@@ -95,13 +97,12 @@ class ImportController : public QDialog ...@@ -95,13 +97,12 @@ class ImportController : public QDialog
void clipDeletion( const QUuid& uuid ); void clipDeletion( const QUuid& uuid );
void showClipList( const QUuid& uuid ); void showClipList( const QUuid& uuid );
void restoreContext(); void restoreContext();
void progressDialogMax( int max );
void progressDialogValue( int value );
private slots: private slots:
void forwardButtonClicked(); void forwardButtonClicked();
void treeViewClicked( const QModelIndex& index ); void treeViewClicked( const QModelIndex& index );
void treeViewDoubleClicked( const QModelIndex& index ); void treeViewDoubleClicked( const QModelIndex& index );
void mediaLoaded();
signals: signals:
void mediaSelected( Media* ); void mediaSelected( Media* );
......
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