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) :
m_ui->treeView->setColumnHidden( 3, true );
m_ui->forwardButton->setEnabled( true );
m_progressDialog = new QProgressDialog( tr("Importing files..."),
tr("Cancel"), 0, 0, NULL);
m_progressDialog->setWindowModality( Qt::WindowModal );
m_progressDialog->setMinimumDuration( 1000 );
m_ui->progressBar->setHidden( true );
connect( m_ui->treeView, SIGNAL( clicked( QModelIndex ) ),
this, SLOT( treeViewClicked( QModelIndex ) ) );
......@@ -229,7 +226,7 @@ void
ImportController::importMedia( const QString &filePath )
{
++m_nbMediaToLoad;
m_progressDialog->setMaximum( m_nbMediaToLoad );
m_ui->progressBar->setMaximum( m_nbMediaToLoad );
foreach ( Media* media, m_temporaryMedias.values() )
if ( media->getFileInfo()->filePath() == filePath )
return ;
......@@ -436,9 +433,13 @@ ImportController::mediaLoaded()
{
m_nbMediaLoaded = 0;
m_nbMediaToLoad = 0;
m_progressDialog->hide();
m_ui->progressBar->hide();
}
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
QUuid m_currentUuid;
QUuid m_savedUuid;
bool m_controllerSwitched;
QProgressDialog* m_progressDialog;
QHash< QUuid, Media*> m_temporaryMedias;
quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded;
......
......@@ -38,6 +38,16 @@
</item>
<item>
<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>
<widget class="QWidget" name="stackViewContainer" native="true">
<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