diff --git a/CMakeLists.txt b/CMakeLists.txt index f285aa2a..a944af1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_C_STANDARD 11) + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() diff --git a/build_sdk_windows_qt5_MSVC_interactive_qmake.bat b/build_sdk_windows_qt5_MSVC_interactive_qmake.bat deleted file mode 100644 index 7955d535..00000000 --- a/build_sdk_windows_qt5_MSVC_interactive_qmake.bat +++ /dev/null @@ -1,4 +0,0 @@ -call build_sdk_windows_qt5_MSVC_qmake.bat -SET RETCODE=%ERRORLEVEL% -set /p name= Continue -exit /b %RETCODE% \ No newline at end of file diff --git a/build_sdk_windows_qt5_MSVC_qmake.bat b/build_sdk_windows_qt5_MSVC_qmake.bat deleted file mode 100644 index 97fe5e29..00000000 --- a/build_sdk_windows_qt5_MSVC_qmake.bat +++ /dev/null @@ -1,270 +0,0 @@ -@echo off - -REM Date Version Author Changes -REM 4.7.19 1.0 Alexander Wenzel Update to Qt 5.12.4 and Visual Studio 2015 -REM 25.11.20 1.1 Alexander Wenzel Update to Qt 5.12.10 -REM 11.1.21 1.2 Alexander Wenzel Update to Qt 5.12.12, Visual Studio 2017 Build Tools and simplify - -echo ************************************ -echo *** DLT Viewer SDK *** -echo ************************************ - -call build_config.bat - -if '%WORKSPACE%'=='' ( - if '%DLT_VIEWER_SDK_DIR%'=='' ( - set DLT_VIEWER_SDK_DIR=c:\DltViewerSDKQt%QTNO% - ) - - set SOURCE_DIR=%CD% - set BUILD_DIR=%CD%\build\release -) else ( - if '%DLT_VIEWER_SDK_DIR%'=='' ( - set DLT_VIEWER_SDK_DIR=%WORKSPACE%\build\dist\DltViewerSDKQt%QTNO% - ) - - set SOURCE_DIR=%WORKSPACE% - set BUILD_DIR=%WORKSPACE%\build\release -) - -echo ************************************ -echo * QTDIR = %QTDIR% -echo * MSVC_DIR = %MSVC_DIR% -echo * PATH = %PATH% -echo * DLT_VIEWER_SDK_DIR = %DLT_VIEWER_SDK_DIR% -echo * SOURCE_DIR = %SOURCE_DIR% -echo * BUILD_DIR = %BUILD_DIR% -echo ************************************ - -if exist build ( -echo ************************************ -echo *** Delete old build Directory *** -echo ************************************ - - rmdir /s /q build || rem - if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -) - -echo ************************************ -echo *** Configure MSVC environment *** -echo ************************************ - -call vcvarsall.bat x86_amd64 -if %ERRORLEVEL% NEQ 0 goto ERROR_HANDLER -echo configuring was successful - -if exist %DLT_VIEWER_SDK_DIR% ( -echo ************************************ -echo *** Delete old SDK Directory *** -echo ************************************ - - rmdir /s /q %DLT_VIEWER_SDK_DIR% || rem - if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER -) - -echo ************************************ -echo *** Build DLT Viewer *** -echo ************************************ - -mkdir build -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -cd build -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -qmake ../BuildDltViewer.pro -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -set CL=/MP -nmake -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -echo ************************************ -echo *** Create SDK *** -echo ************************************ - -if not exist %DLT_VIEWER_SDK_DIR% mkdir %DLT_VIEWER_SDK_DIR% -echo *** Create directories %DLT_VIEWER_SDK_DIR% *** -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\plugins\examples -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\include -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\lib -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\src -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\src\dummydecoderplugin -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\src\dummyviewerplugin -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\sdk\src\dummycontrolplugin -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\filters -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\platforms -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\styles -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\doc -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -mkdir %DLT_VIEWER_SDK_DIR%\cache -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -echo *** Copy files *** -copy %QTDIR%\bin\Qt?Core.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Gui.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Network.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Sql.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Svg.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Widgets.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?PrintSupport.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?Xml.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?OpenGL.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\bin\Qt?SerialPort.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\plugins\platforms\qwindows.dll %DLT_VIEWER_SDK_DIR%\platforms -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %QTDIR%\plugins\platforms\qoffscreen.dll %DLT_VIEWER_SDK_DIR%\platforms -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -if "%QTNO%"=="5" ( - copy %QTDIR%\plugins\styles\qwindowsvistastyle.dll %DLT_VIEWER_SDK_DIR%\styles - if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER -) -if "%QTNO%"=="6" ( - copy %QTDIR%\plugins\styles\qmodernwindowsstyle.dll %DLT_VIEWER_SDK_DIR%\styles - if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER -) - -copy %BUILD_DIR%\dlt-viewer.exe %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\dlt-commander.exe %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\qdlt.dll %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\dltviewerplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\nonverboseplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\filetransferplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\dltsystemviewerplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\dltdbusplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\dltlogstorageplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\plugins\dlttestrobotplugin.dll %DLT_VIEWER_SDK_DIR%\plugins -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\doc\*.txt %DLT_VIEWER_SDK_DIR%\doc - -copy %SOURCE_DIR%\ReleaseNotes_Viewer.txt %DLT_VIEWER_SDK_DIR% - -copy %SOURCE_DIR%\README.md %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\LICENSE.txt %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\MPL.txt %DLT_VIEWER_SDK_DIR% -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\qdlt\*.h %DLT_VIEWER_SDK_DIR%\sdk\include -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\qdlt.dll %DLT_VIEWER_SDK_DIR%\sdk\lib -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %BUILD_DIR%\qdlt.lib %DLT_VIEWER_SDK_DIR%\sdk\lib -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\plugin\dummyviewerplugin %DLT_VIEWER_SDK_DIR%\sdk\src\dummyviewerplugin - -copy %SOURCE_DIR%\plugin\dummydecoderplugin %DLT_VIEWER_SDK_DIR%\sdk\src\dummydecoderplugin - -copy %SOURCE_DIR%\plugin\dummycontrolplugin %DLT_VIEWER_SDK_DIR%\sdk\src\dummycontrolplugin - -copy %SOURCE_DIR%\sdk\BuildPlugins.pro %DLT_VIEWER_SDK_DIR%\sdk\src - -copy %SOURCE_DIR%\sdk\dummydecoderplugin.pro %DLT_VIEWER_SDK_DIR%\sdk\src\dummydecoderplugin - -copy %SOURCE_DIR%\sdk\dummyviewerplugin.pro %DLT_VIEWER_SDK_DIR%\sdk\src\dummyviewerplugin -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\sdk\dummycontrolplugin.pro %DLT_VIEWER_SDK_DIR%\sdk\src\dummycontrolplugin -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\plugin\examples\nonverboseplugin_configuration.xml %DLT_VIEWER_SDK_DIR%\plugins\examples -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\plugin\examples\filetransferplugin_configuration.xml %DLT_VIEWER_SDK_DIR%\plugins\examples -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -copy %SOURCE_DIR%\filters\* %DLT_VIEWER_SDK_DIR%\filters -if %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER - -GOTO QUIT - -:ERROR_HANDLER -echo #################################### -echo ### ERROR occured ### -echo #################################### -exit /b 1 - - -:QUIT -echo ************************************ -echo *** SUCCESS finish *** -echo ************************************ -echo SDK installed in: %DLT_VIEWER_SDK_DIR% -exit /b 0 diff --git a/plugin/dlttestrobotplugin/dlttestrobotplugin.cpp b/plugin/dlttestrobotplugin/dlttestrobotplugin.cpp index 14291b90..99fcdb23 100644 --- a/plugin/dlttestrobotplugin/dlttestrobotplugin.cpp +++ b/plugin/dlttestrobotplugin/dlttestrobotplugin.cpp @@ -108,16 +108,7 @@ bool DltTestRobotPlugin::controlMsg(int , QDltMsg &) return false; } -bool DltTestRobotPlugin::stateChanged(int index, QDltConnection::QDltConnectionState connectionState,QString hostname){ - Q_UNUSED(index) - Q_UNUSED(connectionState) - Q_UNUSED(hostname) - -#if QT_5_SUPPORTED_VERSION - //qDebug() << ecuList->at(index) << "ConnectionState:" << connectionState << "Hostname:" << hostname << Qt::endl; -#else - //qDebug() << ecuList->at(index) << "ConnectionState:" << connectionState << "Hostname:" << hostname << endl; -#endif +bool DltTestRobotPlugin::stateChanged(int, QDltConnection::QDltConnectionState, QString) { return true; } diff --git a/qdlt/dlt_types.h b/qdlt/dlt_types.h index d806c639..d4494abe 100644 --- a/qdlt/dlt_types.h +++ b/qdlt/dlt_types.h @@ -59,7 +59,7 @@ typedef int pid_t; #endif -#ifdef TARGET_OS_MAC +#ifdef __APPLE__ typedef unsigned long speed_t; #else typedef unsigned int speed_t; diff --git a/qdlt/dlt_user.h b/qdlt/dlt_user.h index f9baef79..194602d2 100644 --- a/qdlt/dlt_user.h +++ b/qdlt/dlt_user.h @@ -71,7 +71,6 @@ \{ */ -#include "dlt_types.h" #include "dlt_common.h" #ifdef __cplusplus diff --git a/qdlt/export_rules.h b/qdlt/export_rules.h index 61e79ed5..588b173c 100644 --- a/qdlt/export_rules.h +++ b/qdlt/export_rules.h @@ -1,24 +1,20 @@ -#include - #ifndef EXPORT_RULES_H #define EXPORT_RULES_H #if defined(QDLT_LIBRARY) # define QDLT_EXPORT Q_DECL_EXPORT -# ifdef Q_OS_WIN +# if defined(_WIN32) || defined(_WIN64) # define QDLT_C_EXPORT __declspec(dllexport) # else # define QDLT_C_EXPORT __attribute__((visibility("default"))) # endif #else # define QDLT_EXPORT Q_DECL_IMPORT -# ifdef Q_OS_WIN +# if defined(_WIN32) || defined(_WIN64) # define QDLT_C_EXPORT __declspec(dllimport) # else # define QDLT_C_EXPORT # endif #endif -#define QT_5_SUPPORTED_VERSION (QT_VERSION_MAJOR == 5 && QT_VERSION_MINOR >= 14) || (QT_VERSION_MAJOR >= 6) - #endif // EXPORT_RULES_H diff --git a/qdlt/qdltsegmentedmsg.h b/qdlt/qdltsegmentedmsg.h index 9ac08d67..8c03daf5 100644 --- a/qdlt/qdltsegmentedmsg.h +++ b/qdlt/qdltsegmentedmsg.h @@ -25,7 +25,6 @@ #include "export_rules.h" #include -#include //! Combine segmented network messages /*! 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/dltmsgqueue.cpp b/src/dltmsgqueue.cpp index 3c0c0590..61297674 100644 --- a/src/dltmsgqueue.cpp +++ b/src/dltmsgqueue.cpp @@ -1,6 +1,8 @@ #include "dltmsgqueue.h" #include +#define QT_5_SUPPORTED_VERSION (QT_VERSION_MAJOR == 5 && QT_VERSION_MINOR >= 14) || (QT_VERSION_MAJOR >= 6) + DltMsgQueue::DltMsgQueue(int size) : bufferSize(size), buffer(new QPair, int> [size]), diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 100ee7da..3c14a865 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -48,6 +48,8 @@ #include #include #include +#include +#include /** * From QDlt. @@ -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()) @@ -1315,8 +1317,8 @@ bool MainWindow::openDltFile(QStringList fileNames) // clear index filter ui->checkBoxFilterRange->setChecked(false); - ui->lineEditFilterStart->setText(QString("0")); - ui->lineEditFilterEnd->setText(QString("0")); + //ui->lineEditFilterStart->setText(QString("0")); + //ui->lineEditFilterEnd->setText(QString("%1").arg(qfile.size())); if (ret) emit dltFileLoaded(fileNames); @@ -1895,44 +1897,40 @@ 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)) + /* find ecu item */ + EcuItem *ecuitemFound = 0; + for(int num = 0; num < project.ecu->topLevelItemCount (); num++) { - /* find ecu item */ - EcuItem *ecuitemFound = 0; - for(int num = 0; num < project.ecu->topLevelItemCount (); num++) + EcuItem *ecuitem = (EcuItem*)project.ecu->topLevelItem(num); + if(ecuitem->id == msg.getEcuid()) { - EcuItem *ecuitem = (EcuItem*)project.ecu->topLevelItem(num); - if(ecuitem->id == msg.getEcuid()) - { - ecuitemFound = ecuitem; - break; - } + ecuitemFound = ecuitem; + break; } + } - if(!ecuitemFound) - { - /* no Ecuitem found, create a new one */ - ecuitemFound = new EcuItem(0); - - /* update ECU item */ - ecuitemFound->id = msg.getEcuid(); - ecuitemFound->update(); + if(!ecuitemFound) + { + /* no Ecuitem found, create a new one */ + ecuitemFound = new EcuItem(0); - /* add ECU to configuration */ - project.ecu->addTopLevelItem(ecuitemFound); + /* update ECU item */ + ecuitemFound->id = msg.getEcuid(); + ecuitemFound->update(); - /* Update the ECU list in control plugins */ - updatePluginsECUList(); + /* add ECU to configuration */ + project.ecu->addTopLevelItem(ecuitemFound); - pluginManager.stateChanged(project.ecu->indexOfTopLevelItem(ecuitemFound), QDltConnection::QDltConnectionOffline,ecuitemFound->getHostname()); + /* Update the ECU list in control plugins */ + updatePluginsECUList(); - } + pluginManager.stateChanged(project.ecu->indexOfTopLevelItem(ecuitemFound), QDltConnection::QDltConnectionOffline,ecuitemFound->getHostname()); - controlMessage_ReceiveControlMessage(ecuitemFound,msg); } + + controlMessage_ReceiveControlMessage(ecuitemFound, msg); } void MainWindow::reloadLogFileStop() @@ -2022,6 +2020,12 @@ void MainWindow::reloadLogFileFinishIndex() statusProgressBar->reset(); statusProgressBar->hide(); } + + ui->lineEditFilterStart->setText(QString("0")); + if(qfile.size()>0) + ui->lineEditFilterEnd->setText(QString("%1").arg(qfile.size()-1)); + else + ui->lineEditFilterEnd->setText(QString("0")); } void MainWindow::reloadLogFileFinishFilter() @@ -2058,15 +2062,14 @@ void MainWindow::reloadLogFileFinishFilter() m_searchtableModel->modelChanged(); // process getLogInfoMessages - if(( dltIndexer->getMode() == DltFileIndexer::modeIndexAndFilter) && settings->updateContextLoadingFile) - { - QList list = dltIndexer->getGetLogInfoList(); - QDltMsg msg; + if ((dltIndexer->getMode() == DltFileIndexer::modeIndexAndFilter) && + settings->updateContextLoadingFile) { + const QList &msgIndexList = dltIndexer->getGetLogInfoList(); // FIXME: this is slow operation running in the main loop - for(int num=0;numstatus = EcuItem::valid; - } - break; - case 1: /* NOT_SUPPORTED */ - { - //conitem->status = EcuItem::unknown; - } - break; - case 2: /* ERROR */ - { - //conitem->status = EcuItem::invalid; - } - break; - } - - /* update status*/ - //conitem->update(); - break; } case DLT_SERVICE_ID_TIMEZONE: @@ -5537,89 +5507,56 @@ void MainWindow::on_action_menuDLT_Send_Injection_triggered() void MainWindow::controlMessage_SetApplication(EcuItem *ecuitem, QString apid, QString appdescription) { - /* Try to find App */ - for(int numapp = 0; numapp < ecuitem->childCount(); numapp++) - { - ApplicationItem * appitem = (ApplicationItem *) ecuitem->child(numapp); - - if(appitem->id == apid) - { - appitem->description = appdescription; - appitem->update(); - return; - } + if (auto appitem = ecuitem->find(apid); appitem) { + appitem->description = appdescription; + appitem->update(); + } else { + appitem = new ApplicationItem(ecuitem); + appitem->id = apid; + appitem->description = appdescription; + appitem->update(); + ecuitem->addChild(appitem); } - - /* No app and no con found */ - ApplicationItem* appitem = new ApplicationItem(ecuitem); - appitem->id = apid; - appitem->description = appdescription; - appitem->update(); - ecuitem->addChild(appitem); - } void MainWindow::controlMessage_SetContext(EcuItem *ecuitem, QString apid, QString ctid,QString ctdescription,int log_level,int trace_status) { - /* First try to find existing context */ - //qDebug() << "New CTX for" << apid << ctid << ctdescription; - - for(int numapp = 0; numapp < ecuitem->childCount(); numapp++) - { - ApplicationItem * appitem = (ApplicationItem *) ecuitem->child(numapp); + if (auto appitem = ecuitem->find(apid); appitem) { - for(int numcontext = 0; numcontext < appitem->childCount(); numcontext++) - { - ContextItem * conitem = (ContextItem *) appitem->child(numcontext); - - if(appitem->id == apid && conitem->id == ctid) - { - /* set new log level and trace status */ - conitem->loglevel = log_level; - conitem->tracestatus = trace_status; - conitem->description = ctdescription; - conitem->status = ContextItem::valid; - conitem->update(); - return; + ContextItem *conitem = nullptr; + for (int numcontext = 0; numcontext < appitem->childCount(); numcontext++) { + ContextItem *currconitem = (ContextItem *)appitem->child(numcontext); + if (currconitem->id == ctid) { + conitem = currconitem; } } - } - /* Try to find App */ - for(int numapp = 0; numapp < ecuitem->childCount(); numapp++) - { - ApplicationItem * appitem = (ApplicationItem *) ecuitem->child(numapp); - - if(appitem->id == apid) - { - /* Add new context */ - ContextItem* conitem = new ContextItem(appitem); - conitem->id = ctid; - conitem->loglevel = log_level; - conitem->tracestatus = trace_status; - conitem->description = ctdescription; - conitem->status = ContextItem::valid; - conitem->update(); + if (!conitem) { + conitem = new ContextItem(appitem); appitem->addChild(conitem); - - return; } + conitem->id = ctid; + conitem->loglevel = log_level; + conitem->tracestatus = trace_status; + conitem->description = ctdescription; + conitem->status = ContextItem::valid; + conitem->update(); + } else { + appitem = new ApplicationItem(ecuitem); + appitem->id = apid; + appitem->description = ""; + appitem->update(); + ecuitem->addChild(appitem); + + ContextItem* conitem = new ContextItem(appitem); + conitem->id = ctid; + conitem->loglevel = log_level; + conitem->tracestatus = trace_status; + conitem->description = ctdescription; + conitem->status = ContextItem::valid; + conitem->update(); + appitem->addChild(conitem); } - - /* No app and no con found */ - ApplicationItem* appitem = new ApplicationItem(ecuitem); - appitem->id = apid; - appitem->description = QString(""); - appitem->update(); - ecuitem->addChild(appitem); - ContextItem* conitem = new ContextItem(appitem); - conitem->id = ctid; - conitem->loglevel = log_level; - conitem->tracestatus = trace_status; - conitem->description = ctdescription; - conitem->status = ContextItem::valid; - conitem->update(); - appitem->addChild(conitem); } void MainWindow::controlMessage_Timezone(int timezone, unsigned char dst) @@ -5652,15 +5589,12 @@ void MainWindow::controlMessage_UnregisterContext(QString ecuId,QString appId,QS return; /* First try to find existing context */ - for(int numapp = 0; numapp < ecuitemFound->childCount(); numapp++) + if(auto appitem = ecuitemFound->find(appId); appitem) { - ApplicationItem * appitem = (ApplicationItem *) ecuitemFound->child(numapp); - for(int numcontext = 0; numcontext < appitem->childCount(); numcontext++) { ContextItem * conitem = (ContextItem *) appitem->child(numcontext); - - if(appitem->id == appId && conitem->id == ctId) + if(conitem->id == ctId) { /* remove context */ delete conitem->parent()->takeChild(conitem->parent()->indexOfChild(conitem)); @@ -6399,7 +6333,7 @@ void MainWindow::updatePlugin(PluginItem *item) } } -void MainWindow::versionString(QDltMsg &msg) +void MainWindow::versionString(const QDltMsg &msg) { // get the version string from the version message // Skip the ServiceID, Status and Length bytes and start from the String containing the ECU Software Version @@ -7139,14 +7073,10 @@ void MainWindow::filterUpdate() if(filter->enableRegexp_Appid || filter->enableRegexp_Context || filter->enableRegexp_Header || filter->enableRegexp_Payload) { - if(false == filter->compileRegexps()) + if(!filter->compileRegexps()) { // This is also validated in the UI part -#if QT_5_SUPPORTED_VERSION - qDebug() << "Error compiling a regexp" << Qt::endl << "in" << __FILE__ << __LINE__; -#else - qDebug() << "Error compiling a regexp" << endl << "in" << __FILE__ << __LINE__; -#endif + qDebug() << "Error compiling a regexp\nin" << __FILE__ << __LINE__; } } @@ -7155,8 +7085,6 @@ void MainWindow::filterUpdate() qfile.updateSortedFilter(); } - - void MainWindow::on_tableView_customContextMenuRequested(QPoint pos) { /* show custom pop menu for configuration */ diff --git a/src/mainwindow.h b/src/mainwindow.h index 91c62be5..4abd3cd2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -273,7 +273,7 @@ class MainWindow : public QMainWindow void controlMessage_SetTimingPackets(EcuItem* ecuitem, bool enable); void controlMessage_GetSoftwareVersion(EcuItem* ecuitem); void controlMessage_GetLogInfo(EcuItem* ecuitem); - void controlMessage_ReceiveControlMessage(EcuItem *ecuitem,QDltMsg &msg); + void controlMessage_ReceiveControlMessage(EcuItem *ecuitem, const QDltMsg &msg); void controlMessage_SetContext(EcuItem *ecuitem, QString apid, QString ctid,QString ctdescription,int log_level,int trace_status); void controlMessage_SetApplication(EcuItem *ecuitem, QString apid, QString appdescription); void controlMessage_Marker(); @@ -286,8 +286,8 @@ class MainWindow : public QMainWindow void updatePluginsECUList(); void updatePlugins(); void updatePlugin(PluginItem *item); - void contextLoadingFile(QDltMsg &msg); - void versionString(QDltMsg &msg); + void contextLoadingFile(const QDltMsg &msg); + void versionString(const QDltMsg &msg); void pluginsAutoload(QString version); void connectECU(EcuItem *ecuitem,bool force = false); @@ -633,7 +633,6 @@ public slots: signals: void dltFileLoaded(const QStringList& paths); - }; #endif // MAINWINDOW_H diff --git a/src/project.cpp b/src/project.cpp index cc4f2e98..38c37443 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -250,6 +250,15 @@ void EcuItem::updateAutoReconnectTimestamp() //qDebug() << "updateAutoReconnectTimestamp" << autoReconnectTimestamp; } +ApplicationItem *EcuItem::find(const QString &apid) const { + for (int numapp = 0; numapp < childCount(); numapp++) { + ApplicationItem *appitem = static_cast(child(numapp)); + if (appitem->id == apid) + return appitem; + } + return nullptr; +} + ApplicationItem::ApplicationItem(QTreeWidgetItem *parent) : QTreeWidgetItem(parent,application_type) { diff --git a/src/project.h b/src/project.h index 46842089..0c0b6dea 100644 --- a/src/project.h +++ b/src/project.h @@ -42,6 +42,8 @@ enum dlt_item_type { ecu_type = QTreeWidgetItem::UserType, application_type, context_type, filter_type, plugin_type }; +class ApplicationItem; + class EcuItem : public QTreeWidgetItem { public: @@ -99,6 +101,8 @@ class EcuItem : public QTreeWidgetItem bool isAutoReconnectTimeoutPassed(); void updateAutoReconnectTimestamp(); + ApplicationItem* find(const QString& apid) const; + private: QDateTime autoReconnectTimestamp; bool operator< ( const QTreeWidgetItem & other ) const; diff --git a/src/src.pro b/src/src.pro index a3918dd1..3b42f1ea 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,7 +6,7 @@ QT_VER_MIN = $$member(QT_VERSION, 1) CONFIG += c++1z *-gcc* { - QMAKE_CFLAGS += -std=gnu99 + QMAKE_CFLAGS += -std=c11 QMAKE_CFLAGS += -Wall QMAKE_CFLAGS += -Wextra #QMAKE_CXXFLAGS += -pedantic diff --git a/src/version.h b/src/version.h index 1cf2eb20..88996976 100644 --- a/src/version.h +++ b/src/version.h @@ -25,10 +25,10 @@ /* for other bugfixes and not major feature enhancement just use patch level */ #define PACKAGE_VERSION_STATE "stable" #define PACKAGE_MAJOR_VERSION 2 -#define PACKAGE_MINOR_VERSION 27 +#define PACKAGE_MINOR_VERSION 28 #define PACKAGE_PATCH_LEVEL 0 -#define PACKAGE_VERSION "2.27.0" -#define PACKAGE_REVISION "stable" +#define PACKAGE_VERSION "2.28.0" +#define PACKAGE_REVISION "unstable" #define PACKAGE_DESCRIPTION "DLT Viewer" #define DLT_SUPPORT_MAIL_ADDRESS "" #define DLT_SUPPORT_NAME "COVESA"