diff --git a/src/dltfileindexer.cpp b/src/dltfileindexer.cpp index f85f9a93..9013eb97 100644 --- a/src/dltfileindexer.cpp +++ b/src/dltfileindexer.cpp @@ -151,7 +151,6 @@ bool DltFileIndexer::index(int num) quint8 version=1; qint64 lengthOffset=2; qint64 storageLength=0; - int iPercent =0; errors_in_file = 0; char *data = new char[DLT_FILE_INDEXER_SEG_SIZE]; @@ -378,7 +377,6 @@ bool DltFileIndexer::indexFilter(QStringList filenames) { QSharedPointer msg; QDltFilterList filterList; - QTime time; quint64 ix = 0; unsigned int iPercent = 0; @@ -429,12 +427,6 @@ bool DltFileIndexer::indexFilter(QStringList filenames) return true; } - unsigned int modvalue = dltFile->size()/20; - if (modvalue == 0) // avoid divison by zero - { - modvalue = 1; - } - // Initialise progress bar emit(progressText(QString("CFI %1/%2").arg(currentRun).arg(maxRun))); emit(progressMax(100)); @@ -470,7 +462,7 @@ bool DltFileIndexer::indexFilter(QStringList filenames) qDebug() << "Create filter index: Start"; /* init fileprogress */ - int progressCounter = 1; + unsigned int progressCounter = 1; emit progress(0); // Start reading messages diff --git a/src/dltfileindexer.h b/src/dltfileindexer.h index 3ba992bf..0951bfae 100644 --- a/src/dltfileindexer.h +++ b/src/dltfileindexer.h @@ -128,7 +128,7 @@ class DltFileIndexer : public QThread // get index of all messages QVector getIndexAll() { return indexAllList; } QVector getIndexFilters() { return indexFilterList; } - QList getGetLogInfoList() { return getLogInfoList; } + const QList& getGetLogInfoList() { return getLogInfoList; } // let worker thread append to getLogInfoList void appendToGetLogInfoList(int value); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 100ee7da..ddf67f32 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -49,6 +49,8 @@ #include #include +#include + /** * From QDlt. * Must be a "C" include to interpret the imports correctly @@ -685,8 +687,8 @@ void MainWindow::initFileHandling() ui->checkBoxSortByTimestamp->setEnabled(ui->filtersEnabled->isChecked()); ui->checkBoxSortByTimestamp->setChecked(QDltSettingsManager::getInstance()->value("startup/sortByTimestampEnabled", false).toBool()); ui->checkBoxFilterRange->setEnabled(ui->filtersEnabled->isChecked()); - ui->lineEditFilterStart->setEnabled(ui->checkBoxFilterRange->isChecked() & ui->filtersEnabled->isChecked()); - ui->lineEditFilterEnd->setEnabled(ui->checkBoxFilterRange->isChecked() & ui->filtersEnabled->isChecked()); + ui->lineEditFilterStart->setEnabled(ui->checkBoxFilterRange->isChecked() && ui->filtersEnabled->isChecked()); + ui->lineEditFilterEnd->setEnabled(ui->checkBoxFilterRange->isChecked() && ui->filtersEnabled->isChecked()); /* Process Project */ if(QDltOptManager::getInstance()->isProjectFile()) @@ -1012,6 +1014,7 @@ void MainWindow::closeEvent(QCloseEvent *event) settingsDlg->writeSettings(this); if(true == isSearchOngoing) { + qDebug() << "Ignoring close event"; event->ignore(); } else if(settings->tempCloseWithoutAsking || outputfile.size() == 0) @@ -1895,7 +1898,7 @@ void MainWindow::on_action_menuFile_Clear_triggered() return; } -void MainWindow::contextLoadingFile(QDltMsg &msg) +void MainWindow::contextLoadingFile(const QDltMsg &msg) { /* analyse message, check if DLT control message response */ if ( (msg.getType()==QDltMsg::DltTypeControl) && (msg.getSubtype()==QDltMsg::DltControlResponse)) @@ -1931,7 +1934,7 @@ void MainWindow::contextLoadingFile(QDltMsg &msg) } - controlMessage_ReceiveControlMessage(ecuitemFound,msg); + controlMessage_ReceiveControlMessage(ecuitemFound, msg); } } @@ -2060,15 +2063,19 @@ void MainWindow::reloadLogFileFinishFilter() // process getLogInfoMessages if(( dltIndexer->getMode() == DltFileIndexer::modeIndexAndFilter) && settings->updateContextLoadingFile) { - QList list = dltIndexer->getGetLogInfoList(); - QDltMsg msg; + qDebug() << "Populating ECUs tree"; + isSearchOngoing = true; + QThreadPool::globalInstance()->start([this] { + const QList& msgIndexList = dltIndexer->getGetLogInfoList(); - // FIXME: this is slow operation running in the main loop - for(int num=0;num