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

The progress bar is now non-modal, so the user can hide the import windows.

parent 1645d008
...@@ -73,10 +73,7 @@ ImportController::ImportController(QWidget *parent) : ...@@ -73,10 +73,7 @@ ImportController::ImportController(QWidget *parent) :
m_ui->treeView->setColumnHidden( 3, true ); m_ui->treeView->setColumnHidden( 3, true );
m_ui->forwardButton->setEnabled( true ); m_ui->forwardButton->setEnabled( true );
m_progressDialog = new QProgressDialog( tr("Importing files..."), m_ui->progressBar->setHidden( true );
tr("Cancel"), 0, 0, NULL);
m_progressDialog->setWindowModality( Qt::WindowModal );
m_progressDialog->setMinimumDuration( 1000 );
connect( m_ui->treeView, SIGNAL( clicked( QModelIndex ) ), connect( m_ui->treeView, SIGNAL( clicked( QModelIndex ) ),
this, SLOT( treeViewClicked( QModelIndex ) ) ); this, SLOT( treeViewClicked( QModelIndex ) ) );
...@@ -229,7 +226,7 @@ void ...@@ -229,7 +226,7 @@ void
ImportController::importMedia( const QString &filePath ) ImportController::importMedia( const QString &filePath )
{ {
++m_nbMediaToLoad; ++m_nbMediaToLoad;
m_progressDialog->setMaximum( m_nbMediaToLoad ); m_ui->progressBar->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 ;
...@@ -436,9 +433,13 @@ ImportController::mediaLoaded() ...@@ -436,9 +433,13 @@ ImportController::mediaLoaded()
{ {
m_nbMediaLoaded = 0; m_nbMediaLoaded = 0;
m_nbMediaToLoad = 0; m_nbMediaToLoad = 0;
m_progressDialog->hide(); m_ui->progressBar->hide();
} }
else else
m_progressDialog->setValue( m_nbMediaLoaded ); {
if ( m_nbMediaToLoad > 3 )
m_ui->progressBar->show();
m_ui->progressBar->setValue( m_nbMediaLoaded );
}
} }
...@@ -82,7 +82,6 @@ class ImportController : public QDialog ...@@ -82,7 +82,6 @@ class ImportController : public QDialog
QUuid m_currentUuid; QUuid m_currentUuid;
QUuid m_savedUuid; QUuid m_savedUuid;
bool m_controllerSwitched; bool m_controllerSwitched;
QProgressDialog* m_progressDialog;
QHash< QUuid, Media*> m_temporaryMedias; QHash< QUuid, Media*> m_temporaryMedias;
quint32 m_nbMediaToLoad; quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded; quint32 m_nbMediaLoaded;
......
...@@ -38,6 +38,16 @@ ...@@ -38,6 +38,16 @@
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QWidget" name="stackViewContainer" native="true"> <widget class="QWidget" name="stackViewContainer" native="true">
<property name="minimumSize"> <property name="minimumSize">
......
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