mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Go back to C++17
This commit is contained in:
parent
a1234f14b4
commit
4821885837
@ -22,7 +22,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Project information
|
||||
|
@ -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
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ void IO::FileTransmission::sendLine()
|
||||
{
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[=, this] {
|
||||
[=] {
|
||||
if (m_stream)
|
||||
{
|
||||
auto line = m_stream->readLine();
|
||||
|
@ -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());
|
||||
});
|
||||
|
@ -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();
|
||||
|
@ -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(),
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user