From 4821885837032bfc29fffdd48645ea10f561e7e9 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Mon, 18 Nov 2024 23:40:17 -0500 Subject: [PATCH] Go back to C++17 --- CMakeLists.txt | 2 +- app/CMakeLists.txt | 14 +------------- app/src/CSV/Player.cpp | 2 +- app/src/IO/Console.cpp | 2 +- app/src/IO/FileTransmission.cpp | 2 +- app/src/IO/FrameReader.cpp | 4 ++-- app/src/IO/Manager.cpp | 8 ++++---- app/src/JSON/FrameParser.cpp | 2 +- app/src/JSON/ProjectModel.cpp | 6 +++--- app/src/MQTT/Client.cpp | 2 +- app/src/UI/Dashboard.cpp | 27 +++++++++++++-------------- app/src/UI/Widgets/Terminal.cpp | 16 +++++++--------- lib/QRealFourier/CMakeLists.txt | 14 +------------- lib/QSimpleUpdater/CMakeLists.txt | 14 +------------- lib/QSourceHighlite/CMakeLists.txt | 14 +------------- lib/qmqtt/CMakeLists.txt | 10 +--------- 16 files changed, 40 insertions(+), 99 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d229c51b..04eee6e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.19) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) #------------------------------------------------------------------------------- # Project information diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index ea8846c9..b261c6bf 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -34,7 +34,7 @@ project(app LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) #------------------------------------------------------------------------------- @@ -278,18 +278,6 @@ install( ) endif() -#------------------------------------------------------------------------------- -# Configure unity build -#------------------------------------------------------------------------------- - -set_target_properties( - ${PROJECT_EXECUTABLE} PROPERTIES - UNITY_BUILD OFF - UNITY_BUILD_MODE BATCH - UNITY_BUILD_BATCH_SIZE 128 - INTERPROCEDURAL_OPTIMIZATION TRUE -) - #------------------------------------------------------------------------------- # Qt Deployment #------------------------------------------------------------------------------- diff --git a/app/src/CSV/Player.cpp b/app/src/CSV/Player.cpp index bdc3db41..bc1ceb78 100644 --- a/app/src/CSV/Player.cpp +++ b/app/src/CSV/Player.cpp @@ -486,7 +486,7 @@ void CSV::Player::updateData() const auto msecsToNextF = abs(currTime.msecsTo(nextTime)); // Jump to next frame - QTimer::singleShot(msecsToNextF, Qt::PreciseTimer, this, [=, this] { + QTimer::singleShot(msecsToNextF, Qt::PreciseTimer, this, [=] { if (isOpen() && isPlaying() && framePosition() < frameCount()) { ++m_framePos; diff --git a/app/src/IO/Console.cpp b/app/src/IO/Console.cpp index 8bc7cc89..0e13f8b5 100644 --- a/app/src/IO/Console.cpp +++ b/app/src/IO/Console.cpp @@ -548,7 +548,7 @@ void IO::Console::append(const QString &string, const bool addTimestamp) // Update UI QMetaObject::invokeMethod( - this, [=, this] { Q_EMIT displayString(processedString); }, + this, [=] { Q_EMIT displayString(processedString); }, Qt::QueuedConnection); } diff --git a/app/src/IO/FileTransmission.cpp b/app/src/IO/FileTransmission.cpp index 404154d9..b7064a0e 100644 --- a/app/src/IO/FileTransmission.cpp +++ b/app/src/IO/FileTransmission.cpp @@ -256,7 +256,7 @@ void IO::FileTransmission::sendLine() { QMetaObject::invokeMethod( this, - [=, this] { + [=] { if (m_stream) { auto line = m_stream->readLine(); diff --git a/app/src/IO/FrameReader.cpp b/app/src/IO/FrameReader.cpp index 8180aa74..a78cac6e 100644 --- a/app/src/IO/FrameReader.cpp +++ b/app/src/IO/FrameReader.cpp @@ -122,12 +122,12 @@ void IO::FrameReader::setupExternalConnections() setFrameDetectionMode(JSON::ProjectModel::instance().frameDetection()); connect(&JSON::FrameBuilder::instance(), - &JSON::FrameBuilder::operationModeChanged, this, [=, this] { + &JSON::FrameBuilder::operationModeChanged, this, [=] { setOperationMode(JSON::FrameBuilder::instance().operationMode()); }); connect(&JSON::ProjectModel::instance(), - &JSON::ProjectModel::frameDetectionChanged, this, [=, this] { + &JSON::ProjectModel::frameDetectionChanged, this, [=] { setFrameDetectionMode( JSON::ProjectModel::instance().frameDetection()); }); diff --git a/app/src/IO/Manager.cpp b/app/src/IO/Manager.cpp index c5441e6f..b0aefcc1 100644 --- a/app/src/IO/Manager.cpp +++ b/app/src/IO/Manager.cpp @@ -79,7 +79,7 @@ IO::Manager::Manager() &IO::Manager::configurationChanged); // Avoid crashing the app when quitting - connect(qApp, &QApplication::aboutToQuit, this, [=, this] { + connect(qApp, &QApplication::aboutToQuit, this, [=] { disconnect(&m_frameReader); m_workerThread.quit(); if (!m_workerThread.wait(100)) @@ -396,7 +396,7 @@ void IO::Manager::processPayload(const QByteArray &payload) QByteArray copy = payload; QMetaObject::invokeMethod( this, - [=, this] { + [=] { Q_EMIT dataReceived(copy); Q_EMIT frameReceived(copy); }, @@ -422,7 +422,7 @@ void IO::Manager::setStartSequence(const QString &sequence) if (m_workerThread.isRunning()) QMetaObject::invokeMethod( &m_frameReader, - [=, this] { m_frameReader.setStartSequence(m_startSequence); }, + [=] { m_frameReader.setStartSequence(m_startSequence); }, Qt::QueuedConnection); Q_EMIT startSequenceChanged(); @@ -446,7 +446,7 @@ void IO::Manager::setFinishSequence(const QString &sequence) if (m_workerThread.isRunning()) QMetaObject::invokeMethod( &m_frameReader, - [=, this] { m_frameReader.setFinishSequence(m_finishSequence); }, + [=] { m_frameReader.setFinishSequence(m_finishSequence); }, Qt::QueuedConnection); Q_EMIT finishSequenceChanged(); diff --git a/app/src/JSON/FrameParser.cpp b/app/src/JSON/FrameParser.cpp index 628bc9e9..f6f9c79d 100644 --- a/app/src/JSON/FrameParser.cpp +++ b/app/src/JSON/FrameParser.cpp @@ -91,7 +91,7 @@ JSON::FrameParser::FrameParser(QQuickItem *parent) // Connect modification check signals connect(m_textEdit.document(), &QTextDocument::modificationChanged, this, - [=, this] { Q_EMIT modifiedChanged(); }); + [=] { Q_EMIT modifiedChanged(); }); // Load code from JSON model automatically connect(&JSON::ProjectModel::instance(), diff --git a/app/src/JSON/ProjectModel.cpp b/app/src/JSON/ProjectModel.cpp index 2f47d63c..00431f62 100644 --- a/app/src/JSON/ProjectModel.cpp +++ b/app/src/JSON/ProjectModel.cpp @@ -155,7 +155,7 @@ JSON::ProjectModel::ProjectModel() generateComboBoxModels(); // Clear selection model when JSON file is changed - connect(this, &JSON::ProjectModel::jsonFileChanged, this, [=, this] { + connect(this, &JSON::ProjectModel::jsonFileChanged, this, [=] { if (m_selectionModel) { auto index = m_treeModel->index(0, 0); @@ -788,7 +788,7 @@ void JSON::ProjectModel::setupExternalConnections() // Generate combo-boxes again when app is translated connect(&Misc::Translator::instance(), &Misc::Translator::languageChanged, - this, [=, this] { + this, [=] { generateComboBoxModels(); buildTreeModel(); @@ -2586,7 +2586,7 @@ void JSON::ProjectModel::setCurrentView(const CurrentView currentView) { if (it.value() == kFrameParser) { - QTimer::singleShot(100, this, [=, this] { + QTimer::singleShot(100, this, [=] { selectionModel()->setCurrentIndex( it.key()->index(), QItemSelectionModel::ClearAndSelect); }); diff --git a/app/src/MQTT/Client.cpp b/app/src/MQTT/Client.cpp index c5df9b07..d1229b7b 100644 --- a/app/src/MQTT/Client.cpp +++ b/app/src/MQTT/Client.cpp @@ -65,7 +65,7 @@ MQTT::Client::Client() &MQTT::Client::resetStatistics); // Disconenct from current IO connection when MQTT client is subscribed - connect(this, &MQTT::Client::connectedChanged, this, [=, this] { + connect(this, &MQTT::Client::connectedChanged, this, [=] { if (isSubscribed()) { if (IO::Manager::instance().connected()) diff --git a/app/src/UI/Dashboard.cpp b/app/src/UI/Dashboard.cpp index e851da9a..38b0c45b 100644 --- a/app/src/UI/Dashboard.cpp +++ b/app/src/UI/Dashboard.cpp @@ -48,27 +48,26 @@ UI::Dashboard::Dashboard() , m_axisVisibility(SerialStudio::AxisXY) { // clang-format off - connect(&CSV::Player::instance(), &CSV::Player::openChanged, this, [=, this] { resetData(); }); - connect(&IO::Manager::instance(), &IO::Manager::connectedChanged, this, [=, this] { resetData(); }); - connect(&JSON::FrameBuilder::instance(), &JSON::FrameBuilder::jsonFileMapChanged, this, [=, this] { resetData(); }); + connect(&CSV::Player::instance(), &CSV::Player::openChanged, this, [=] { resetData(); }); + connect(&IO::Manager::instance(), &IO::Manager::connectedChanged, this, [=] { resetData(); }); + connect(&JSON::FrameBuilder::instance(), &JSON::FrameBuilder::jsonFileMapChanged, this, [=] { resetData(); }); connect(&JSON::FrameBuilder::instance(), &JSON::FrameBuilder::frameChanged, this, &UI::Dashboard::processFrame, Qt::QueuedConnection); // clang-format on // Reset dashboard data if MQTT client is subscribed - connect(&MQTT::Client::instance(), &MQTT::Client::connectedChanged, this, - [=, this] { - const bool subscribed = MQTT::Client::instance().isSubscribed(); - const bool wasSubscribed - = !MQTT::Client::instance().isConnectedToHost() - && MQTT::Client::instance().clientMode() - == MQTT::ClientSubscriber; - if (subscribed || wasSubscribed) - resetData(); - }); + connect( + &MQTT::Client::instance(), &MQTT::Client::connectedChanged, this, [=] { + const bool subscribed = MQTT::Client::instance().isSubscribed(); + const bool wasSubscribed = !MQTT::Client::instance().isConnectedToHost() + && MQTT::Client::instance().clientMode() + == MQTT::ClientSubscriber; + if (subscribed || wasSubscribed) + resetData(); + }); // Update the dashboard widgets at 24 Hz connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout24Hz, this, - [=, this] { + [=] { if (m_updateRequired) { m_updateRequired = false; diff --git a/app/src/UI/Widgets/Terminal.cpp b/app/src/UI/Widgets/Terminal.cpp index d0c878d5..bd720318 100644 --- a/app/src/UI/Widgets/Terminal.cpp +++ b/app/src/UI/Widgets/Terminal.cpp @@ -103,22 +103,20 @@ Widgets::Terminal::Terminal(QQuickItem *parent) &Widgets::Terminal::append, Qt::QueuedConnection); // Clear the screen when device is connected/disconnected - connect(&IO::Manager::instance(), &IO::Manager::connectedChanged, this, - [=, this] { - if (IO::Manager::instance().connected()) - clear(); - }); + connect(&IO::Manager::instance(), &IO::Manager::connectedChanged, this, [=] { + if (IO::Manager::instance().connected()) + clear(); + }); // Redraw widget as soon as it is visible - connect(this, &Widgets::Terminal::visibleChanged, this, [=, this] { + connect(this, &Widgets::Terminal::visibleChanged, this, [=] { if (isVisible()) update(); }); // Change character widths when changing language connect(&Misc::Translator::instance(), &Misc::Translator::languageChanged, - this, - [=, this] { setFont(Misc::CommonFonts::instance().monoFont()); }); + this, [=] { setFont(Misc::CommonFonts::instance().monoFont()); }); // Blink the cursor m_cursorTimer.start(200); @@ -129,7 +127,7 @@ Widgets::Terminal::Terminal(QQuickItem *parent) // Redraw the widget only when necessary m_stateChanged = true; connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout24Hz, this, - [=, this] { + [=] { if (isVisible() && m_stateChanged) { m_stateChanged = false; diff --git a/lib/QRealFourier/CMakeLists.txt b/lib/QRealFourier/CMakeLists.txt index 7656437c..1d4dead7 100644 --- a/lib/QRealFourier/CMakeLists.txt +++ b/lib/QRealFourier/CMakeLists.txt @@ -34,7 +34,7 @@ project(QRealFourier CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -109,15 +109,3 @@ target_include_directories( QRealFourier PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/headers ) - -#------------------------------------------------------------------------------- -# Configure unity build -#------------------------------------------------------------------------------- - -set_target_properties( - QRealFourier PROPERTIES - UNITY_BUILD ON - UNITY_BUILD_MODE BATCH - UNITY_BUILD_BATCH_SIZE 128 - INTERPROCEDURAL_OPTIMIZATION TRUE -) diff --git a/lib/QSimpleUpdater/CMakeLists.txt b/lib/QSimpleUpdater/CMakeLists.txt index 65e3ba53..2e79a3a8 100644 --- a/lib/QSimpleUpdater/CMakeLists.txt +++ b/lib/QSimpleUpdater/CMakeLists.txt @@ -34,7 +34,7 @@ project(QSimpleUpdater CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -97,15 +97,3 @@ target_include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include ) - -#------------------------------------------------------------------------------- -# Configure unity build -#------------------------------------------------------------------------------- - -set_target_properties( - QSimpleUpdater PROPERTIES - UNITY_BUILD ON - UNITY_BUILD_MODE BATCH - UNITY_BUILD_BATCH_SIZE 128 - INTERPROCEDURAL_OPTIMIZATION TRUE -) diff --git a/lib/QSourceHighlite/CMakeLists.txt b/lib/QSourceHighlite/CMakeLists.txt index 425233b2..e633c632 100644 --- a/lib/QSourceHighlite/CMakeLists.txt +++ b/lib/QSourceHighlite/CMakeLists.txt @@ -34,7 +34,7 @@ project(QSourceHighlite CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -85,15 +85,3 @@ target_include_directories( QSourceHighlite PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) - -#------------------------------------------------------------------------------- -# Configure unity build -#------------------------------------------------------------------------------- - -set_target_properties( - QSourceHighlite PROPERTIES - UNITY_BUILD ON - UNITY_BUILD_MODE BATCH - UNITY_BUILD_BATCH_SIZE 128 - INTERPROCEDURAL_OPTIMIZATION TRUE -) diff --git a/lib/qmqtt/CMakeLists.txt b/lib/qmqtt/CMakeLists.txt index 32b4caa1..43dd1c56 100644 --- a/lib/qmqtt/CMakeLists.txt +++ b/lib/qmqtt/CMakeLists.txt @@ -108,14 +108,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} - CXX_STANDARD 20 + CXX_STANDARD 17 CXX_STANDARD_REQUIRED OFF ) - -set_target_properties( - ${PROJECT_NAME} PROPERTIES - UNITY_BUILD ON - UNITY_BUILD_MODE BATCH - UNITY_BUILD_BATCH_SIZE 128 - INTERPROCEDURAL_OPTIMIZATION TRUE -)