From 81cfad6f3b4367bdf0a855e3846b450c5a31abff Mon Sep 17 00:00:00 2001 From: Alexander Wenzel Date: Thu, 12 Sep 2024 08:37:44 +0200 Subject: [PATCH 1/3] Increase precision of float ouput to 8 digits (#530) Signed-off-by: Alexander Wenzel --- qdlt/qdltargument.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qdlt/qdltargument.cpp b/qdlt/qdltargument.cpp index 4d6f4eb0..893db5f5 100644 --- a/qdlt/qdltargument.cpp +++ b/qdlt/qdltargument.cpp @@ -494,21 +494,21 @@ QString QDltArgument::toString(bool binary) const { case 4: if(endianness == DltEndiannessLittleEndian) - text += QString("%1").arg((double)(*(float*)(data.constData()))); + text += QString("%1").arg((double)(*(float*)(data.constData())), 0, 'f', 8); else { const auto tmp = DLT_SWAP_32((unsigned int)(*(unsigned int*)(data.constData()))); void *buf = (void *) &tmp; - text += QString("%1").arg((double)(*((float*)buf))); + text += QString("%1").arg((double)(*((float*)buf)), 0, 'f', 8); } break; case 8: if(endianness == DltEndiannessLittleEndian) - text += QString("%1").arg((double)(*(double*)(data.constData()))); + text += QString("%1").arg((double)(*(double*)(data.constData())), 0, 'f', 8); else { const auto tmp = DLT_SWAP_64((unsigned long long)(*(unsigned long long*)(data.constData()))); void *buf = (void *) &tmp; - text += QString("%1").arg((double)(*((double*)buf))); + text += QString("%1").arg((double)(*((double*)buf)), 0, 'f', 8); } break; default: From 95655b7c8c18dd2adb8f9b472161b5f88751474d Mon Sep 17 00:00:00 2001 From: Viktor Kopp Date: Thu, 12 Sep 2024 08:40:10 +0200 Subject: [PATCH 2/3] Keep console logging if app is launched from cmd (#528) Signed-off-by: Viktor Kopp --- qdlt/qdltoptmanager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qdlt/qdltoptmanager.cpp b/qdlt/qdltoptmanager.cpp index 8a2d9f8f..c422b762 100644 --- a/qdlt/qdltoptmanager.cpp +++ b/qdlt/qdltoptmanager.cpp @@ -226,7 +226,6 @@ void QDltOptManager::parse(QStringList *opt) { QString c = opt->value(i+1); postPluginCommands += c; - QStringList args = c.split("|"); commandline_mode = true; ++i; } @@ -287,9 +286,16 @@ void QDltOptManager::parse(QStringList *opt) * So we have to close it in this case */ #if (WIN32) - if ( !commandline_mode) + if (!commandline_mode) { - FreeConsole(); + HWND consoleWnd = GetConsoleWindow(); + DWORD dwProcessId; + GetWindowThreadProcessId(consoleWnd, &dwProcessId); + if (GetCurrentProcessId() == dwProcessId) + { + // user launched the application with a double click from explorer: we do not need console + FreeConsole(); + } } #endif } From 07e1ad562a15e88e55261fe96b01fa1473a98194 Mon Sep 17 00:00:00 2001 From: Viktor Kopp Date: Thu, 12 Sep 2024 14:08:10 +0200 Subject: [PATCH 3/3] Make code backward compatible with Qt 5.12 (#531) Names of the signals changed between Qt 5.12 and 5.15, while we still need to maintain compatibility with 5.12 Signed-off-by: Viktor Kopp --- src/mainwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 04033c96..169ede80 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3532,7 +3532,11 @@ void MainWindow::connectECU(EcuItem* ecuitem,bool force) disconnect(ecuitem->socket,0,0,0); connect(ecuitem->socket,SIGNAL(connected()),this,SLOT(connected())); connect(ecuitem->socket,SIGNAL(disconnected()),this,SLOT(disconnected())); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + connect(ecuitem->socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError))); +#else connect(ecuitem->socket, &QAbstractSocket::errorOccurred, this, &MainWindow::error); +#endif connect(ecuitem->socket,SIGNAL(readyRead()),this,SLOT(readyRead())); connect(ecuitem->socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(stateChangedIP(QAbstractSocket::SocketState))); ecuitem->socket->connectToHost(ecuitem->getHostname(),ecuitem->getIpport()); @@ -3615,7 +3619,11 @@ void MainWindow::connectECU(EcuItem* ecuitem,bool force) connect(ecuitem->socket,SIGNAL(connected()),this,SLOT(connected())); connect(ecuitem->socket,SIGNAL(disconnected()),this,SLOT(disconnected())); - connect(ecuitem->socket,&QAbstractSocket::errorOccurred, this, &MainWindow::error); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + connect(ecuitem->socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError))); +#else + connect(ecuitem->socket, &QAbstractSocket::errorOccurred, this, &MainWindow::error); +#endif connect(ecuitem->socket,SIGNAL(readyRead()),this,SLOT(readyRead())); connect(ecuitem->socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(stateChangedIP(QAbstractSocket::SocketState))); ecuitem->update();