diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 6050ce10..13d6bd0d 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -518,6 +518,24 @@ void MainWindow::addFiles(const QStringList &files) int timeMT = 0, timeST = 0; + //--Prepass-- + + FileAnalyzer_ST *analyzerPre = new FileAnalyzer_ST(files); + connect(analyzerPre, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); + connect(analyzerPre, SIGNAL(progressValChanged(unsigned int)), m_banner, SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection); + connect(analyzerPre, SIGNAL(progressMaxChanged(unsigned int)), m_banner, SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection); + connect(analyzerPre, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); + connect(m_banner, SIGNAL(userAbort()), analyzerPre, SLOT(abortProcess()), Qt::DirectConnection); + + try + { + m_fileListModel->setBlockUpdates(true); + m_banner->show(tr("Adding file(s), please wait..."), analyzerPre); + } + catch(...) + { + /* ignore any exceptions that may occur */ + } //--MT-- FileAnalyzer *analyzer = new FileAnalyzer(files); @@ -562,9 +580,16 @@ void MainWindow::addFiles(const QStringList &files) //------ - double speedUp = static_cast(timeST) / static_cast(timeMT); - QMessageBox::information(this, "Speed Up", QString().sprintf("Announcement: The new multi-threaded file analyzer is %.1fx faster !!!", speedUp), QMessageBox::Ok); - qWarning("ST: %d, MT: %d", timeST, timeMT); + if(timeST > 0 && timeMT > 0) + { + double speedUp = static_cast(timeST) / static_cast(timeMT); + qWarning("ST: %d, MT: %d", timeST, timeMT); + QMessageBox::information(this, "Speed Up", QString().sprintf("Announcement: The new multi-threaded file analyzer is %.1fx faster !!!", speedUp), QMessageBox::Ok); + } + else + { + QMessageBox::information(this, "Speed Up", "Couldn't compare the the new multi-threaded file analyzer this time!", QMessageBox::Ok); + } //------ @@ -594,6 +619,8 @@ void MainWindow::addFiles(const QStringList &files) LAMEXP_DELETE(analyzer); LAMEXP_DELETE(analyzerST); + LAMEXP_DELETE(analyzerPre); + m_banner->close(); }