diff --git a/.appveyor.yml b/.appveyor.yml index 4c7d23fc..bffd774f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,7 +2,6 @@ image: - Visual Studio 2022 - Visual Studio 2019 - Visual Studio 2017 - - Visual Studio 2015 init: - git config --global core.autocrlf input @@ -19,12 +18,8 @@ configuration: - Release environment: - COMMS_BRANCH: v5.2.1 + COMMS_BRANCH: v5.2.2 matrix: - - CPP_STD: 11 - QT_MAJOR: 5 - - CPP_STD: 14 - QT_MAJOR: 5 - CPP_STD: 17 QT_MAJOR: 5 - CPP_STD: 17 @@ -37,14 +32,8 @@ environment: matrix: fast_finish: false exclude: - - image: Visual Studio 2015 - CPP_STD: 17 - - image: Visual Studio 2015 - CPP_STD: 20 - image: Visual Studio 2017 CPP_STD: 20 - - image: Visual Studio 2015 - QT_MAJOR: 6 - image: Visual Studio 2017 QT_MAJOR: 6 - platform: x86 @@ -59,14 +48,16 @@ install: - set COMMON_INSTALL_DIR=%BUILD_DIR%\install - set COMMON_BUILD_TYPE=%CONFIGURATION% - set COMMON_CXX_STANDARD=%CPP_STD% + - set GENERATOR="%CMAKE_GENERATOR%" + - set PLATFORM="%CMAKE_PLATFORM%" - call script\prepare_externals.bat build_script: - echo ------------------------- Building Project ------------------------- - cd %BUILD_DIR% - - cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="%COMMON_INSTALL_DIR%" ^ + - cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" %PLATFORM_PARAM% -DCMAKE_INSTALL_PREFIX="%COMMON_INSTALL_DIR%" ^ -DCMAKE_PREFIX_PATH="%COMMON_INSTALL_DIR%;%QTDIR%" -DCMAKE_CXX_STANDARD=%CPP_STD% ^ - -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=%QT_MAJOR% + -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=%QT_MAJOR% - cmake --build . --config %CONFIGURATION% --target install - echo -------------------------- Deploying Qt --------------------------- - cmake --build . --config %CONFIGURATION% --target deploy_qt diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 6d951729..854e68d1 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -3,114 +3,9 @@ name: Github Actions Build on: [push] env: - COMMS_BRANCH: v5.2.1 + COMMS_BRANCH: v5.2.2 jobs: - build_gcc_old_ubuntu_20_04: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - type: [Debug, Release, MinSizeRel] - cc_ver: [4.8, 5, 6, 7] - cpp: [11, 14] - exclude: - - cc_ver: 4.8 - cpp: 14 - - steps: - - uses: actions/checkout@v2 - - - name: Add repositories - run: | - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic main'; \ - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic universe' - - - name: Prepare Install - run: sudo apt-get update --fix-missing - - - name: Install Packages - run: sudo apt install qtbase5-dev libqt5serialport5-dev libxml2-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Prepare externals - shell: bash - run: $GITHUB_WORKSPACE/script/prepare_externals.sh - env: - BUILD_DIR: ${{runner.workspace}}/build - CC: gcc-${{matrix.cc_ver}} - CXX: g++-${{matrix.cc_ver}} - EXTERNALS_DIR: ${{runner.workspace}}/externals - COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install - COMMON_BUILD_TYPE: ${{matrix.type}} - COMMON_CXX_STANDARD: ${{matrix.cpp}} - COMMS_TAG: ${{env.COMMS_BRANCH}} - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON - env: - CC: gcc-${{matrix.cc_ver}} - CXX: g++-${{matrix.cc_ver}} - - - name: Build Target - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config ${{matrix.type}} --target install - env: - VERBOSE: 1 - - build_gcc_ubuntu_20_04: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - type: [Debug, Release, MinSizeRel] - cc_ver: [8] - cpp: [11, 14, 17] - - steps: - - uses: actions/checkout@v2 - - - name: Prepare Install - run: sudo apt-get update --fix-missing - - - name: Install Packages - run: sudo apt install qtbase5-dev libqt5serialport5-dev libxml2-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Prepare externals - shell: bash - run: $GITHUB_WORKSPACE/script/prepare_externals.sh - env: - BUILD_DIR: ${{runner.workspace}}/build - CC: gcc-${{matrix.cc_ver}} - CXX: g++-${{matrix.cc_ver}} - EXTERNALS_DIR: ${{runner.workspace}}/externals - COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install - COMMON_BUILD_TYPE: ${{matrix.type}} - COMMON_CXX_STANDARD: ${{matrix.cpp}} - COMMS_TAG: ${{env.COMMS_BRANCH}} - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON - env: - CC: gcc-${{matrix.cc_ver}} - CXX: g++-${{matrix.cc_ver}} - - - name: Build Target - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config ${{matrix.type}} --target install - env: - VERBOSE: 1 build_gcc_ubuntu_22_04: runs-on: ubuntu-22.04 @@ -119,7 +14,7 @@ jobs: matrix: type: [Debug, Release, MinSizeRel] cc_ver: [9, 10, 11, 12] - cpp: [11, 14, 17, 20] + cpp: [17, 20] qt_ver: [5, 6] steps: @@ -129,7 +24,7 @@ jobs: run: sudo apt-get update --fix-missing - name: Install Packages - run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev libxml2-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}} + run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}} - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -153,7 +48,7 @@ jobs: run: | cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \ - -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}} + -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}} env: CC: gcc-${{matrix.cc_ver}} CXX: g++-${{matrix.cc_ver}} @@ -165,127 +60,24 @@ jobs: env: VERBOSE: 1 - build_clang_old_ubuntu_20_04: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - type: [Debug, Release, MinSizeRel] - cc_ver: ["4.0", "5.0", "6.0"] - cpp: [11, 14, 17] - exclude: - - cc_ver: "4.0" - cpp: 17 - - - steps: - - uses: actions/checkout@v2 - - - name: Add repositories - run: | - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic main'; \ - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic universe' - - - name: Prepare Install - run: sudo apt-get update --fix-missing - - - name: Install Packages - run: sudo apt install qtbase5-dev libqt5serialport5-dev libxml2-dev clang-${{matrix.cc_ver}} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Prepare externals - shell: bash - run: $GITHUB_WORKSPACE/script/prepare_externals.sh - env: - BUILD_DIR: ${{runner.workspace}}/build - CC: clang-${{matrix.cc_ver}} - CXX: clang++-${{matrix.cc_ver}} - EXTERNALS_DIR: ${{runner.workspace}}/externals - COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install - COMMON_BUILD_TYPE: ${{matrix.type}} - COMMON_CXX_STANDARD: ${{matrix.cpp}} - COMMS_TAG: ${{env.COMMS_BRANCH}} - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON - env: - CC: clang-${{matrix.cc_ver}} - CXX: clang++-${{matrix.cc_ver}} - - - name: Build Target - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config ${{matrix.type}} --target install - env: - VERBOSE: 1 - - build_clang_ubuntu_20_04: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - type: [Debug, Release, MinSizeRel] - cc_ver: [7, 8, 9, 10, 11] - cpp: [11, 14, 17, 20] - exclude: - - cc_ver: 7 - cpp: 20 - - cc_ver: 8 - cpp: 20 - - steps: - - uses: actions/checkout@v2 - - - name: Prepare Install - run: sudo apt-get update --fix-missing - - - name: Install Packages - run: sudo apt install qtbase5-dev libqt5serialport5-dev libxml2-dev clang-${{matrix.cc_ver}} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Prepare externals - shell: bash - run: $GITHUB_WORKSPACE/script/prepare_externals.sh - env: - BUILD_DIR: ${{runner.workspace}}/build - CC: clang-${{matrix.cc_ver}} - CXX: clang++-${{matrix.cc_ver}} - EXTERNALS_DIR: ${{runner.workspace}}/externals - COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install - COMMON_BUILD_TYPE: ${{matrix.type}} - COMMON_CXX_STANDARD: ${{matrix.cpp}} - COMMS_TAG: ${{env.COMMS_BRANCH}} - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON - env: - CC: clang-${{matrix.cc_ver}} - CXX: clang++-${{matrix.cc_ver}} - - - name: Build Target - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config ${{matrix.type}} --target install - env: - VERBOSE: 1 - build_clang_ubuntu_22_04: runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: type: [Debug, Release, MinSizeRel] - cc_ver: [12, 13, 14] - cpp: [11, 14, 17, 20] + cc_ver: [11, 12, 13, 14, 15] + cpp: [17, 20] qt_ver: [5, 6] + exclude: + - cc_ver: 11 + cpp: 20 + - cc_ver: 12 + cpp: 20 + - cc_ver: 13 + cpp: 20 + - cc_ver: 14 + cpp: 20 steps: - uses: actions/checkout@v2 @@ -294,7 +86,7 @@ jobs: run: sudo apt-get update --fix-missing - name: Install Packages - run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev libxml2-dev clang-${{matrix.cc_ver}} + run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev clang-${{matrix.cc_ver}} - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -318,7 +110,7 @@ jobs: run: | cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \ - -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}} + -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}} env: CC: clang-${{matrix.cc_ver}} CXX: clang++-${{matrix.cc_ver}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 070c777d..d351891e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,20 +2,28 @@ cmake_minimum_required (VERSION 3.11) project ("cc_tools_qt") # Available options - option (CC_TOOLS_QT_INSTALL_LIBRARY_HEADERS "Install tools library headers." ON) option (CC_TOOLS_QT_BUILD_APPS "Build tool applications." ON) -option (CC_TOOLS_QT_INSTALL_APPS "Install tools binaries." ${CC_TOOLS_QT_BUILD_APPS}) option (CC_TOOLS_QT_BUILD_PLUGINS "Build plugins." ${CC_TOOLS_QT_BUILD_APPS}) -option (CC_TOOLS_QT_INSTALL_PLUGINS "Install plugins." ${CC_TOOLS_QT_BUILD_PLUGINS}) -option (CC_TOOLS_QT_BUILD_DEMO_PROTOCOL "Build demo protocol plugin." OFF) -option (CC_TOOLS_QT_INSTALL_DEMO_PROTOCOL "Install demo protocol plugin." ${CC_TOOLS_QT_BUILD_DEMO_PROTOCOL}) option (CC_TOOLS_QT_WARN_AS_ERR "Treat warning as error" ON) option (CC_TOOLS_QT_USE_CCACHE "Use ccache on UNIX systems if it's available" ON) -option (CC_TOOLS_QT_SKIP_CXX_STANDARD_FORCING "Do NOT force C++ standard to C++11, use compiler's default one." ON) option (CC_TOOLS_QT_STATIC_RUNTIME "Enable/Disable static runtime" OFF) +# More fine-grained options +option (CC_TOOLS_QT_BUILD_PLUGIN_ECHO_SOCKET "Build echo socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_NULL_SOCKET "Build null socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_SERIAL_SOCKET "Build serial socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_SSL_CLIENT_SOCKET "Build SSL client socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_CLIENT_SOCKET "Build TCP client socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_PROXY_SOCKET "Build TCP proxy socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_TCP_SERVER_SOCKET "Build TCP server socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_UDP_SOCKET "Build UDP socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_RAW_DATA_PROTOCOL "Build raw data protocol plugin." ${CC_TOOLS_QT_BUILD_PLUGINS}) +option (CC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL "Build demo protocol plugin." OFF) + + # Extra configuration variables +set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use") set (CC_TOOLS_QT_MAJOR_QT_VERSION 5 CACHE STRING "Major Qt version") ####################################################################### @@ -26,10 +34,6 @@ endif() set (CMAKE_SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/cmake") -if (("${CMAKE_CXX_STANDARD}" STREQUAL "") AND (NOT CC_COMMS_SKIP_CXX_STANDARD_FORCING)) - set (CMAKE_CXX_STANDARD 11) -endif() - include(GNUInstallDirs) set (INSTALL_NAME "cc_tools_qt") set (LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 3f71360d..83e42c43 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -14,7 +14,7 @@ add_definitions( add_subdirectory (cc_view) add_subdirectory (cc_dump) -if (WIN32 AND CC_TOOLS_QT_INSTALL_APPS) +if (WIN32) add_custom_target ("deploy_qt" COMMAND ${CMAKE_COMMAND} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} diff --git a/app/cc_dump/CMakeLists.txt b/app/cc_dump/CMakeLists.txt index a154c5a5..7d9bba67 100644 --- a/app/cc_dump/CMakeLists.txt +++ b/app/cc_dump/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory (src) -if (UNIX AND CC_TOOLS_QT_INSTALL_APPS) +if (UNIX) install( PROGRAMS script/cc_dump.sh DESTINATION ${BIN_INSTALL_DIR} diff --git a/app/cc_dump/src/AppMgr.cpp b/app/cc_dump/src/AppMgr.cpp index 634f3c1c..5c4e8f95 100644 --- a/app/cc_dump/src/AppMgr.cpp +++ b/app/cc_dump/src/AppMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,10 +21,8 @@ #include #include -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" @@ -47,8 +45,7 @@ AppMgr::AppMgr() [this](cc::MessagePtr msg) { if (!msg) { - static constexpr bool Application_message_was_not_provided = false; - static_cast(Application_message_was_not_provided); + [[maybe_unused]] static constexpr bool Application_message_was_not_provided = false; assert(Application_message_was_not_provided); return; } @@ -184,8 +181,7 @@ bool AppMgr::applyPlugins(const ListOfPluginInfos& plugins) for (auto& info : plugins) { cc::Plugin* plugin = m_pluginMgr.loadPlugin(*info); if (plugin == nullptr) { - static constexpr bool Failed_to_load_plugin = false; - static_cast(Failed_to_load_plugin); + [[maybe_unused]] static constexpr bool Failed_to_load_plugin = false; assert(Failed_to_load_plugin); continue; } diff --git a/app/cc_dump/src/AppMgr.h b/app/cc_dump/src/AppMgr.h index 15af5ae6..b5d3ecb7 100644 --- a/app/cc_dump/src/AppMgr.h +++ b/app/cc_dump/src/AppMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,13 +19,9 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/PluginMgr.h" #include "cc_tools_qt/MsgMgr.h" diff --git a/app/cc_dump/src/CMakeLists.txt b/app/cc_dump/src/CMakeLists.txt index 44785369..a0970463 100644 --- a/app/cc_dump/src/CMakeLists.txt +++ b/app/cc_dump/src/CMakeLists.txt @@ -16,11 +16,9 @@ function (bin_cc_dump) add_executable(${name} ${src} ${moc}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core) - if (CC_TOOLS_QT_INSTALL_APPS) - install ( - TARGETS ${name} - DESTINATION ${BIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${BIN_INSTALL_DIR}) endfunction () diff --git a/app/cc_dump/src/CsvDumpMessageHandler.cpp b/app/cc_dump/src/CsvDumpMessageHandler.cpp index 654e8d70..cc6a9f62 100644 --- a/app/cc_dump/src/CsvDumpMessageHandler.cpp +++ b/app/cc_dump/src/CsvDumpMessageHandler.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -120,11 +120,9 @@ class CsvDumpFieldsHandler : public cc::field_wrapper::FieldWrapperHandler m_out << m_sep << wrapper.getValue(); } - virtual void handle(cc::field_wrapper::VariantWrapper& wrapper) override + virtual void handle([[maybe_unused]] cc::field_wrapper::VariantWrapper& wrapper) override { - static_cast(wrapper); - static constexpr bool Not_yet_implemented = false; - static_cast(Not_yet_implemented); + [[maybe_unused]] static constexpr bool Not_yet_implemented = false; assert(Not_yet_implemented); } @@ -133,11 +131,9 @@ class CsvDumpFieldsHandler : public cc::field_wrapper::FieldWrapperHandler m_out << m_sep << '\"' << wrapper.getSerialisedString().toStdString() << '\"'; } - virtual void handle(cc::field_wrapper::FieldWrapper& wrapper) override + virtual void handle([[maybe_unused]] cc::field_wrapper::FieldWrapper& wrapper) override { - static_cast(wrapper); - static constexpr bool Unexpected_wrapper = false; - static_cast(Unexpected_wrapper); + [[maybe_unused]] static constexpr bool Unexpected_wrapper = false; assert(Unexpected_wrapper); } diff --git a/app/cc_dump/src/CsvDumpMessageHandler.h b/app/cc_dump/src/CsvDumpMessageHandler.h index bcc467cc..f1f0a93f 100644 --- a/app/cc_dump/src/CsvDumpMessageHandler.h +++ b/app/cc_dump/src/CsvDumpMessageHandler.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_dump/src/RecordMessageHandler.cpp b/app/cc_dump/src/RecordMessageHandler.cpp index e9ba75d6..e69831f1 100644 --- a/app/cc_dump/src/RecordMessageHandler.cpp +++ b/app/cc_dump/src/RecordMessageHandler.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_dump/src/RecordMessageHandler.h b/app/cc_dump/src/RecordMessageHandler.h index b1dbea44..8329b09a 100644 --- a/app/cc_dump/src/RecordMessageHandler.h +++ b/app/cc_dump/src/RecordMessageHandler.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,11 +20,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/MessageHandler.h" #include "cc_tools_qt/MsgFileMgr.h" diff --git a/app/cc_dump/src/main.cpp b/app/cc_dump/src/main.cpp index e2e762b0..c4e4e633 100644 --- a/app/cc_dump/src/main.cpp +++ b/app/cc_dump/src/main.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,15 +17,11 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "cc_tools_qt/Protocol.h" diff --git a/app/cc_view/CMakeLists.txt b/app/cc_view/CMakeLists.txt index 1f58b2fc..4a72cf1b 100644 --- a/app/cc_view/CMakeLists.txt +++ b/app/cc_view/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory (src) -if (UNIX AND CC_TOOLS_QT_INSTALL_APPS) +if (UNIX) install( PROGRAMS script/cc_view.sh DESTINATION ${BIN_INSTALL_DIR} diff --git a/app/cc_view/src/ActionWrap.h b/app/cc_view/src/ActionWrap.h index 3576833c..f7427560 100644 --- a/app/cc_view/src/ActionWrap.h +++ b/app/cc_view/src/ActionWrap.h @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/CMakeLists.txt b/app/cc_view/src/CMakeLists.txt index 8e9f22b7..446ddaac 100644 --- a/app/cc_view/src/CMakeLists.txt +++ b/app/cc_view/src/CMakeLists.txt @@ -29,6 +29,8 @@ function (bin_cc_view) widget/MessageUpdateDialog.cpp widget/PluginsListWidget.cpp widget/PluginConfigDialog.cpp + widget/PluginConfigWrapWidget.cpp + widget/PluginConfigWrapsListWidget.cpp widget/MsgCommentDialog.cpp widget/field/FieldWidget.cpp widget/MessagesFilterDialog.cpp @@ -104,6 +106,7 @@ function (bin_cc_view) ui/RawHexDataDialog.ui ui/PluginsListWidget.ui ui/PluginConfigDialog.ui + ui/PluginConfigWrapWidget.ui ui/ShortIntValueFieldWidget.ui ui/LongIntValueFieldWidget.ui ui/LongLongIntValueFieldWidget.ui @@ -134,17 +137,15 @@ function (bin_cc_view) add_executable(${name} ${gui_exe} ${src} ${moc} ${ui} ${resources}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_APPS) - install ( - TARGETS ${name} - DESTINATION ${BIN_INSTALL_DIR}) - - install ( - FILES image/app_icon.png - DESTINATION ${ICON_INSTALL_DIR} - RENAME cc_view.png - ) - endif () + install ( + TARGETS ${name} + DESTINATION ${BIN_INSTALL_DIR}) + + install ( + FILES image/app_icon.png + DESTINATION ${ICON_INSTALL_DIR} + RENAME cc_view.png + ) endfunction () diff --git a/app/cc_view/src/DefaultMessageDisplayHandler.cpp b/app/cc_view/src/DefaultMessageDisplayHandler.cpp index b59ec9a9..9a00400e 100644 --- a/app/cc_view/src/DefaultMessageDisplayHandler.cpp +++ b/app/cc_view/src/DefaultMessageDisplayHandler.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -194,11 +194,9 @@ class WidgetCreator : public field_wrapper::FieldWrapperHandler m_widget.reset(new UnknownValueFieldWidget(wrapper.clone(), m_parent)); } - virtual void handle(field_wrapper::FieldWrapper& wrapper) override + virtual void handle([[maybe_unused]] field_wrapper::FieldWrapper& wrapper) override { - static_cast(wrapper); - static constexpr bool Unexpected_wrapper = false; - static_cast(Unexpected_wrapper); + [[maybe_unused]] static constexpr bool Unexpected_wrapper = false; assert(Unexpected_wrapper); } diff --git a/app/cc_view/src/DefaultMessageDisplayHandler.h b/app/cc_view/src/DefaultMessageDisplayHandler.h index 36742971..33922c00 100644 --- a/app/cc_view/src/DefaultMessageDisplayHandler.h +++ b/app/cc_view/src/DefaultMessageDisplayHandler.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" diff --git a/app/cc_view/src/GuiAppMgr.cpp b/app/cc_view/src/GuiAppMgr.cpp index 36c0bae3..2aafd2b8 100644 --- a/app/cc_view/src/GuiAppMgr.cpp +++ b/app/cc_view/src/GuiAppMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,14 +21,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "DefaultMessageDisplayHandler.h" @@ -399,8 +395,7 @@ void GuiAppMgr::connectSocketClicked() { auto socket = MsgMgrG::instanceRef().getSocket(); assert(socket); - bool connected = socket->socketConnect(); - emit sigSocketConnected(connected); + [[maybe_unused]] bool connected = socket->socketConnect(); } void GuiAppMgr::disconnectSocketClicked() @@ -408,7 +403,6 @@ void GuiAppMgr::disconnectSocketClicked() auto socket = MsgMgrG::instanceRef().getSocket(); assert(socket); socket->socketDisconnect(); - socketDisconnected(); } GuiAppMgr::RecvState GuiAppMgr::recvState() const @@ -572,7 +566,6 @@ bool GuiAppMgr::applyNewPlugins(const ListOfPluginInfos& plugins) auto currSocket = msgMgr.getSocket(); if (currSocket) { currSocket->socketDisconnect(); - emit sigSocketConnected(false); currSocket.reset(); } @@ -628,8 +621,7 @@ bool GuiAppMgr::applyNewPlugins(const ListOfPluginInfos& plugins) for (auto& info : plugins) { Plugin* plugin = pluginMgr.loadPlugin(*info); if (plugin == nullptr) { - static constexpr bool Failed_to_load_plugin = false; - static_cast(Failed_to_load_plugin); + [[maybe_unused]] static constexpr bool Failed_to_load_plugin = false; assert(Failed_to_load_plugin); continue; } @@ -686,11 +678,9 @@ bool GuiAppMgr::applyNewPlugins(const ListOfPluginInfos& plugins) bool connectDisabled = socketAutoConnect && socketNonDisconnectable; emit sigSocketConnectEnabled(!connectDisabled); - bool socketConnected = false; if (socketAutoConnect) { - socketConnected = msgMgr.getSocket()->socketConnect(); + msgMgr.getSocket()->socketConnect(); } - emit sigSocketConnected(socketConnected); return true; } @@ -728,10 +718,10 @@ GuiAppMgr::GuiAppMgr(QObject* parentObj) errorReported(error); }); - msgMgr.setSocketDisconnectReportCallbackFunc( - [this]() + msgMgr.setSocketConnectionStatusReportCallbackFunc( + [this](bool connected) { - socketDisconnected(); + emit sigSocketConnected(connected); }); refreshRecvState(); @@ -793,11 +783,6 @@ void GuiAppMgr::errorReported(const QString& msg) emit sigErrorReported(msg + tr("\nThe tool may not work properly!")); } -void GuiAppMgr::socketDisconnected() -{ - emit sigSocketConnected(false); -} - void GuiAppMgr::pendingDisplayTimeout() { m_pendingDisplayWaitInProgress = false; diff --git a/app/cc_view/src/GuiAppMgr.h b/app/cc_view/src/GuiAppMgr.h index 05d6d651..1806911f 100644 --- a/app/cc_view/src/GuiAppMgr.h +++ b/app/cc_view/src/GuiAppMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,14 +20,10 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "cc_tools_qt/PluginMgr.h" @@ -224,7 +220,6 @@ public slots: private slots: void msgAdded(MessagePtr msg); void errorReported(const QString& msg); - void socketDisconnected(); void pendingDisplayTimeout(); private /*data*/: diff --git a/app/cc_view/src/MsgFileMgrG.cpp b/app/cc_view/src/MsgFileMgrG.cpp index d81e338e..91100d19 100644 --- a/app/cc_view/src/MsgFileMgrG.cpp +++ b/app/cc_view/src/MsgFileMgrG.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/MsgFileMgrG.h b/app/cc_view/src/MsgFileMgrG.h index b54072fb..0b1fa6c1 100644 --- a/app/cc_view/src/MsgFileMgrG.h +++ b/app/cc_view/src/MsgFileMgrG.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/MsgMgrG.cpp b/app/cc_view/src/MsgMgrG.cpp index e32f5b16..230911ce 100644 --- a/app/cc_view/src/MsgMgrG.cpp +++ b/app/cc_view/src/MsgMgrG.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/MsgMgrG.h b/app/cc_view/src/MsgMgrG.h index ab7a5e5e..9127d51b 100644 --- a/app/cc_view/src/MsgMgrG.h +++ b/app/cc_view/src/MsgMgrG.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/PluginMgrG.cpp b/app/cc_view/src/PluginMgrG.cpp index cb96646b..1323e0a9 100644 --- a/app/cc_view/src/PluginMgrG.cpp +++ b/app/cc_view/src/PluginMgrG.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/PluginMgrG.h b/app/cc_view/src/PluginMgrG.h index f31522e0..4690830a 100644 --- a/app/cc_view/src/PluginMgrG.h +++ b/app/cc_view/src/PluginMgrG.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/ShortcutMgr.cpp b/app/cc_view/src/ShortcutMgr.cpp index 5066181f..cf1eb857 100644 --- a/app/cc_view/src/ShortcutMgr.cpp +++ b/app/cc_view/src/ShortcutMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2019 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2019 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/ShortcutMgr.h b/app/cc_view/src/ShortcutMgr.h index bdf5771f..f0068e91 100644 --- a/app/cc_view/src/ShortcutMgr.h +++ b/app/cc_view/src/ShortcutMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2019 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2019 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,12 +20,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "ActionWrap.h" diff --git a/app/cc_view/src/ShortcutWrap.h b/app/cc_view/src/ShortcutWrap.h index 14d36609..732e967c 100644 --- a/app/cc_view/src/ShortcutWrap.h +++ b/app/cc_view/src/ShortcutWrap.h @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/dir.cpp b/app/cc_view/src/dir.cpp index 0a1c656b..1a64e8f7 100644 --- a/app/cc_view/src/dir.cpp +++ b/app/cc_view/src/dir.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,11 +19,9 @@ #include -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/app/cc_view/src/dir.h b/app/cc_view/src/dir.h index b866238d..d4fb47d9 100644 --- a/app/cc_view/src/dir.h +++ b/app/cc_view/src/dir.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,12 +17,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() - namespace cc_tools_qt { diff --git a/app/cc_view/src/icon.cpp b/app/cc_view/src/icon.cpp index 88916f9e..388449d0 100644 --- a/app/cc_view/src/icon.cpp +++ b/app/cc_view/src/icon.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/icon.h b/app/cc_view/src/icon.h index f3338e5c..09f83cb5 100644 --- a/app/cc_view/src/icon.h +++ b/app/cc_view/src/icon.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/app/cc_view/src/main.cpp b/app/cc_view/src/main.cpp index 4d4933e2..1bcfe691 100644 --- a/app/cc_view/src/main.cpp +++ b/app/cc_view/src/main.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,15 +17,11 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/cc_tools_qt.h" #include "PluginMgrG.h" diff --git a/app/cc_view/src/ui/PluginConfigDialog.ui b/app/cc_view/src/ui/PluginConfigDialog.ui index 955f3dd1..1a6c4898 100644 --- a/app/cc_view/src/ui/PluginConfigDialog.ui +++ b/app/cc_view/src/ui/PluginConfigDialog.ui @@ -6,8 +6,8 @@ 0 0 - 643 - 561 + 304 + 249 @@ -48,7 +48,7 @@ - + @@ -88,47 +88,13 @@ - + - Plugin Configuration - - - - - - true - - - - - 0 - 0 - 426 - 117 - - - - - - - - - - - - - Qt::Horizontal - - - - - - - Plugin Descirption + Plugins Configuration - + true @@ -137,32 +103,11 @@ 0 0 - 426 - 76 + 131 + 83 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + diff --git a/app/cc_view/src/ui/PluginConfigWrapWidget.ui b/app/cc_view/src/ui/PluginConfigWrapWidget.ui new file mode 100644 index 00000000..f1f6aee3 --- /dev/null +++ b/app/cc_view/src/ui/PluginConfigWrapWidget.ui @@ -0,0 +1,29 @@ + + + PluginConfigWrapWidget + + + + 0 + 0 + 102 + 54 + + + + Form + + + + + + GroupBox + + + + + + + + + diff --git a/app/cc_view/src/widget/DefaultMessageDisplayWidget.cpp b/app/cc_view/src/widget/DefaultMessageDisplayWidget.cpp index ada99a26..a48fa333 100644 --- a/app/cc_view/src/widget/DefaultMessageDisplayWidget.cpp +++ b/app/cc_view/src/widget/DefaultMessageDisplayWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "MsgDetailsWidget.h" #include "ProtocolsStackWidget.h" diff --git a/app/cc_view/src/widget/DefaultMessageDisplayWidget.h b/app/cc_view/src/widget/DefaultMessageDisplayWidget.h index 8e9069e2..a2fa7ee6 100644 --- a/app/cc_view/src/widget/DefaultMessageDisplayWidget.h +++ b/app/cc_view/src/widget/DefaultMessageDisplayWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/DefaultMessageWidget.cpp b/app/cc_view/src/widget/DefaultMessageWidget.cpp index 919b0292..e1f3ba2a 100644 --- a/app/cc_view/src/widget/DefaultMessageWidget.cpp +++ b/app/cc_view/src/widget/DefaultMessageWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,13 +20,9 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { @@ -47,8 +43,7 @@ DefaultMessageWidget::DefaultMessageWidget( void DefaultMessageWidget::addExtraTransportFieldWidget(FieldWidget* field) { if (field == nullptr) { - static constexpr bool Field_object_should_be_provided = false; - static_cast(Field_object_should_be_provided); + [[maybe_unused]] static constexpr bool Field_object_should_be_provided = false; assert(Field_object_should_be_provided); return; } @@ -76,8 +71,7 @@ void DefaultMessageWidget::addExtraTransportFieldWidget(FieldWidget* field) void DefaultMessageWidget::addFieldWidget(FieldWidget* field) { if (field == nullptr) { - static constexpr bool Field_object_should_be_provided = false; - static_cast(Field_object_should_be_provided); + [[maybe_unused]] static constexpr bool Field_object_should_be_provided = false; assert(Field_object_should_be_provided); return; } diff --git a/app/cc_view/src/widget/DefaultMessageWidget.h b/app/cc_view/src/widget/DefaultMessageWidget.h index 303a6c0e..541faa99 100644 --- a/app/cc_view/src/widget/DefaultMessageWidget.h +++ b/app/cc_view/src/widget/DefaultMessageWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,12 +20,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "MessageWidget.h" diff --git a/app/cc_view/src/widget/LeftPaneWidget.cpp b/app/cc_view/src/widget/LeftPaneWidget.cpp index 7b6d2fbf..9f7bca6d 100644 --- a/app/cc_view/src/widget/LeftPaneWidget.cpp +++ b/app/cc_view/src/widget/LeftPaneWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,11 +17,7 @@ #include "LeftPaneWidget.h" -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "RecvMsgListWidget.h" #include "SendMsgListWidget.h" diff --git a/app/cc_view/src/widget/LeftPaneWidget.h b/app/cc_view/src/widget/LeftPaneWidget.h index 1a76035f..c3b3827d 100644 --- a/app/cc_view/src/widget/LeftPaneWidget.h +++ b/app/cc_view/src/widget/LeftPaneWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/app/cc_view/src/widget/MainToolbar.cpp b/app/cc_view/src/widget/MainToolbar.cpp index 4b771684..8adb3c99 100644 --- a/app/cc_view/src/widget/MainToolbar.cpp +++ b/app/cc_view/src/widget/MainToolbar.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/MainToolbar.h b/app/cc_view/src/widget/MainToolbar.h index 04ac3425..3dfff24b 100644 --- a/app/cc_view/src/widget/MainToolbar.h +++ b/app/cc_view/src/widget/MainToolbar.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,10 +18,7 @@ #pragma once -#include "comms/CompileControl.h" -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/app/cc_view/src/widget/MainWindowWidget.cpp b/app/cc_view/src/widget/MainWindowWidget.cpp index 3c804471..23a3f192 100644 --- a/app/cc_view/src/widget/MainWindowWidget.cpp +++ b/app/cc_view/src/widget/MainWindowWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,15 +19,11 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "LeftPaneWidget.h" @@ -134,7 +130,6 @@ void MainWindowWidget::newSendMsgDialog(ProtocolPtr protocol) void MainWindowWidget::sendRawMsgDialog(ProtocolPtr protocol) { - static_cast(protocol); RawHexDataDialog::MessagesList msgs; RawHexDataDialog dialog(msgs, std::move(protocol), this); dialog.exec(); @@ -188,8 +183,7 @@ void MainWindowWidget::addMainToolbarAction(ActionPtr action) auto iter = std::find(m_customActions.begin(), m_customActions.end(), action); if (iter != m_customActions.end()) { - static constexpr bool Adding_action_second_time = false; - static_cast(Adding_action_second_time); + [[maybe_unused]] static constexpr bool Adding_action_second_time = false; assert(Adding_action_second_time); return; } @@ -274,17 +268,21 @@ void MainWindowWidget::msgCommentDialog(MessagePtr msg) void MainWindowWidget::aboutInfo() { static const QString AboutTxt( - "

This is a generic " - "communication protocols analysis tool.

" + "

This application is a generic " + "communication protocols analysis and visualization tool. " + "It is developed as a member project of the " + "CommsChampion Ecosystem." + "

" + "

" "The icons for this application were taken from: " - "FatCow"); + "FatCow" + "

"); QMessageBox::information(this, tr("About"), AboutTxt); } void MainWindowWidget::recvFilterDialog(ProtocolPtr protocol) { - static_cast(protocol); auto* guiAppMgr = GuiAppMgr::instance(); GuiAppMgr::FilteredMessages hiddenMessages = guiAppMgr->getFilteredMessages(); MessagesFilterDialog dialog(hiddenMessages, std::move(protocol), this); @@ -321,8 +319,7 @@ std::tuple MainWindowWidget::loadMsgsDialog(bool askForClear) assert(cancelButton != nullptr); auto* clearButton = msgBox.addButton(tr("Clear"), QMessageBox::ActionRole); assert(clearButton != nullptr); - auto* appendButton = msgBox.addButton(tr("Append"), QMessageBox::ActionRole); - static_cast(appendButton); + [[maybe_unused]] auto* appendButton = msgBox.addButton(tr("Append"), QMessageBox::ActionRole); assert(appendButton != nullptr); msgBox.setDefaultButton(clearButton); msgBox.setEscapeButton(cancelButton); diff --git a/app/cc_view/src/widget/MainWindowWidget.h b/app/cc_view/src/widget/MainWindowWidget.h index 4011f869..e76a1bfb 100644 --- a/app/cc_view/src/widget/MainWindowWidget.h +++ b/app/cc_view/src/widget/MainWindowWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,14 +21,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include "ui_MainWindowWidget.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Protocol.h" diff --git a/app/cc_view/src/widget/MessageDisplayWidget.h b/app/cc_view/src/widget/MessageDisplayWidget.h index 6721dcf5..60d1c70a 100644 --- a/app/cc_view/src/widget/MessageDisplayWidget.h +++ b/app/cc_view/src/widget/MessageDisplayWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" diff --git a/app/cc_view/src/widget/MessageUpdateDialog.cpp b/app/cc_view/src/widget/MessageUpdateDialog.cpp index 372d877b..4174a0ff 100644 --- a/app/cc_view/src/widget/MessageUpdateDialog.cpp +++ b/app/cc_view/src/widget/MessageUpdateDialog.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -25,15 +25,11 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "DefaultMessageDisplayWidget.h" @@ -149,8 +145,7 @@ long long unsigned durationToMs(int value, Duration dur) { if (Duration::NumOfDurations <= dur) { - static constexpr bool Incorrect_duration = false; - static_cast(Incorrect_duration); + [[maybe_unused]] static constexpr bool Incorrect_duration = false; assert(Incorrect_duration); return static_cast(value); } @@ -163,8 +158,7 @@ int msToDurationUnits(long long unsigned value, Duration dur) { if (Duration::NumOfDurations <= dur) { - static constexpr bool Incorrect_duration = false; - static_cast(Incorrect_duration); + [[maybe_unused]] static constexpr bool Incorrect_duration = false; assert(Incorrect_duration); return static_cast(value); } diff --git a/app/cc_view/src/widget/MessageUpdateDialog.h b/app/cc_view/src/widget/MessageUpdateDialog.h index a08fbdb4..4c5a4bb1 100644 --- a/app/cc_view/src/widget/MessageUpdateDialog.h +++ b/app/cc_view/src/widget/MessageUpdateDialog.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,13 +18,9 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_MessageUpdateDialog.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Protocol.h" #include "MessageDisplayWidget.h" diff --git a/app/cc_view/src/widget/MessageWidget.cpp b/app/cc_view/src/widget/MessageWidget.cpp index 9a9fa4ee..1fd160de 100644 --- a/app/cc_view/src/widget/MessageWidget.cpp +++ b/app/cc_view/src/widget/MessageWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/MessageWidget.h b/app/cc_view/src/widget/MessageWidget.h index 782f8e5e..3d77c6e2 100644 --- a/app/cc_view/src/widget/MessageWidget.h +++ b/app/cc_view/src/widget/MessageWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/app/cc_view/src/widget/MessagesFilterDialog.cpp b/app/cc_view/src/widget/MessagesFilterDialog.cpp index 37aad4f3..c73feeaa 100644 --- a/app/cc_view/src/widget/MessagesFilterDialog.cpp +++ b/app/cc_view/src/widget/MessagesFilterDialog.cpp @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/MessagesFilterDialog.h b/app/cc_view/src/widget/MessagesFilterDialog.h index f3892f8d..2d35646a 100644 --- a/app/cc_view/src/widget/MessagesFilterDialog.h +++ b/app/cc_view/src/widget/MessagesFilterDialog.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,8 +18,6 @@ #pragma once -#include "comms/CompileControl.h" - #include #include "ui_MessagesFilterDialog.h" diff --git a/app/cc_view/src/widget/MsgCommentDialog.cpp b/app/cc_view/src/widget/MsgCommentDialog.cpp index 7f0943f6..9ce8551d 100644 --- a/app/cc_view/src/widget/MsgCommentDialog.cpp +++ b/app/cc_view/src/widget/MsgCommentDialog.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/MsgCommentDialog.h b/app/cc_view/src/widget/MsgCommentDialog.h index adb57bdb..38c71b55 100644 --- a/app/cc_view/src/widget/MsgCommentDialog.h +++ b/app/cc_view/src/widget/MsgCommentDialog.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,13 +18,9 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_MsgCommentDialog.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" diff --git a/app/cc_view/src/widget/MsgDetailsWidget.cpp b/app/cc_view/src/widget/MsgDetailsWidget.cpp index b1655184..bc9c45fa 100644 --- a/app/cc_view/src/widget/MsgDetailsWidget.cpp +++ b/app/cc_view/src/widget/MsgDetailsWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,10 +19,8 @@ #include -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "GuiAppMgr.h" diff --git a/app/cc_view/src/widget/MsgDetailsWidget.h b/app/cc_view/src/widget/MsgDetailsWidget.h index 6277750e..c068629e 100644 --- a/app/cc_view/src/widget/MsgDetailsWidget.h +++ b/app/cc_view/src/widget/MsgDetailsWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,13 +19,9 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_MsgDetailsWidget.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "DefaultMessageDisplayHandler.h" diff --git a/app/cc_view/src/widget/MsgListWidget.cpp b/app/cc_view/src/widget/MsgListWidget.cpp index 7e612a19..172722d2 100644 --- a/app/cc_view/src/widget/MsgListWidget.cpp +++ b/app/cc_view/src/widget/MsgListWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "cc_tools_qt/property/message.h" @@ -108,8 +104,7 @@ void MsgListWidget::updateCurrentMessage(MessagePtr msg) { auto* item = m_ui.m_listWidget->currentItem(); if (item == nullptr) { - static constexpr bool No_item_is_selected_for_update = false; - static_cast(No_item_is_selected_for_update); + [[maybe_unused]] static constexpr bool No_item_is_selected_for_update = false; assert(No_item_is_selected_for_update); return; } @@ -140,8 +135,7 @@ void MsgListWidget::deleteCurrentMessage() { auto* item = m_ui.m_listWidget->currentItem(); if (item == nullptr) { - static constexpr bool No_item_is_selected_for_deletion = false; - static_cast(No_item_is_selected_for_deletion); + [[maybe_unused]] static constexpr bool No_item_is_selected_for_deletion = false; assert(No_item_is_selected_for_deletion); return; } @@ -204,8 +198,7 @@ void MsgListWidget::moveSelectedTop() { auto curRow = m_ui.m_listWidget->currentRow(); if (curRow <= 0) { - static constexpr bool No_item_is_selected_or_moving_up_top_item = false; - static_cast(No_item_is_selected_or_moving_up_top_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_up_top_item = false; assert(No_item_is_selected_or_moving_up_top_item); return; } @@ -217,8 +210,7 @@ void MsgListWidget::moveSelectedUp() { auto curRow = m_ui.m_listWidget->currentRow(); if (curRow <= 0) { - static constexpr bool No_item_is_selected_or_moving_up_top_item = false; - static_cast(No_item_is_selected_or_moving_up_top_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_up_top_item = false; assert(No_item_is_selected_or_moving_up_top_item); return; } @@ -230,8 +222,7 @@ void MsgListWidget::moveSelectedDown() { auto curRow = m_ui.m_listWidget->currentRow(); if ((m_ui.m_listWidget->count() - 1) <= curRow) { - static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; - static_cast(No_item_is_selected_or_moving_down_bottom_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; assert(No_item_is_selected_or_moving_down_bottom_item); return; } @@ -243,8 +234,7 @@ void MsgListWidget::moveSelectedBottom() { auto curRow = m_ui.m_listWidget->currentRow(); if ((m_ui.m_listWidget->count() - 1) <= curRow) { - static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; - static_cast(No_item_is_selected_or_moving_down_bottom_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; assert(No_item_is_selected_or_moving_down_bottom_item); return; } @@ -283,26 +273,20 @@ void MsgListWidget::selectMsg(int idx) m_ui.m_listWidget->blockSignals(false); } -void MsgListWidget::msgClickedImpl(MessagePtr msg, int idx) +void MsgListWidget::msgClickedImpl([[maybe_unused]] MessagePtr msg, [[maybe_unused]] int idx) { - static_cast(msg); - static_cast(idx); } -void MsgListWidget::msgDoubleClickedImpl(MessagePtr msg, int idx) +void MsgListWidget::msgDoubleClickedImpl([[maybe_unused]] MessagePtr msg, [[maybe_unused]] int idx) { - static_cast(msg); - static_cast(idx); } -void MsgListWidget::msgListClearedImpl(MessagesList&& msgs) +void MsgListWidget::msgListClearedImpl([[maybe_unused]] MessagesList&& msgs) { - static_cast(msgs); } -QString MsgListWidget::msgPrefixImpl(const Message& msg) const +QString MsgListWidget::msgPrefixImpl([[maybe_unused]] const Message& msg) const { - static_cast(msg); return QString(); } @@ -311,39 +295,32 @@ const QString& MsgListWidget::msgTooltipImpl() const return EmptyStr; } -void MsgListWidget::stateChangedImpl(int state) +void MsgListWidget::stateChangedImpl([[maybe_unused]] int state) { - static_cast(state); } -Qt::GlobalColor MsgListWidget::getItemColourImpl(MsgType type, bool valid) const +Qt::GlobalColor MsgListWidget::getItemColourImpl([[maybe_unused]] MsgType type, bool valid) const { - static_cast(type); return defaultItemColour(valid); } -void MsgListWidget::msgMovedImpl(int idx) +void MsgListWidget::msgMovedImpl([[maybe_unused]] int idx) { - static_cast(idx); } QString MsgListWidget::getTitleImpl() const { - static constexpr bool Should_not_be_called = false; - static_cast(Should_not_be_called); + [[maybe_unused]] static constexpr bool Should_not_be_called = false; assert(Should_not_be_called); return QString(); } -void MsgListWidget::loadMessagesImpl(const QString& filename, Protocol& protocol) +void MsgListWidget::loadMessagesImpl([[maybe_unused]] const QString& filename, [[maybe_unused]] Protocol& protocol) { - static_cast(filename); - static_cast(protocol); } -void MsgListWidget::saveMessagesImpl(const QString& filename) +void MsgListWidget::saveMessagesImpl([[maybe_unused]] const QString& filename) { - static_cast(filename); } MessagePtr MsgListWidget::currentMsg() const @@ -380,10 +357,8 @@ void MsgListWidget::itemClicked(QListWidgetItem* item) processClick(item); } -void MsgListWidget::currentItemChanged(QListWidgetItem* current, QListWidgetItem* prev) +void MsgListWidget::currentItemChanged(QListWidgetItem* current, [[maybe_unused]] QListWidgetItem* prev) { - static_cast(prev); - m_selectedItem = current; if (current != nullptr) { m_lastSelectionTimestamp = QDateTime::currentMSecsSinceEpoch(); diff --git a/app/cc_view/src/widget/MsgListWidget.h b/app/cc_view/src/widget/MsgListWidget.h index 0b42f95d..a9ab8875 100644 --- a/app/cc_view/src/widget/MsgListWidget.h +++ b/app/cc_view/src/widget/MsgListWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,15 +18,11 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include "ui_MsgListWidget.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" #include "cc_tools_qt/Protocol.h" diff --git a/app/cc_view/src/widget/PluginConfigDialog.cpp b/app/cc_view/src/widget/PluginConfigDialog.cpp index deb727a4..f8aa1a90 100644 --- a/app/cc_view/src/widget/PluginConfigDialog.cpp +++ b/app/cc_view/src/widget/PluginConfigDialog.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,16 +20,12 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "comms/util/ScopeGuard.h" #include "PluginMgrG.h" @@ -101,6 +97,10 @@ PluginConfigDialog::PluginConfigDialog( m_applyButton = m_ui.m_buttonBox->button(QDialogButtonBox::Ok); m_applyButton->setText(tr("Apply")); + + m_allConfigWidget = new PluginConfigWrapsListWidget(this); + m_ui.m_allConfigScrollArea->setWidget(m_allConfigWidget); + refreshAll(); } @@ -193,7 +193,7 @@ void PluginConfigDialog::addClicked() auto* selectedListWidget = getSelectedListForAvailable(m_currentAvailableList); assert(selectedListWidget != nullptr); - selectedListWidget->addItem(pluginInfoPtr->getName()); + selectedListWidget->addItem(pluginInfoPtr->getName(), pluginInfoPtr->getDescription()); auto* selectedItem = selectedListWidget->item(selectedListWidget->count() - 1); selectedItem->setData( @@ -204,11 +204,12 @@ void PluginConfigDialog::addClicked() refreshAvailablePlugins(); refreshSelectedToolbar(); refreshButtonBox(); + + m_allConfigWidget->addPluginConfig(pluginInfoPtr); } -void PluginConfigDialog::searchTextChanged(const QString& text) +void PluginConfigDialog::searchTextChanged([[maybe_unused]] const QString& text) { - static_cast(text); refreshAvailable(); } @@ -251,12 +252,6 @@ void PluginConfigDialog::loadClicked() assert(m_selectedSocketsWidget->currentItem() == nullptr); assert(m_selectedFiltersWidget->currentItem() == nullptr); assert(m_selectedProtocolsWidget->currentItem() == nullptr); - - if ((m_currentAvailableList == nullptr) || - (m_currentAvailableList->currentItem() == nullptr)) { - clearConfiguration(); - clearDescription(); - } } void PluginConfigDialog::saveClicked() @@ -289,6 +284,11 @@ void PluginConfigDialog::removeClicked() assert(m_currentSelectedList != nullptr); auto* item = m_currentSelectedList->currentItem(); assert(item != nullptr); + + auto pluginInfoPtr = getPluginInfo(item); + assert(pluginInfoPtr); + m_allConfigWidget->removePluginConfig(pluginInfoPtr); + delete item; refreshAvailablePlugins(); refreshSelectedToolbar(); @@ -296,8 +296,6 @@ void PluginConfigDialog::removeClicked() item = m_currentSelectedList->currentItem(); if (item == nullptr) { - clearConfiguration(); - clearDescription(); m_currentSelectedList = nullptr; return; } @@ -307,21 +305,14 @@ void PluginConfigDialog::removeClicked() void PluginConfigDialog::clearClicked() { - bool displayingSelected = - (m_currentSelectedList != nullptr) && - (m_currentSelectedList->currentItem() != nullptr); m_selectedSocketsWidget->clear(); m_selectedFiltersWidget->clear(); m_selectedProtocolsWidget->clear(); + m_allConfigWidget->removeAll(); m_currentSelectedList = nullptr; refreshAvailablePlugins(); refreshSelectedToolbar(); refreshButtonBox(); - - if (displayingSelected) { - clearConfiguration(); - clearDescription(); - } } void PluginConfigDialog::topClicked() @@ -329,8 +320,7 @@ void PluginConfigDialog::topClicked() assert(m_currentSelectedList != nullptr); auto curRow = m_currentSelectedList->currentRow(); if (curRow <= 0) { - static constexpr bool No_item_is_selected_or_moving_up_top_item = false; - static_cast(No_item_is_selected_or_moving_up_top_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_up_top_item = false; assert(No_item_is_selected_or_moving_up_top_item); return; } @@ -343,8 +333,7 @@ void PluginConfigDialog::upClicked() assert(m_currentSelectedList != nullptr); auto curRow = m_currentSelectedList->currentRow(); if (curRow <= 0) { - static constexpr bool No_item_is_selected_or_moving_up_top_item = false; - static_cast(No_item_is_selected_or_moving_up_top_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_up_top_item = false; assert(No_item_is_selected_or_moving_up_top_item); return; } @@ -357,8 +346,7 @@ void PluginConfigDialog::downClicked() assert(m_currentSelectedList != nullptr); auto curRow = m_currentSelectedList->currentRow(); if ((m_currentSelectedList->count() - 1) <= curRow) { - static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; - static_cast(No_item_is_selected_or_moving_down_bottom_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; assert(No_item_is_selected_or_moving_down_bottom_item); return; } @@ -371,8 +359,7 @@ void PluginConfigDialog::bottomClicked() assert(m_currentSelectedList != nullptr); auto curRow = m_currentSelectedList->currentRow(); if ((m_currentSelectedList->count() - 1) <= curRow) { - static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; - static_cast(No_item_is_selected_or_moving_down_bottom_item); + [[maybe_unused]] static constexpr bool No_item_is_selected_or_moving_down_bottom_item = false; assert(No_item_is_selected_or_moving_down_bottom_item); return; } @@ -401,12 +388,6 @@ void PluginConfigDialog::availPluginClicked( m_currentAvailableList->setCurrentItem(item); assert(m_currentAvailableList->currentRow() == m_currentAvailableList->getRow(item)); - clearConfiguration(); - - auto pluginInfoPtr = getPluginInfo(item); - assert(pluginInfoPtr); - - m_ui.m_descLabel->setText(pluginInfoPtr->getDescription()); refreshAvailableToolbar(); } @@ -434,29 +415,6 @@ void PluginConfigDialog::selectedPluginClicked( selectedList->setCurrentItem(item); assert(selectedList->currentRow() == selectedList->getRow(item)); - do { - auto clearGuard = - comms::util::makeScopeGuard( - [this]() - { - clearConfiguration(); - }); - - auto* plugin = PluginMgrG::instanceRef().loadPlugin(*pluginInfoPtr); - if (plugin == nullptr) { - break; - } - - auto* configWidget = plugin->createConfiguarionWidget(); - if (configWidget == nullptr) { - break; - } - - clearGuard.release(); - m_ui.m_configScrollArea->setWidget(configWidget); - } while (false); - - m_ui.m_descLabel->setText(pluginInfoPtr->getDescription()); refreshSelectedToolbar(); } @@ -685,10 +643,14 @@ void PluginConfigDialog::refreshAvailablePlugins() continue; } - availableList->addItem(name); + availableList->addItem(name, pluginInfoPtr->getDescription()); auto* item = availableList->item(availableList->count() - 1); - static const QString Tooltip("Use double click to select"); - item->setToolTip(Tooltip); + auto tooltip = item->toolTip(); + if (!tooltip.isEmpty()) { + tooltip.append("\n\n"); + } + tooltip.append("Use double click to select"); + item->setToolTip(tooltip); item->setData( Qt::UserRole, @@ -752,7 +714,8 @@ void PluginConfigDialog::refreshSelectedPlugins( } auto& name = pluginInfoPtr->getName(); - list->addItem(name); + auto& desc = pluginInfoPtr->getDescription(); + list->addItem(name, desc); auto* item = list->item(list->count() - 1); item->setData( @@ -763,9 +726,14 @@ void PluginConfigDialog::refreshSelectedPlugins( }; m_currentSelectedList = nullptr; + assert(m_allConfigWidget != nullptr); + m_allConfigWidget->removeAll(); refreshListFunc(m_selectedSocketsWidget, PluginType::Socket); refreshListFunc(m_selectedFiltersWidget, PluginType::Filter); refreshListFunc(m_selectedProtocolsWidget, PluginType::Protocol); + for (auto& pluginInfoPtr : infos) { + m_allConfigWidget->addPluginConfig(pluginInfoPtr); + } } void PluginConfigDialog::refreshButtonBox() @@ -851,16 +819,6 @@ void PluginConfigDialog::refreshBottomButton() button->setEnabled(enabled); } -void PluginConfigDialog::clearConfiguration() -{ - m_ui.m_configScrollArea->setWidget(new QWidget()); -} - -void PluginConfigDialog::clearDescription() -{ - m_ui.m_descLabel->setText(QString()); -} - void PluginConfigDialog::moveSelectedPlugin(int fromRow, int toRow) { assert(m_currentSelectedList != nullptr); diff --git a/app/cc_view/src/widget/PluginConfigDialog.h b/app/cc_view/src/widget/PluginConfigDialog.h index f1b1ec84..9821901d 100644 --- a/app/cc_view/src/widget/PluginConfigDialog.h +++ b/app/cc_view/src/widget/PluginConfigDialog.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,19 +17,16 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include "ui_PluginConfigDialog.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/PluginMgr.h" #include "PluginsListWidget.h" #include "ActionWrap.h" +#include "PluginConfigWrapsListWidget.h" namespace cc_tools_qt { @@ -101,8 +98,6 @@ private slots: void refreshUpBotton(); void refreshDownBotton(); void refreshBottomButton(); - void clearConfiguration(); - void clearDescription(); void moveSelectedPlugin(int fromRow, int toRow); PluginInfoPtr getPluginInfo(QListWidgetItem* item) const; @@ -132,6 +127,8 @@ private slots: PluginsListWidget* m_selectedFiltersWidget = nullptr; PluginsListWidget* m_selectedProtocolsWidget = nullptr; PluginsListWidget* m_currentSelectedList = nullptr; + + PluginConfigWrapsListWidget* m_allConfigWidget; }; } // namespace cc_tools_qt diff --git a/app/cc_view/src/widget/PluginConfigWrapWidget.cpp b/app/cc_view/src/widget/PluginConfigWrapWidget.cpp new file mode 100644 index 00000000..86f9456b --- /dev/null +++ b/app/cc_view/src/widget/PluginConfigWrapWidget.cpp @@ -0,0 +1,39 @@ +// +// Copyright 2024 - 2025 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "PluginConfigWrapWidget.h" + +#include + +namespace cc_tools_qt +{ + +PluginConfigWrapWidget::PluginConfigWrapWidget(PluginInfoPtr pluginInfo, QWidget* configWidget, QWidget* parentObj) : + Base(parentObj) +{ + assert(configWidget != nullptr); + m_ui.setupUi(this); + auto* layout = qobject_cast(m_ui.m_wrapGroupBox->layout()); + layout->addWidget(configWidget); + + m_ui.m_wrapGroupBox->setTitle(pluginInfo->getName()); + m_pluginInfo = pluginInfo; +} + +PluginConfigWrapWidget::~PluginConfigWrapWidget() = default; + +} // namespace cc_tools_qt \ No newline at end of file diff --git a/app/cc_view/src/widget/PluginConfigWrapWidget.h b/app/cc_view/src/widget/PluginConfigWrapWidget.h new file mode 100644 index 00000000..41adbdec --- /dev/null +++ b/app/cc_view/src/widget/PluginConfigWrapWidget.h @@ -0,0 +1,54 @@ +// +// Copyright 2024 - 2025 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +#include + +#include "cc_tools_qt/PluginMgr.h" + +#include "ui_PluginConfigWrapWidget.h" + +namespace cc_tools_qt +{ + +class PluginConfigWrapWidget: public QWidget +{ + using Base = QWidget; + +public: + using Type = PluginMgr::PluginInfo::Type; + using PluginInfoPtr = PluginMgr::PluginInfoPtr; + PluginConfigWrapWidget(PluginInfoPtr pluginInfo, QWidget* configWidget, QWidget* parentObj = nullptr); + ~PluginConfigWrapWidget(); + + const QString& getIid() const + { + return m_pluginInfo->getIid(); + } + + Type getType() const + { + return m_pluginInfo->getType(); + } + +private: + Ui::PluginConfigWrapWidget m_ui; + PluginInfoPtr m_pluginInfo; +}; + +} // namespace cc_tools_qt diff --git a/app/cc_view/src/widget/PluginConfigWrapsListWidget.cpp b/app/cc_view/src/widget/PluginConfigWrapsListWidget.cpp new file mode 100644 index 00000000..77de0ee2 --- /dev/null +++ b/app/cc_view/src/widget/PluginConfigWrapsListWidget.cpp @@ -0,0 +1,91 @@ +// +// Copyright 2024 - 2025 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "PluginConfigWrapsListWidget.h" + +#include +#include +#include + +#include "PluginMgrG.h" + +namespace cc_tools_qt +{ + +PluginConfigWrapsListWidget::PluginConfigWrapsListWidget(QWidget* parentObj) : + Base(parentObj) +{ + auto* layout = new QVBoxLayout; + layout->addStretch(1); + setLayout(layout); +} + +PluginConfigWrapsListWidget::~PluginConfigWrapsListWidget() = default; + +void PluginConfigWrapsListWidget::addPluginConfig(PluginInfoPtr pluginInfo) +{ + auto* plugin = PluginMgrG::instanceRef().loadPlugin(*pluginInfo); + if (plugin == nullptr) { + return; + } + + auto* configWidget = plugin->createConfiguarionWidget(); + if (configWidget == nullptr) { + return; + } + + auto type = pluginInfo->getType(); + auto iter = std::upper_bound( + m_widgets.begin(), m_widgets.end(), type, + [](auto t, auto& w) + { + return t < w->getType(); + }); + + auto idx = static_cast(std::distance(m_widgets.begin(), iter)); + + auto* l = qobject_cast(layout()); + + auto wrap = std::make_unique(pluginInfo, configWidget, this); + l->insertWidget(idx, wrap.get()); + m_widgets.insert(iter, std::move(wrap)); +} + +void PluginConfigWrapsListWidget::removePluginConfig(PluginInfoPtr pluginInfo) +{ + auto iid = pluginInfo->getIid(); + auto iter = + std::find_if( + m_widgets.begin(), m_widgets.end(), + [&iid](auto& w) + { + return w->getIid() == iid; + }); + + if (iter == m_widgets.end()) { + return; + } + + m_widgets.erase(iter); // Will remove widget as well +} + +void PluginConfigWrapsListWidget::removeAll() +{ + m_widgets.clear(); +} + +} // namespace cc_tools_qt \ No newline at end of file diff --git a/app/cc_view/src/widget/PluginConfigWrapsListWidget.h b/app/cc_view/src/widget/PluginConfigWrapsListWidget.h new file mode 100644 index 00000000..a65963f5 --- /dev/null +++ b/app/cc_view/src/widget/PluginConfigWrapsListWidget.h @@ -0,0 +1,51 @@ +// +// Copyright 2024 - 2025 (C). Alex Robenko. All rights reserved. +// + +// This file is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +#include +#include + +#include + +#include "cc_tools_qt/PluginMgr.h" + +#include "PluginConfigWrapWidget.h" + +namespace cc_tools_qt +{ + +class PluginConfigWrapsListWidget: public QWidget +{ + using Base = QWidget; + +public: + using PluginInfoPtr = PluginMgr::PluginInfoPtr; + explicit PluginConfigWrapsListWidget(QWidget* parentObj = nullptr); + ~PluginConfigWrapsListWidget(); + + void addPluginConfig(PluginInfoPtr pluginInfo); + void removePluginConfig(PluginInfoPtr pluginInfo); + void removeAll(); + +private: + using PluginConfigWrapWidgetPtr = std::unique_ptr; + using WrapWidgetsList = std::vector; + WrapWidgetsList m_widgets; +}; + +} // namespace cc_tools_qt diff --git a/app/cc_view/src/widget/PluginsListWidget.cpp b/app/cc_view/src/widget/PluginsListWidget.cpp index 0d245346..27746bd1 100644 --- a/app/cc_view/src/widget/PluginsListWidget.cpp +++ b/app/cc_view/src/widget/PluginsListWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -61,9 +61,11 @@ QListWidgetItem* PluginsListWidget::takeItem(int idx) return m_ui.m_listWidget->takeItem(idx); } -void PluginsListWidget::addItem(const QString& name) +void PluginsListWidget::addItem(const QString& name, const QString& desc) { - m_ui.m_listWidget->addItem(name); + auto item = new QListWidgetItem(name); + item->setToolTip(desc); + m_ui.m_listWidget->addItem(item); } void PluginsListWidget::setCurrentRow(int rowIdx) diff --git a/app/cc_view/src/widget/PluginsListWidget.h b/app/cc_view/src/widget/PluginsListWidget.h index 52cb5c48..1b16128f 100644 --- a/app/cc_view/src/widget/PluginsListWidget.h +++ b/app/cc_view/src/widget/PluginsListWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include "ui_PluginsListWidget.h" -CC_ENABLE_WARNINGS() namespace cc_tools_qt { @@ -46,7 +42,7 @@ class PluginsListWidget : public QWidget int count() const; QListWidgetItem* item(int idx); QListWidgetItem* takeItem(int idx); - void addItem(const QString& name); + void addItem(const QString& name, const QString& desc); void setCurrentRow(int rowIdx); void setCurrentItem(QListWidgetItem* itemPtr); int currentRow() const; diff --git a/app/cc_view/src/widget/ProtocolsStackWidget.cpp b/app/cc_view/src/widget/ProtocolsStackWidget.cpp index 591fd601..c4b6af8e 100644 --- a/app/cc_view/src/widget/ProtocolsStackWidget.cpp +++ b/app/cc_view/src/widget/ProtocolsStackWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -71,8 +71,7 @@ void ProtocolsStackWidget::displayMessage(MessagePtr msg, bool force) auto* secondChild = topProtocolItem->child(1); if (secondChild == nullptr) { - static constexpr bool Should_not_happen = false; - static_cast(Should_not_happen); + [[maybe_unused]] static constexpr bool Should_not_happen = false; assert(Should_not_happen); break; } @@ -83,8 +82,7 @@ void ProtocolsStackWidget::displayMessage(MessagePtr msg, bool force) auto* thirdChild = topProtocolItem->child(2); if (thirdChild == nullptr) { - static constexpr bool Should_not_happen = false; - static_cast(Should_not_happen); + [[maybe_unused]] static constexpr bool Should_not_happen = false; assert(Should_not_happen); break; } diff --git a/app/cc_view/src/widget/ProtocolsStackWidget.h b/app/cc_view/src/widget/ProtocolsStackWidget.h index 831e5f0a..a19d8eb8 100644 --- a/app/cc_view/src/widget/ProtocolsStackWidget.h +++ b/app/cc_view/src/widget/ProtocolsStackWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,13 +18,9 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_ProtocolsStackWidget.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Message.h" diff --git a/app/cc_view/src/widget/RawHexDataDialog.cpp b/app/cc_view/src/widget/RawHexDataDialog.cpp index 81b694d7..93717362 100644 --- a/app/cc_view/src/widget/RawHexDataDialog.cpp +++ b/app/cc_view/src/widget/RawHexDataDialog.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -24,9 +24,7 @@ #include #include -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" @@ -114,7 +112,6 @@ void RawHexDataDialog::accept() { bool ok = false; auto byte = static_cast(numStr.toUInt(&ok, 16)); - static_cast(ok); assert(ok); dataInfo.m_data.push_back(byte); numStr.clear(); @@ -144,8 +141,7 @@ void RawHexDataDialog::accept() if (!m_ui.m_convertCheckBox->isChecked()) { auto msg = m_protocol->createInvalidMessage(dataInfo.m_data); if (!msg) { - static constexpr bool Invalid_message_was_not_created_by_the_protocol = false; - static_cast(Invalid_message_was_not_created_by_the_protocol); + [[maybe_unused]] static constexpr bool Invalid_message_was_not_created_by_the_protocol = false; assert(Invalid_message_was_not_created_by_the_protocol); Base::accept(); return; diff --git a/app/cc_view/src/widget/RawHexDataDialog.h b/app/cc_view/src/widget/RawHexDataDialog.h index 40ae750d..09f64d67 100644 --- a/app/cc_view/src/widget/RawHexDataDialog.h +++ b/app/cc_view/src/widget/RawHexDataDialog.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,13 +18,9 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_RawHexDataDialog.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Protocol.h" diff --git a/app/cc_view/src/widget/RecvAreaToolBar.cpp b/app/cc_view/src/widget/RecvAreaToolBar.cpp index 796c1fd1..af4aa0b3 100644 --- a/app/cc_view/src/widget/RecvAreaToolBar.cpp +++ b/app/cc_view/src/widget/RecvAreaToolBar.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "icon.h" #include "ShortcutMgr.h" diff --git a/app/cc_view/src/widget/RecvAreaToolBar.h b/app/cc_view/src/widget/RecvAreaToolBar.h index fa550f9f..6fff90dd 100644 --- a/app/cc_view/src/widget/RecvAreaToolBar.h +++ b/app/cc_view/src/widget/RecvAreaToolBar.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "GuiAppMgr.h" diff --git a/app/cc_view/src/widget/RecvMsgListWidget.cpp b/app/cc_view/src/widget/RecvMsgListWidget.cpp index c90f95b6..364f5ab6 100644 --- a/app/cc_view/src/widget/RecvMsgListWidget.cpp +++ b/app/cc_view/src/widget/RecvMsgListWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,11 +20,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "RecvAreaToolBar.h" diff --git a/app/cc_view/src/widget/RecvMsgListWidget.h b/app/cc_view/src/widget/RecvMsgListWidget.h index f58b9a34..9e0ea2d9 100644 --- a/app/cc_view/src/widget/RecvMsgListWidget.h +++ b/app/cc_view/src/widget/RecvMsgListWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/RightPaneWidget.cpp b/app/cc_view/src/widget/RightPaneWidget.cpp index 64893af8..28d76bb7 100644 --- a/app/cc_view/src/widget/RightPaneWidget.cpp +++ b/app/cc_view/src/widget/RightPaneWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,11 +17,7 @@ #include "RightPaneWidget.h" -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "DefaultMessageDisplayWidget.h" #include "GuiAppMgr.h" diff --git a/app/cc_view/src/widget/RightPaneWidget.h b/app/cc_view/src/widget/RightPaneWidget.h index b1edc72e..7a37f7ae 100644 --- a/app/cc_view/src/widget/RightPaneWidget.h +++ b/app/cc_view/src/widget/RightPaneWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "MessageDisplayWidget.h" diff --git a/app/cc_view/src/widget/SendAreaToolBar.cpp b/app/cc_view/src/widget/SendAreaToolBar.cpp index 13844c82..737ee407 100644 --- a/app/cc_view/src/widget/SendAreaToolBar.cpp +++ b/app/cc_view/src/widget/SendAreaToolBar.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "icon.h" #include "ShortcutMgr.h" diff --git a/app/cc_view/src/widget/SendAreaToolBar.h b/app/cc_view/src/widget/SendAreaToolBar.h index dd988ecf..b07cc481 100644 --- a/app/cc_view/src/widget/SendAreaToolBar.h +++ b/app/cc_view/src/widget/SendAreaToolBar.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "GuiAppMgr.h" #include "ActionWrap.h" diff --git a/app/cc_view/src/widget/SendMsgListWidget.cpp b/app/cc_view/src/widget/SendMsgListWidget.cpp index 6ec99ca8..bebbe43c 100644 --- a/app/cc_view/src/widget/SendMsgListWidget.cpp +++ b/app/cc_view/src/widget/SendMsgListWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,11 +19,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" #include "SendAreaToolBar.h" diff --git a/app/cc_view/src/widget/SendMsgListWidget.h b/app/cc_view/src/widget/SendMsgListWidget.h index 3be69a53..d131e5ff 100644 --- a/app/cc_view/src/widget/SendMsgListWidget.h +++ b/app/cc_view/src/widget/SendMsgListWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/ArrayListFieldWidget.cpp b/app/cc_view/src/widget/field/ArrayListFieldWidget.cpp index 771fe21e..ce8602c5 100644 --- a/app/cc_view/src/widget/field/ArrayListFieldWidget.cpp +++ b/app/cc_view/src/widget/field/ArrayListFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -206,8 +206,7 @@ void ArrayListFieldWidget::removeField() auto* sigSender = sender(); auto iter = std::find(m_elements.begin(), m_elements.end(), sigSender); if (iter == m_elements.end()) { - static constexpr bool Something_is_not_right = false; - static_cast(Something_is_not_right); + [[maybe_unused]] static constexpr bool Something_is_not_right = false; assert(Something_is_not_right); return; } @@ -277,8 +276,7 @@ void ArrayListFieldWidget::updateUi() void ArrayListFieldWidget::addMissingFields() { if (!m_createMissingDataFieldsCallback) { - static constexpr bool Callback_should_exist = false; - static_cast(Callback_should_exist); + [[maybe_unused]] static constexpr bool Callback_should_exist = false; assert(Callback_should_exist); return; } diff --git a/app/cc_view/src/widget/field/ArrayListFieldWidget.h b/app/cc_view/src/widget/field/ArrayListFieldWidget.h index efebf581..b9685494 100644 --- a/app/cc_view/src/widget/field/ArrayListFieldWidget.h +++ b/app/cc_view/src/widget/field/ArrayListFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,14 +21,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include "ui_ArrayListElementWidget.h" #include "ui_ArrayListFieldWidget.h" -CC_ENABLE_WARNINGS() #include "cc_tools_qt/field_wrapper/ArrayListWrapper.h" #include "FieldWidget.h" diff --git a/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.cpp b/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.cpp index 3a0fa627..46ab1f5c 100644 --- a/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.cpp +++ b/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.h b/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.h index a6100558..8edd5ffd 100644 --- a/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.h +++ b/app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/BitfieldFieldWidget.cpp b/app/cc_view/src/widget/field/BitfieldFieldWidget.cpp index ada35447..de5988ef 100644 --- a/app/cc_view/src/widget/field/BitfieldFieldWidget.cpp +++ b/app/cc_view/src/widget/field/BitfieldFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,12 +21,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" diff --git a/app/cc_view/src/widget/field/BitfieldFieldWidget.h b/app/cc_view/src/widget/field/BitfieldFieldWidget.h index 3dded22c..f3f77bd5 100644 --- a/app/cc_view/src/widget/field/BitfieldFieldWidget.h +++ b/app/cc_view/src/widget/field/BitfieldFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/BitmaskValueFieldWidget.cpp b/app/cc_view/src/widget/field/BitmaskValueFieldWidget.cpp index 22da4d37..4ac79bc8 100644 --- a/app/cc_view/src/widget/field/BitmaskValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/BitmaskValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" @@ -135,8 +131,7 @@ void BitmaskValueFieldWidget::checkBoxUpdated(int value) auto* checkbox = sender(); auto iter = std::find(m_checkboxes.begin(), m_checkboxes.end(), checkbox); if (iter == m_checkboxes.end()) { - static constexpr bool Should_not_happen = false; - static_cast(Should_not_happen); + [[maybe_unused]] static constexpr bool Should_not_happen = false; assert(Should_not_happen); return; } diff --git a/app/cc_view/src/widget/field/BitmaskValueFieldWidget.h b/app/cc_view/src/widget/field/BitmaskValueFieldWidget.h index 661c2a69..867a7e6f 100644 --- a/app/cc_view/src/widget/field/BitmaskValueFieldWidget.h +++ b/app/cc_view/src/widget/field/BitmaskValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/BundleFieldWidget.cpp b/app/cc_view/src/widget/field/BundleFieldWidget.cpp index 128b4907..616325b1 100644 --- a/app/cc_view/src/widget/field/BundleFieldWidget.cpp +++ b/app/cc_view/src/widget/field/BundleFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,12 +21,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" diff --git a/app/cc_view/src/widget/field/BundleFieldWidget.h b/app/cc_view/src/widget/field/BundleFieldWidget.h index de393b1b..0061a659 100644 --- a/app/cc_view/src/widget/field/BundleFieldWidget.h +++ b/app/cc_view/src/widget/field/BundleFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,12 +20,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/field_wrapper/BundleWrapper.h" #include "FieldWidget.h" diff --git a/app/cc_view/src/widget/field/EnumValueFieldWidget.cpp b/app/cc_view/src/widget/field/EnumValueFieldWidget.cpp index 997276b3..9c5ed1ca 100644 --- a/app/cc_view/src/widget/field/EnumValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/EnumValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/EnumValueFieldWidget.h b/app/cc_view/src/widget/field/EnumValueFieldWidget.h index 90333f5b..6bb28af5 100644 --- a/app/cc_view/src/widget/field/EnumValueFieldWidget.h +++ b/app/cc_view/src/widget/field/EnumValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/FieldWidget.cpp b/app/cc_view/src/widget/field/FieldWidget.cpp index 0afef069..c044ff44 100644 --- a/app/cc_view/src/widget/field/FieldWidget.cpp +++ b/app/cc_view/src/widget/field/FieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,14 +23,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { @@ -165,9 +161,8 @@ void FieldWidget::editEnabledUpdatedImpl() { } -void FieldWidget::updatePropertiesImpl(const QVariantMap& props) +void FieldWidget::updatePropertiesImpl([[maybe_unused]] const QVariantMap& props) { - static_cast(props); } void FieldWidget::performUiElementsVisibilityCheck(const property::field::Common& props) diff --git a/app/cc_view/src/widget/field/FieldWidget.h b/app/cc_view/src/widget/field/FieldWidget.h index 820b6c58..41a3bbeb 100644 --- a/app/cc_view/src/widget/field/FieldWidget.h +++ b/app/cc_view/src/widget/field/FieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,12 +22,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" #include "cc_tools_qt/field_wrapper/FieldWrapper.h" diff --git a/app/cc_view/src/widget/field/FloatValueFieldWidget.cpp b/app/cc_view/src/widget/field/FloatValueFieldWidget.cpp index e181de61..544359cf 100644 --- a/app/cc_view/src/widget/field/FloatValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/FloatValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/FloatValueFieldWidget.h b/app/cc_view/src/widget/field/FloatValueFieldWidget.h index 37af9b65..cf93eff1 100644 --- a/app/cc_view/src/widget/field/FloatValueFieldWidget.h +++ b/app/cc_view/src/widget/field/FloatValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/IntValueFieldWidget.cpp b/app/cc_view/src/widget/field/IntValueFieldWidget.cpp index e609f8d0..b0605011 100644 --- a/app/cc_view/src/widget/field/IntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/IntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,11 +20,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" @@ -91,8 +87,7 @@ void IntValueFieldWidget::updatePropertiesImpl(const QVariantMap& props) break; } - static constexpr bool The_handling_of_long_long_types_is_not_implemented_yet = false; - static_cast(The_handling_of_long_long_types_is_not_implemented_yet); + [[maybe_unused]] static constexpr bool The_handling_of_long_long_types_is_not_implemented_yet = false; assert(The_handling_of_long_long_types_is_not_implemented_yet); return; } while (false); diff --git a/app/cc_view/src/widget/field/IntValueFieldWidget.h b/app/cc_view/src/widget/field/IntValueFieldWidget.h index 531440fe..6039c0e7 100644 --- a/app/cc_view/src/widget/field/IntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/IntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/LongIntValueFieldWidget.cpp b/app/cc_view/src/widget/field/LongIntValueFieldWidget.cpp index f11494f0..85bd6c7e 100644 --- a/app/cc_view/src/widget/field/LongIntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/LongIntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/LongIntValueFieldWidget.h b/app/cc_view/src/widget/field/LongIntValueFieldWidget.h index 01ff36bd..adfdac72 100644 --- a/app/cc_view/src/widget/field/LongIntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/LongIntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.cpp b/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.cpp index 079d4ac6..bd1e21dd 100644 --- a/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.h b/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.h index eb6e5ecc..6bc45ba0 100644 --- a/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/LongLongIntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/OptionalFieldWidget.cpp b/app/cc_view/src/widget/field/OptionalFieldWidget.cpp index edea67cf..b8c29957 100644 --- a/app/cc_view/src/widget/field/OptionalFieldWidget.cpp +++ b/app/cc_view/src/widget/field/OptionalFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/field.h" diff --git a/app/cc_view/src/widget/field/OptionalFieldWidget.h b/app/cc_view/src/widget/field/OptionalFieldWidget.h index 2ff3d3f2..b8f69bff 100644 --- a/app/cc_view/src/widget/field/OptionalFieldWidget.h +++ b/app/cc_view/src/widget/field/OptionalFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.cpp b/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.cpp index 05614bf7..cc637ba8 100644 --- a/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -106,8 +106,7 @@ void ScaledIntValueFieldWidget::updatePropertiesImpl(const QVariantMap& props) m_ui.m_valueSpinBox->setDecimals(decimals); } else { - static constexpr bool Should_not_happen = false; - static_cast(Should_not_happen); + [[maybe_unused]] static constexpr bool Should_not_happen = false; assert(Should_not_happen); m_ui.m_valueSpinBox->setDecimals(0); } diff --git a/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.h b/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.h index deafbe52..e0b36a6c 100644 --- a/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/ScaledIntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/ShortIntValueFieldWidget.cpp b/app/cc_view/src/widget/field/ShortIntValueFieldWidget.cpp index c0d203ca..8dbaaddf 100644 --- a/app/cc_view/src/widget/field/ShortIntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/ShortIntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/ShortIntValueFieldWidget.h b/app/cc_view/src/widget/field/ShortIntValueFieldWidget.h index 167438a9..58a539ce 100644 --- a/app/cc_view/src/widget/field/ShortIntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/ShortIntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/SpecialValueWidget.cpp b/app/cc_view/src/widget/field/SpecialValueWidget.cpp index 45eae92b..c87f755b 100644 --- a/app/cc_view/src/widget/field/SpecialValueWidget.cpp +++ b/app/cc_view/src/widget/field/SpecialValueWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2019 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2019 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -149,9 +149,8 @@ void SpecialValueWidget::setFpValue(double value, double cmpEpsilon) } -void SpecialValueWidget::itemSelected(int idx) +void SpecialValueWidget::itemSelected([[maybe_unused]] int idx) { - static_cast(idx); auto valueVar = m_ui.m_specialComboBox->currentData(); if (!valueVar.isValid()) { emit sigRefreshReq(); diff --git a/app/cc_view/src/widget/field/SpecialValueWidget.h b/app/cc_view/src/widget/field/SpecialValueWidget.h index edc87553..f3a99613 100644 --- a/app/cc_view/src/widget/field/SpecialValueWidget.h +++ b/app/cc_view/src/widget/field/SpecialValueWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2019 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2019 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/StringFieldWidget.cpp b/app/cc_view/src/widget/field/StringFieldWidget.cpp index 1c88379f..34ae6f71 100644 --- a/app/cc_view/src/widget/field/StringFieldWidget.cpp +++ b/app/cc_view/src/widget/field/StringFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/StringFieldWidget.h b/app/cc_view/src/widget/field/StringFieldWidget.h index 6e6c100f..1eee89b0 100644 --- a/app/cc_view/src/widget/field/StringFieldWidget.h +++ b/app/cc_view/src/widget/field/StringFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/UnknownValueFieldWidget.cpp b/app/cc_view/src/widget/field/UnknownValueFieldWidget.cpp index 9d9aaa5b..6170acb0 100644 --- a/app/cc_view/src/widget/field/UnknownValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/UnknownValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/UnknownValueFieldWidget.h b/app/cc_view/src/widget/field/UnknownValueFieldWidget.h index 44105738..d2dc9ab4 100644 --- a/app/cc_view/src/widget/field/UnknownValueFieldWidget.h +++ b/app/cc_view/src/widget/field/UnknownValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.cpp b/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.cpp index 2f6018b2..8fcfa2f6 100644 --- a/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.cpp +++ b/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.h b/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.h index 0b3ef14b..976467c4 100644 --- a/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.h +++ b/app/cc_view/src/widget/field/UnsignedLongLongIntValueFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/VariantFieldWidget.cpp b/app/cc_view/src/widget/field/VariantFieldWidget.cpp index 75f5ee1c..fa6d2c92 100644 --- a/app/cc_view/src/widget/field/VariantFieldWidget.cpp +++ b/app/cc_view/src/widget/field/VariantFieldWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/app/cc_view/src/widget/field/VariantFieldWidget.h b/app/cc_view/src/widget/field/VariantFieldWidget.h index da9d1204..45c5a571 100644 --- a/app/cc_view/src/widget/field/VariantFieldWidget.h +++ b/app/cc_view/src/widget/field/VariantFieldWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 2c58aee2..4629558e 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT CC_TOOLS_QT_BUILD_DEMO_PROTOCOL) +if ((NOT CC_TOOLS_QT_BUILD_PLUGINS) OR (NOT CC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL)) return () endif () @@ -27,17 +27,15 @@ include_directories ( add_subdirectory (cc_plugin) -if (CC_TOOLS_QT_INSTALL_DEMO_PROTOCOL) - install ( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/demo - DESTINATION ${INC_INSTALL_DIR} - ) +install ( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/demo + DESTINATION ${INC_INSTALL_DIR} +) - install ( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/config/ - DESTINATION ${CONFIG_INSTALL_DIR} - ) -endif () +install ( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/config/ + DESTINATION ${CONFIG_INSTALL_DIR} +) FILE(GLOB_RECURSE headers "include/*.h") add_custom_target(demo.headers SOURCES ${headers}) diff --git a/demo/cc_plugin/CMakeLists.txt b/demo/cc_plugin/CMakeLists.txt index 56de02ae..9ead7a1b 100644 --- a/demo/cc_plugin/CMakeLists.txt +++ b/demo/cc_plugin/CMakeLists.txt @@ -1,5 +1,5 @@ function (cc_plugin_demo) - set (name "demo") + set (name "cc_tools_plugin_demo_protocol") set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/demo.json") set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/demo_refresh_stamp.txt") @@ -46,11 +46,9 @@ function (cc_plugin_demo) $<$:-Wno-old-style-cast> ) - if (CC_TOOLS_QT_INSTALL_DEMO_PROTOCOL) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/demo/cc_plugin/demo.json b/demo/cc_plugin/demo.json index 1866e623..2eda1078 100644 --- a/demo/cc_plugin/demo.json +++ b/demo/cc_plugin/demo.json @@ -1,5 +1,5 @@ { - "name" : "Demo Protocol", + "name" : "CC Demo Protocol", "desc" : [ "Demonstration binary protocol to show ability of the CommsChampion tool." ], diff --git a/lib/include/cc_tools_qt/Api.h b/lib/include/cc_tools_qt/Api.h index 71edb5e7..52144c42 100644 --- a/lib/include/cc_tools_qt/Api.h +++ b/lib/include/cc_tools_qt/Api.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/ConfigMgr.h b/lib/include/cc_tools_qt/ConfigMgr.h index 30571107..0aedea94 100644 --- a/lib/include/cc_tools_qt/ConfigMgr.h +++ b/lib/include/cc_tools_qt/ConfigMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,12 +21,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "Api.h" diff --git a/lib/include/cc_tools_qt/DataInfo.h b/lib/include/cc_tools_qt/DataInfo.h index 887635d1..6574f13b 100644 --- a/lib/include/cc_tools_qt/DataInfo.h +++ b/lib/include/cc_tools_qt/DataInfo.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,12 +23,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "Api.h" @@ -51,7 +47,7 @@ struct DataInfo /// @brief Type of extra properties storage using PropertiesMap = QVariantMap; - Timestamp m_timestamp; ///< Timestam when data has been received / sent + Timestamp m_timestamp; ///< Timestamp when data has been received / sent DataSeq m_data; ///< Actual raw data PropertiesMap m_extraProperties; ///< Extra properties that can be used by /// other componets @@ -63,6 +59,10 @@ using DataInfoPtr = std::shared_ptr; /// @brief Dynamically allocate @ref DataInfo and return in in @ref DataInfoPtr; CC_API DataInfoPtr makeDataInfo(); +/// @brief Dynamically allocate @ref DataInfo and return in in @ref DataInfoPtr; +/// @details Automatically populate the timestamp. +CC_API DataInfoPtr makeDataInfoTimed(); + } // namespace cc_tools_qt Q_DECLARE_METATYPE(cc_tools_qt::DataInfoPtr); diff --git a/lib/include/cc_tools_qt/ErrorStatus.h b/lib/include/cc_tools_qt/ErrorStatus.h index 105b9973..beb86303 100644 --- a/lib/include/cc_tools_qt/ErrorStatus.h +++ b/lib/include/cc_tools_qt/ErrorStatus.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This library is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/ExtraInfoMessage.h b/lib/include/cc_tools_qt/ExtraInfoMessage.h index 67820845..6a011b2e 100644 --- a/lib/include/cc_tools_qt/ExtraInfoMessage.h +++ b/lib/include/cc_tools_qt/ExtraInfoMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,14 +22,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "property/field.h" @@ -106,24 +102,20 @@ class ExtraInfoMessage : public virtual QString idAsStringImpl() const override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return QString(); } virtual void resetImpl() override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); } - virtual bool assignImpl(const cc_tools_qt::Message& other) override + virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override { - static_cast(other); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/Filter.h b/lib/include/cc_tools_qt/Filter.h index fbbd3dc8..50eb1edf 100644 --- a/lib/include/cc_tools_qt/Filter.h +++ b/lib/include/cc_tools_qt/Filter.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,12 +23,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "DataInfo.h" #include "Api.h" @@ -40,7 +36,7 @@ namespace cc_tools_qt /// @details The filter can be used to implement encryption / decryption of /// the data, and/or additional transport layer. /// @headerfile cc_tools_qt/Filter.h -class CC_API Filter : public QObject +class CC_API Filter { public: /// @brief Constructor @@ -81,6 +77,10 @@ class CC_API Filter : public QObject /// chain QList sendData(DataInfoPtr dataPtr); + /// @brief Make the filter aware about socket connection status + /// @param[in] connected Socket connection status. + void socketConnectionReport(bool connected); + /// @brief Type of callback to report outgoing data. using DataToSendCallback = std::function; @@ -118,14 +118,18 @@ class CC_API Filter : public QObject virtual void stopImpl(); /// @brief Polymorphic processing of incoming data. - /// @details Invoked by recvData() and must be implemented in the derived - /// class - virtual QList recvDataImpl(DataInfoPtr dataPtr) = 0; + /// @details Invoked by recvData() and expected be overridden in the derived + /// class. Default implementation is pass-through of data. + virtual QList recvDataImpl(DataInfoPtr dataPtr); /// @brief Polymorphic processing of outgoing data. - /// @details Invoked by sendData() and must be implemented in the derived - /// class - virtual QList sendDataImpl(DataInfoPtr dataPtr) = 0; + /// @details Invoked by sendData() and expected be overridden in the derived + /// class. Default implementation is pass-through of data. + virtual QList sendDataImpl(DataInfoPtr dataPtr); + + /// @brief Polymorphic processing of the socket connection report + /// @param[in] connected Socket connection status + virtual void socketConnectionReportImpl(bool connected); /// @brief Report new data to send generated by the filter itself. /// @details This function needs to be invoked by the derived class when diff --git a/lib/include/cc_tools_qt/InvalidMessage.h b/lib/include/cc_tools_qt/InvalidMessage.h index 0783e170..21e40531 100644 --- a/lib/include/cc_tools_qt/InvalidMessage.h +++ b/lib/include/cc_tools_qt/InvalidMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "property/message.h" @@ -93,16 +89,13 @@ class InvalidMessage : public virtual void resetImpl() override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); } - virtual bool assignImpl(const cc_tools_qt::Message& other) override + virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override { - static_cast(other); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/Message.h b/lib/include/cc_tools_qt/Message.h index 8756927a..4f0f1357 100644 --- a/lib/include/cc_tools_qt/Message.h +++ b/lib/include/cc_tools_qt/Message.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,13 +22,9 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "Api.h" diff --git a/lib/include/cc_tools_qt/MessageBase.h b/lib/include/cc_tools_qt/MessageBase.h index 5e17b314..18574683 100644 --- a/lib/include/cc_tools_qt/MessageBase.h +++ b/lib/include/cc_tools_qt/MessageBase.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -156,9 +156,8 @@ class MessageBase : DataSeq data; data.reserve(CommsBase::length()); auto iter = std::back_inserter(data); - auto es = CommsBase::write(iter, data.max_size()); + [[maybe_unused]] auto es = CommsBase::write(iter, data.max_size()); assert(es == comms::ErrorStatus::Success); - static_cast(es); return data; } diff --git a/lib/include/cc_tools_qt/MessageHandler.h b/lib/include/cc_tools_qt/MessageHandler.h index 1081cf53..5f9207cc 100644 --- a/lib/include/cc_tools_qt/MessageHandler.h +++ b/lib/include/cc_tools_qt/MessageHandler.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/MsgFileMgr.h b/lib/include/cc_tools_qt/MsgFileMgr.h index 44da2cb2..5656f02e 100644 --- a/lib/include/cc_tools_qt/MsgFileMgr.h +++ b/lib/include/cc_tools_qt/MsgFileMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,13 +22,9 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "Api.h" #include "Message.h" diff --git a/lib/include/cc_tools_qt/MsgMgr.h b/lib/include/cc_tools_qt/MsgMgr.h index 894ecf0e..64309dca 100644 --- a/lib/include/cc_tools_qt/MsgMgr.h +++ b/lib/include/cc_tools_qt/MsgMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -65,11 +65,11 @@ class CC_API MsgMgr typedef std::function MsgAddedCallbackFunc; typedef std::function ErrorReportCallbackFunc; - typedef std::function SocketDisconnectedReportCallbackFunc; + typedef std::function SocketConnectionStatusReportCallbackFunc; void setMsgAddedCallbackFunc(MsgAddedCallbackFunc&& func); void setErrorReportCallbackFunc(ErrorReportCallbackFunc&& func); - void setSocketDisconnectReportCallbackFunc(SocketDisconnectedReportCallbackFunc&& func); + void setSocketConnectionStatusReportCallbackFunc(SocketConnectionStatusReportCallbackFunc&& func); private: std::unique_ptr m_impl; diff --git a/lib/include/cc_tools_qt/MsgSendMgr.h b/lib/include/cc_tools_qt/MsgSendMgr.h index 0859d233..e758682b 100644 --- a/lib/include/cc_tools_qt/MsgSendMgr.h +++ b/lib/include/cc_tools_qt/MsgSendMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/Plugin.h b/lib/include/cc_tools_qt/Plugin.h index 72023d1c..d36b4360 100644 --- a/lib/include/cc_tools_qt/Plugin.h +++ b/lib/include/cc_tools_qt/Plugin.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,14 +22,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "Api.h" #include "PluginProperties.h" diff --git a/lib/include/cc_tools_qt/PluginMgr.h b/lib/include/cc_tools_qt/PluginMgr.h index 97698b9a..acb60a53 100644 --- a/lib/include/cc_tools_qt/PluginMgr.h +++ b/lib/include/cc_tools_qt/PluginMgr.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,13 +22,9 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "Api.h" #include "Plugin.h" @@ -58,6 +54,11 @@ class CC_API PluginMgr NumOfValues }; + const QString& getIid() const + { + return m_iid; + } + const QString& getName() const { return m_name; diff --git a/lib/include/cc_tools_qt/PluginProperties.h b/lib/include/cc_tools_qt/PluginProperties.h index 9cf27fda..172f2f6c 100644 --- a/lib/include/cc_tools_qt/PluginProperties.h +++ b/lib/include/cc_tools_qt/PluginProperties.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,15 +20,11 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "Socket.h" #include "Protocol.h" diff --git a/lib/include/cc_tools_qt/Protocol.h b/lib/include/cc_tools_qt/Protocol.h index 1ee0e77b..81646c78 100644 --- a/lib/include/cc_tools_qt/Protocol.h +++ b/lib/include/cc_tools_qt/Protocol.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,12 +23,8 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "Api.h" #include "Message.h" @@ -108,6 +104,10 @@ class CC_API Protocol /// @brief Invokes createInvalidMessageImpl(). MessagePtr createInvalidMessage(const MsgDataSeq& data); + /// @brief Make the protocol aware about socket connection status + /// @param[in] connected Socket connection status. + void socketConnectionReport(bool connected); + protected: /// @brief Polymorphic protocol name retrieval. /// @details Invoked by name(). @@ -147,6 +147,10 @@ class CC_API Protocol /// @brief Polymorphic creation of message object representing extra info. virtual MessagePtr createExtraInfoMessageImpl() = 0; + /// @brief Polymorphic processing of the socket connection report + /// @param[in] connected Socket connection status + virtual void socketConnectionReportImpl(bool connected); + /// @brief Helper function to assign protocol name to message properties. /// @details Expected to be used by the derived class. void setNameToMessageProperties(Message& msg); diff --git a/lib/include/cc_tools_qt/ProtocolBase.h b/lib/include/cc_tools_qt/ProtocolBase.h index 63e06174..0c28c724 100644 --- a/lib/include/cc_tools_qt/ProtocolBase.h +++ b/lib/include/cc_tools_qt/ProtocolBase.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,13 +23,9 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/ErrorStatus.h" #include "comms/util/ScopeGuard.h" @@ -167,8 +163,7 @@ class ProtocolBase : public Protocol setNameToMessageProperties(*invalidMsgPtr); std::unique_ptr rawDataMsgPtr(new RawDataMsg()); ReadIterator garbageReadIterator = &m_garbage[0]; - auto esTmp = rawDataMsgPtr->read(garbageReadIterator, m_garbage.size()); - static_cast(esTmp); + [[maybe_unused]] auto esTmp = rawDataMsgPtr->read(garbageReadIterator, m_garbage.size()); assert(esTmp == comms::ErrorStatus::Success); setRawDataToMessageProperties(MessagePtr(rawDataMsgPtr.release()), *invalidMsgPtr); setExtraInfoFunc(*invalidMsgPtr); @@ -214,15 +209,13 @@ class ProtocolBase : public Protocol auto readTransportIterBegTmp = readIterBeg; std::unique_ptr transportMsgPtr(new TransportMsg()); - auto esTmp = transportMsgPtr->read(readTransportIterBegTmp, dataSize); - static_cast(esTmp); + [[maybe_unused]] auto esTmp = transportMsgPtr->read(readTransportIterBegTmp, dataSize); assert(esTmp == comms::ErrorStatus::Success); setTransportToMessageProperties(MessagePtr(transportMsgPtr.release()), *msgPtr); auto readRawIterBegTmp = readIterBeg; std::unique_ptr rawDataMsgPtr(new RawDataMsg()); esTmp = rawDataMsgPtr->read(readRawIterBegTmp, dataSize); - static_cast(esTmp); assert(esTmp == comms::ErrorStatus::Success); setRawDataToMessageProperties(MessagePtr(rawDataMsgPtr.release()), *msgPtr); setExtraInfoFunc(*msgPtr); @@ -247,8 +240,7 @@ class ProtocolBase : public Protocol addMsgInfoGuard.release(); if (es == comms::ErrorStatus::MsgAllocFailure) { - static constexpr bool Must_not_be_happen = false; - static_cast(Must_not_be_happen); + [[maybe_unused]] static constexpr bool Must_not_be_happen = false; assert(Must_not_be_happen); break; } @@ -292,8 +284,7 @@ class ProtocolBase : public Protocol } if (es != comms::ErrorStatus::Success) { - static constexpr bool Unexpected_write_update_failure = false; - static_cast(Unexpected_write_update_failure); + [[maybe_unused]] static constexpr bool Unexpected_write_update_failure = false; assert(Unexpected_write_update_failure); return DataInfoPtr(); } @@ -331,8 +322,7 @@ class ProtocolBase : public Protocol } if (es != comms::ErrorStatus::Success) { - static constexpr bool Unexpected_write_update_failure = false; - static_cast(Unexpected_write_update_failure); + [[maybe_unused]] static constexpr bool Unexpected_write_update_failure = false; assert(Unexpected_write_update_failure); break; } @@ -355,16 +345,14 @@ class ProtocolBase : public Protocol std::unique_ptr transportMsgPtr(new TransportMsg()); if (!readMessageFunc(*transportMsgPtr)) { - static constexpr bool Unexpected_failure_to_read_transport_message = false; - static_cast(Unexpected_failure_to_read_transport_message); + [[maybe_unused]] static constexpr bool Unexpected_failure_to_read_transport_message = false; assert(Unexpected_failure_to_read_transport_message); break; } std::unique_ptr rawDataMsgPtr(new RawDataMsg()); if (!readMessageFunc(*rawDataMsgPtr)) { - static constexpr bool Unexpected_failure_to_read_raw_data = false; - static_cast(Unexpected_failure_to_read_raw_data); + [[maybe_unused]] static constexpr bool Unexpected_failure_to_read_raw_data = false; assert(Unexpected_failure_to_read_raw_data); break; } diff --git a/lib/include/cc_tools_qt/ProtocolMessageBase.h b/lib/include/cc_tools_qt/ProtocolMessageBase.h index d25e81ae..fc7ded20 100644 --- a/lib/include/cc_tools_qt/ProtocolMessageBase.h +++ b/lib/include/cc_tools_qt/ProtocolMessageBase.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -110,8 +110,7 @@ class ProtocolMessageBase : public TMsgBase const char* nameInternal(NoNameTag) const { - static constexpr bool Must_be_overriden = false; - static_cast(Must_be_overriden); + [[maybe_unused]] static constexpr bool Must_be_overriden = false; assert(Must_be_overriden); return nullptr; } diff --git a/lib/include/cc_tools_qt/RawDataMessage.h b/lib/include/cc_tools_qt/RawDataMessage.h index f8e343ea..5ba83cd0 100644 --- a/lib/include/cc_tools_qt/RawDataMessage.h +++ b/lib/include/cc_tools_qt/RawDataMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -21,11 +21,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "property/field.h" @@ -87,24 +83,20 @@ class RawDataMessage : public virtual QString idAsStringImpl() const override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return QString(); } virtual void resetImpl() override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); } - virtual bool assignImpl(const cc_tools_qt::Message& other) override + virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override { - static_cast(other); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/Socket.h b/lib/include/cc_tools_qt/Socket.h index 05c3e0a9..946a3542 100644 --- a/lib/include/cc_tools_qt/Socket.h +++ b/lib/include/cc_tools_qt/Socket.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,11 +23,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "Api.h" #include "DataInfo.h" @@ -119,16 +115,16 @@ class CC_API Socket m_errorReportCallback = std::forward(func); } - /// @brief Callback to report socket disconnection - using DisconnectedReportCallback = std::function ; + /// @brief Callback to report socket connection status + using ConnectionStatusReportCallback = std::function ; - /// @brief Set callback to report socket disconnection - /// @details The callback must have the same signature as @ref DisconnectedReportCallback. + /// @brief Set callback to report socket connection + /// @details The callback must have the same signature as @ref ConnectionStatusReportCallback. template - void setDisconnectedReportCallback(TFunc&& func) + void setConnectionStatusReportCallback(TFunc&& func) { - m_disconnectedReportCallback = std::forward(func); - } + m_connectionStatusReportCallback = std::forward(func); + } /// @brief Get properties describing socket connection right after plugins /// have been loaded and applied. @@ -196,7 +192,7 @@ class CC_API Socket private: DataReceivedCallback m_dataReceivedCallback; ErrorReportCallback m_errorReportCallback; - DisconnectedReportCallback m_disconnectedReportCallback; + ConnectionStatusReportCallback m_connectionStatusReportCallback; bool m_running = false; bool m_connected = false; diff --git a/lib/include/cc_tools_qt/StaticSingleton.h b/lib/include/cc_tools_qt/StaticSingleton.h index e3c03367..a5562275 100644 --- a/lib/include/cc_tools_qt/StaticSingleton.h +++ b/lib/include/cc_tools_qt/StaticSingleton.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/TransportMessageBase.h b/lib/include/cc_tools_qt/TransportMessageBase.h index c57543d1..13a97e77 100644 --- a/lib/include/cc_tools_qt/TransportMessageBase.h +++ b/lib/include/cc_tools_qt/TransportMessageBase.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,11 +20,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "ProtocolMessageBase.h" @@ -84,8 +80,7 @@ class TransportMessageBase : public /// @brief Overriding virtual cc_tools_qt::Message::idAsStringImpl() virtual QString idAsStringImpl() const override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return QString(); } @@ -93,17 +88,14 @@ class TransportMessageBase : public /// @brief Overriding virtual cc_tools_qt::Message::resetImpl() virtual void resetImpl() override { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); } /// @brief Overriding virtual cc_tools_qt::Message::assignImpl() - virtual bool assignImpl(const cc_tools_qt::Message& other) override + virtual bool assignImpl([[maybe_unused]] const cc_tools_qt::Message& other) override { - static_cast(other); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/cc_tools_qt.h b/lib/include/cc_tools_qt/cc_tools_qt.h index 81fb872f..62e89bca 100644 --- a/lib/include/cc_tools_qt/cc_tools_qt.h +++ b/lib/include/cc_tools_qt/cc_tools_qt.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/comms_champion.h b/lib/include/cc_tools_qt/comms_champion.h index 511efde2..f9e530f9 100644 --- a/lib/include/cc_tools_qt/comms_champion.h +++ b/lib/include/cc_tools_qt/comms_champion.h @@ -1,5 +1,5 @@ // -// Copyright 2021 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2021 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/details/FieldWrapperCreator.h b/lib/include/cc_tools_qt/details/FieldWrapperCreator.h index d4780c30..ff28e41d 100644 --- a/lib/include/cc_tools_qt/details/FieldWrapperCreator.h +++ b/lib/include/cc_tools_qt/details/FieldWrapperCreator.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/details/ret_unique_ptr.h b/lib/include/cc_tools_qt/details/ret_unique_ptr.h index 00e9f863..aa8bd091 100644 --- a/lib/include/cc_tools_qt/details/ret_unique_ptr.h +++ b/lib/include/cc_tools_qt/details/ret_unique_ptr.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/AllWrappers.h b/lib/include/cc_tools_qt/field_wrapper/AllWrappers.h index 48727450..5d949eae 100644 --- a/lib/include/cc_tools_qt/field_wrapper/AllWrappers.h +++ b/lib/include/cc_tools_qt/field_wrapper/AllWrappers.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/ArrayListRawDataWrapper.h b/lib/include/cc_tools_qt/field_wrapper/ArrayListRawDataWrapper.h index ff5b81e4..ac73a6c0 100644 --- a/lib/include/cc_tools_qt/field_wrapper/ArrayListRawDataWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/ArrayListRawDataWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -24,11 +24,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" @@ -171,11 +167,9 @@ class ArrayListRawDataWrapperT : public FieldWrapperT(value); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/field_wrapper/ArrayListWrapper.h b/lib/include/cc_tools_qt/field_wrapper/ArrayListWrapper.h index 93e8a2b1..22107fe3 100644 --- a/lib/include/cc_tools_qt/field_wrapper/ArrayListWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/ArrayListWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -138,8 +138,7 @@ class ArrayListWrapperT : public FieldWrapperT col.push_back(ElementType()); if (!m_wrapFieldFunc) { - static constexpr bool Callback_is_not_set = false; - static_cast(Callback_is_not_set); + [[maybe_unused]] static constexpr bool Callback_is_not_set = false; assert(Callback_is_not_set); mems.clear(); return; @@ -176,11 +175,9 @@ class ArrayListWrapperT : public FieldWrapperT } } - virtual bool setSerialisedValueImpl(const SerialisedSeq& value) override + virtual bool setSerialisedValueImpl([[maybe_unused]] const SerialisedSeq& value) override { - static_cast(value); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } @@ -216,8 +213,7 @@ class ArrayListWrapperT : public FieldWrapperT virtual void refreshMembersImpl() override { if (!m_wrapFieldFunc) { - static constexpr bool Callback_is_not_set = false; - static_cast(Callback_is_not_set); + [[maybe_unused]] static constexpr bool Callback_is_not_set = false; assert(Callback_is_not_set); } @@ -319,16 +315,14 @@ class ArrayListWrapperT : public FieldWrapperT SerialisedSeq serData; serData.reserve(prefixField.length()); auto writeIter = std::back_inserter(serData); - auto es = prefixField.write(writeIter, serData.max_size()); - static_cast(es); + [[maybe_unused]] auto es = prefixField.write(writeIter, serData.max_size()); assert(es == comms::ErrorStatus::Success); return serData; } void adjustFixedSizeInternal(HasVarSizeTag) { - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); } diff --git a/lib/include/cc_tools_qt/field_wrapper/BitfieldWrapper.h b/lib/include/cc_tools_qt/field_wrapper/BitfieldWrapper.h index 5e220810..61b52d6f 100644 --- a/lib/include/cc_tools_qt/field_wrapper/BitfieldWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/BitfieldWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/BitmaskValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/BitmaskValueWrapper.h index 75db56fb..c83d0193 100644 --- a/lib/include/cc_tools_qt/field_wrapper/BitmaskValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/BitmaskValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/BundleWrapper.h b/lib/include/cc_tools_qt/field_wrapper/BundleWrapper.h index e98ed36c..f4438092 100644 --- a/lib/include/cc_tools_qt/field_wrapper/BundleWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/BundleWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/EnumValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/EnumValueWrapper.h index 12b6297f..59caf1f4 100644 --- a/lib/include/cc_tools_qt/field_wrapper/EnumValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/EnumValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/FieldWrapper.h b/lib/include/cc_tools_qt/field_wrapper/FieldWrapper.h index f22496fe..abd0cab7 100644 --- a/lib/include/cc_tools_qt/field_wrapper/FieldWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/FieldWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -24,11 +24,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "cc_tools_qt/Api.h" @@ -136,8 +132,7 @@ class FieldWrapperT : public TBase SerialisedSeq seq; seq.reserve(m_field.length()); auto iter = std::back_inserter(seq); - auto es = m_field.write(iter, seq.max_size()); - static_cast(es); + [[maybe_unused]] auto es = m_field.write(iter, seq.max_size()); assert(es == comms::ErrorStatus::Success); assert(seq.size() == m_field.length()); return seq; @@ -254,10 +249,8 @@ class FieldWrapperT : public TBase return es == comms::ErrorStatus::Success; } - bool writeSerialisedSize(SerialisedSeq& seq, std::size_t sizeVal, NoPrefixSuffixTag) + bool writeSerialisedSize([[maybe_unused]] SerialisedSeq& seq, [[maybe_unused]] std::size_t sizeVal, NoPrefixSuffixTag) { - static_cast(seq); - static_cast(sizeVal); return true; } @@ -272,10 +265,8 @@ class FieldWrapperT : public TBase return es == comms::ErrorStatus::Success; } - bool writeSerialisedLength(SerialisedSeq& seq, std::size_t sizeVal, NoPrefixSuffixTag) + bool writeSerialisedLength([[maybe_unused]] SerialisedSeq& seq, [[maybe_unused]] std::size_t sizeVal, NoPrefixSuffixTag) { - static_cast(seq); - static_cast(sizeVal); return true; } @@ -288,9 +279,8 @@ class FieldWrapperT : public TBase return es == comms::ErrorStatus::Success; } - bool writeTrailSuffix(SerialisedSeq& seq, NoPrefixSuffixTag) + bool writeTrailSuffix([[maybe_unused]] SerialisedSeq& seq, NoPrefixSuffixTag) { - static_cast(seq); return true; } @@ -303,9 +293,8 @@ class FieldWrapperT : public TBase return es == comms::ErrorStatus::Success; } - bool writeTermSuffix(SerialisedSeq& seq, NoPrefixSuffixTag) + bool writeTermSuffix([[maybe_unused]] SerialisedSeq& seq, NoPrefixSuffixTag) { - static_cast(seq); return true; } diff --git a/lib/include/cc_tools_qt/field_wrapper/FieldWrapperHandler.h b/lib/include/cc_tools_qt/field_wrapper/FieldWrapperHandler.h index 952f107f..4efdac31 100644 --- a/lib/include/cc_tools_qt/field_wrapper/FieldWrapperHandler.h +++ b/lib/include/cc_tools_qt/field_wrapper/FieldWrapperHandler.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/FloatValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/FloatValueWrapper.h index aa9ac9c9..02b604bc 100644 --- a/lib/include/cc_tools_qt/field_wrapper/FloatValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/FloatValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/IntValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/IntValueWrapper.h index 19cbf84d..e0212bc1 100644 --- a/lib/include/cc_tools_qt/field_wrapper/IntValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/IntValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/NumericValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/NumericValueWrapper.h index 0c518a42..4e4a55ad 100644 --- a/lib/include/cc_tools_qt/field_wrapper/NumericValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/NumericValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/OptionalWrapper.h b/lib/include/cc_tools_qt/field_wrapper/OptionalWrapper.h index f9d9c7de..d8c80581 100644 --- a/lib/include/cc_tools_qt/field_wrapper/OptionalWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/OptionalWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/StringWrapper.h b/lib/include/cc_tools_qt/field_wrapper/StringWrapper.h index eceef3ac..636838e5 100644 --- a/lib/include/cc_tools_qt/field_wrapper/StringWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/StringWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -96,11 +96,9 @@ class StringWrapperT : public FieldWrapperT Base::field().setValue(val.toStdString().c_str()); } - virtual bool setSerialisedValueImpl(const SerialisedSeq& value) override + virtual bool setSerialisedValueImpl([[maybe_unused]] const SerialisedSeq& value) override { - static_cast(value); - static constexpr bool Must_not_be_called = false; - static_cast(Must_not_be_called); + [[maybe_unused]] static constexpr bool Must_not_be_called = false; assert(Must_not_be_called); return false; } diff --git a/lib/include/cc_tools_qt/field_wrapper/UnknownValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/UnknownValueWrapper.h index d96065ef..c7aaa78e 100644 --- a/lib/include/cc_tools_qt/field_wrapper/UnknownValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/UnknownValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/UnsignedLongValueWrapper.h b/lib/include/cc_tools_qt/field_wrapper/UnsignedLongValueWrapper.h index 6bf7dae7..89e7934c 100644 --- a/lib/include/cc_tools_qt/field_wrapper/UnsignedLongValueWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/UnsignedLongValueWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/field_wrapper/VariantWrapper.h b/lib/include/cc_tools_qt/field_wrapper/VariantWrapper.h index 20699358..5f75b89d 100644 --- a/lib/include/cc_tools_qt/field_wrapper/VariantWrapper.h +++ b/lib/include/cc_tools_qt/field_wrapper/VariantWrapper.h @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/include/cc_tools_qt/property/field.h b/lib/include/cc_tools_qt/property/field.h index b852d106..bf76163e 100644 --- a/lib/include/cc_tools_qt/property/field.h +++ b/lib/include/cc_tools_qt/property/field.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,15 +18,11 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "comms/comms.h" #include "cc_tools_qt/Api.h" diff --git a/lib/include/cc_tools_qt/property/message.h b/lib/include/cc_tools_qt/property/message.h index f675b11a..903a2fc4 100644 --- a/lib/include/cc_tools_qt/property/message.h +++ b/lib/include/cc_tools_qt/property/message.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,13 +20,9 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Api.h" #include "cc_tools_qt/Message.h" diff --git a/lib/include/cc_tools_qt/version.h b/lib/include/cc_tools_qt/version.h index 73d7d058..f604d8c5 100644 --- a/lib/include/cc_tools_qt/version.h +++ b/lib/include/cc_tools_qt/version.h @@ -1,5 +1,5 @@ // -// Copyright 2018 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2018 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -22,13 +22,13 @@ #include "comms/version.h" /// @brief Major verion of the library -#define CC_TOOLS_QT_MAJOR_VERSION 4U +#define CC_TOOLS_QT_MAJOR_VERSION 5U /// @brief Minor verion of the library -#define CC_TOOLS_QT_MINOR_VERSION 2U +#define CC_TOOLS_QT_MINOR_VERSION 0U /// @brief Patch level of the library -#define CC_TOOLS_QT_PATCH_VERSION 4U +#define CC_TOOLS_QT_PATCH_VERSION 0U /// @brief Macro to create numeric version as single unsigned number #define CC_TOOLS_QT_MAKE_VERSION(major_, minor_, patch_) \ @@ -77,7 +77,7 @@ constexpr unsigned version() return CC_TOOLS_QT_VERSION; } -static_assert(COMMS_MAKE_VERSION(5, 2, 1) <= comms::version(), +static_assert(COMMS_MAKE_VERSION(5, 2, 2) <= comms::version(), "The version of COMMS library is too old"); } // namespace cc_tools_qt diff --git a/lib/src/ConfigMgr.cpp b/lib/src/ConfigMgr.cpp index 6dcdd5ff..d095e420 100644 --- a/lib/src/ConfigMgr.cpp +++ b/lib/src/ConfigMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,14 +20,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/lib/src/DataInfo.cpp b/lib/src/DataInfo.cpp index 121e8de6..0e5d9b8e 100644 --- a/lib/src/DataInfo.cpp +++ b/lib/src/DataInfo.cpp @@ -22,4 +22,11 @@ CC_API DataInfoPtr makeDataInfo() return DataInfoPtr(new DataInfo()); } +CC_API DataInfoPtr makeDataInfoTimed() +{ + auto info = makeDataInfo(); + info->m_timestamp = DataInfo::TimestampClock::now(); + return info; +} + } // namespace cc_tools_qt diff --git a/lib/src/ErrorStatus.cpp b/lib/src/ErrorStatus.cpp index 3c91cf4b..e411c2e7 100644 --- a/lib/src/ErrorStatus.cpp +++ b/lib/src/ErrorStatus.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/Filter.cpp b/lib/src/Filter.cpp index d9f3ab0a..1f9a4914 100644 --- a/lib/src/Filter.cpp +++ b/lib/src/Filter.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -43,6 +43,11 @@ QList Filter::sendData(DataInfoPtr dataPtr) return sendDataImpl(std::move(dataPtr)); } +void Filter::socketConnectionReport(bool connected) +{ + return socketConnectionReportImpl(connected); +} + bool Filter::startImpl() { return true; @@ -52,6 +57,24 @@ void Filter::stopImpl() { } +QList Filter::recvDataImpl(DataInfoPtr dataPtr) +{ + QList result; + result.append(std::move(dataPtr)); + return result; +} + +QList Filter::sendDataImpl(DataInfoPtr dataPtr) +{ + QList result; + result.append(std::move(dataPtr)); + return result; +} + +void Filter::socketConnectionReportImpl([[maybe_unused]] bool connected) +{ +} + void Filter::reportDataToSend(DataInfoPtr dataPtr) { if (m_dataToSendCallback) { diff --git a/lib/src/Message.cpp b/lib/src/Message.cpp index b72d3ac4..5994e9dd 100644 --- a/lib/src/Message.cpp +++ b/lib/src/Message.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,12 +20,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() namespace cc_tools_qt { diff --git a/lib/src/MessageHandler.cpp b/lib/src/MessageHandler.cpp index c30f14e8..0fc0d354 100644 --- a/lib/src/MessageHandler.cpp +++ b/lib/src/MessageHandler.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,19 +22,16 @@ namespace cc_tools_qt MessageHandler::~MessageHandler() noexcept = default; -void MessageHandler::beginMsgHandlingImpl(Message& msg) +void MessageHandler::beginMsgHandlingImpl([[maybe_unused]] Message& msg) { - static_cast(msg); } -void MessageHandler::addExtraTransportFieldImpl(FieldWrapperPtr wrapper) +void MessageHandler::addExtraTransportFieldImpl([[maybe_unused]] FieldWrapperPtr wrapper) { - static_cast(wrapper); } -void MessageHandler::addFieldImpl(FieldWrapperPtr wrapper) +void MessageHandler::addFieldImpl([[maybe_unused]] FieldWrapperPtr wrapper) { - static_cast(wrapper); } void MessageHandler::endMsgHandlingImpl() diff --git a/lib/src/MsgFileMgr.cpp b/lib/src/MsgFileMgr.cpp index 106b0bd8..fd9ef6a1 100644 --- a/lib/src/MsgFileMgr.cpp +++ b/lib/src/MsgFileMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,14 +22,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" @@ -257,7 +253,6 @@ MessagePtr createMsgObjectFrom( assert(num.size() == 2); bool ok = false; auto byte = num.toInt(&ok, 16); - static_cast(ok); assert(ok); assert((0 <= byte) && (byte <= 0xff)); data.push_back(static_cast(byte)); @@ -341,8 +336,7 @@ QVariantList convertRecvMsgList( QVariantList convertedList; for (auto& msg : allMsgs) { if (!msg) { - static constexpr bool Message_must_exist = false; - static_cast(Message_must_exist); + [[maybe_unused]] static constexpr bool Message_must_exist = false; assert(Message_must_exist); continue; } @@ -396,8 +390,7 @@ QVariantList convertSendMsgList( QVariantList convertedList; for (auto& msg : allMsgs) { if (!msg) { - static constexpr bool Message_must_exist = false; - static_cast(Message_must_exist); + [[maybe_unused]] static constexpr bool Message_must_exist = false; assert(Message_must_exist); continue; } diff --git a/lib/src/MsgMgr.cpp b/lib/src/MsgMgr.cpp index 27570e12..ed3bfecb 100644 --- a/lib/src/MsgMgr.cpp +++ b/lib/src/MsgMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -110,10 +110,10 @@ void MsgMgr::setErrorReportCallbackFunc(ErrorReportCallbackFunc&& func) m_impl->setErrorReportCallbackFunc(std::move(func)); } -void MsgMgr::setSocketDisconnectReportCallbackFunc( - SocketDisconnectedReportCallbackFunc&& func) +void MsgMgr::setSocketConnectionStatusReportCallbackFunc( + SocketConnectionStatusReportCallbackFunc&& func) { - m_impl->setSocketDisconnectReportCallbackFunc(std::move(func)); + m_impl->setSocketConnectionStatusReportCallbackFunc(std::move(func)); } } // namespace cc_tools_qt diff --git a/lib/src/MsgMgrImpl.cpp b/lib/src/MsgMgrImpl.cpp index 4646811b..9a2b7031 100644 --- a/lib/src/MsgMgrImpl.cpp +++ b/lib/src/MsgMgrImpl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,11 +22,7 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "comms/util/ScopeGuard.h" #include "cc_tools_qt/property/message.h" @@ -71,8 +67,7 @@ MsgMgrImpl::~MsgMgrImpl() noexcept = default; void MsgMgrImpl::start() { if (m_running) { - static constexpr bool Already_running = false; - static_cast(Already_running); + [[maybe_unused]] static constexpr bool Already_running = false; assert(Already_running); return; } @@ -91,8 +86,7 @@ void MsgMgrImpl::start() void MsgMgrImpl::stop() { if (!m_running) { - static constexpr bool Already_stopped = false; - static_cast(Already_stopped); + [[maybe_unused]] static constexpr bool Already_stopped = false; assert(Already_stopped); return; } @@ -111,8 +105,7 @@ void MsgMgrImpl::stop() void MsgMgrImpl::clear() { if (m_running) { - static constexpr bool Still_running = false; - static_cast(Still_running); + [[maybe_unused]] static constexpr bool Still_running = false; assert(Still_running); ; stop(); } @@ -154,8 +147,7 @@ void MsgMgrImpl::deleteMsg(MessagePtr msg) }); if (iter == m_allMsgs.end()) { - static constexpr bool Deleting_non_existing_message = false; - static_cast(Deleting_non_existing_message); + [[maybe_unused]] static constexpr bool Deleting_non_existing_message = false; assert(Deleting_non_existing_message); return; } @@ -232,15 +224,13 @@ void MsgMgrImpl::addMsgs(const MessagesList& msgs, bool reportAdded) for (auto& m : msgs) { if (!m) { - static constexpr bool Invalid_message_in_the_list = false; - static_cast(Invalid_message_in_the_list); + [[maybe_unused]] static constexpr bool Invalid_message_in_the_list = false; assert(Invalid_message_in_the_list); continue; } if (property::message::Type().getFrom(*m) == MsgType::Invalid) { - static constexpr bool Invalid_type_of_message = false; - static_cast(Invalid_type_of_message); + [[maybe_unused]] static constexpr bool Invalid_type_of_message = false; assert(Invalid_type_of_message); continue; } @@ -277,10 +267,18 @@ void MsgMgrImpl::setSocket(SocketPtr socket) reportError(msg); }); - socket->setDisconnectedReportCallback( - [this]() + socket->setConnectionStatusReportCallback( + [this](bool connected) { - reportSocketDisconnected(); + for (auto& filter : m_filters) { + filter->socketConnectionReport(connected); + } + + if (m_protocol) { + m_protocol->socketConnectionReport(connected); + } + + reportSocketConnectionStatus(connected); }); m_socket = std::move(socket); @@ -426,10 +424,10 @@ void MsgMgrImpl::reportError(const QString& error) } } -void MsgMgrImpl::reportSocketDisconnected() +void MsgMgrImpl::reportSocketConnectionStatus(bool connected) { - if (m_socketDisconnectReportCallback) { - m_socketDisconnectReportCallback(); + if (m_socketConnectionStatusReportCallback) { + m_socketConnectionStatusReportCallback(connected); } } diff --git a/lib/src/MsgMgrImpl.h b/lib/src/MsgMgrImpl.h index c30dd9d8..97389d1b 100644 --- a/lib/src/MsgMgrImpl.h +++ b/lib/src/MsgMgrImpl.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -65,7 +65,7 @@ class MsgMgrImpl typedef MsgMgr::MsgAddedCallbackFunc MsgAddedCallbackFunc; typedef MsgMgr::ErrorReportCallbackFunc ErrorReportCallbackFunc; - typedef MsgMgr::SocketDisconnectedReportCallbackFunc SocketDisconnectedReportCallbackFunc; + typedef MsgMgr::SocketConnectionStatusReportCallbackFunc SocketConnectionStatusReportCallbackFunc; template void setMsgAddedCallbackFunc(TFunc&& func) @@ -80,9 +80,9 @@ class MsgMgrImpl } template - void setSocketDisconnectReportCallbackFunc(TFunc&& func) + void setSocketConnectionStatusReportCallbackFunc(TFunc&& func) { - m_socketDisconnectReportCallback = std::forward(func); + m_socketConnectionStatusReportCallback = std::forward(func); } private: @@ -93,7 +93,7 @@ class MsgMgrImpl void updateInternalId(Message& msg); void reportMsgAdded(MessagePtr msg); void reportError(const QString& error); - void reportSocketDisconnected(); + void reportSocketConnectionStatus(bool connected); AllMessages m_allMsgs; bool m_recvEnabled = false; @@ -106,7 +106,7 @@ class MsgMgrImpl MsgAddedCallbackFunc m_msgAddedCallback; ErrorReportCallbackFunc m_errorReportCallback; - SocketDisconnectedReportCallbackFunc m_socketDisconnectReportCallback; + SocketConnectionStatusReportCallbackFunc m_socketConnectionStatusReportCallback; }; } // namespace cc_tools_qt diff --git a/lib/src/MsgSendMgr.cpp b/lib/src/MsgSendMgr.cpp index 21c68eeb..1531839f 100644 --- a/lib/src/MsgSendMgr.cpp +++ b/lib/src/MsgSendMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/MsgSendMgrImpl.cpp b/lib/src/MsgSendMgrImpl.cpp index 52ba9e3c..039a21b6 100644 --- a/lib/src/MsgSendMgrImpl.cpp +++ b/lib/src/MsgSendMgrImpl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -36,8 +36,7 @@ MsgSendMgrImpl::~MsgSendMgrImpl() noexcept = default; void MsgSendMgrImpl::start(ProtocolPtr protocol, const MessagesList& msgs) { - static constexpr bool The_previous_sending_must_be_stopped_first = false; - static_cast(The_previous_sending_must_be_stopped_first); + [[maybe_unused]] static constexpr bool The_previous_sending_must_be_stopped_first = false; assert(m_msgsToSend.empty() || The_previous_sending_must_be_stopped_first); m_protocol = std::move(protocol); for (auto& m : msgs) { @@ -94,8 +93,7 @@ void MsgSendMgrImpl::sendPendingAndWait() if (reinsert) { if (!m_protocol) { - static constexpr bool Protocol_must_be_valid = false; - static_cast(Protocol_must_be_valid); + [[maybe_unused]] static constexpr bool Protocol_must_be_valid = false; assert(Protocol_must_be_valid); continue; } diff --git a/lib/src/MsgSendMgrImpl.h b/lib/src/MsgSendMgrImpl.h index 76882a04..d84f703f 100644 --- a/lib/src/MsgSendMgrImpl.h +++ b/lib/src/MsgSendMgrImpl.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/MsgSendMgr.h" #include "cc_tools_qt/Protocol.h" diff --git a/lib/src/Plugin.cpp b/lib/src/Plugin.cpp index 9f52dea6..2c87c7ad 100644 --- a/lib/src/Plugin.cpp +++ b/lib/src/Plugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -92,14 +92,12 @@ QVariant Plugin::getCustomProperty(const QString& name) return m_props.getCustomProperty(name); } -void Plugin::getCurrentConfigImpl(QVariantMap& config) +void Plugin::getCurrentConfigImpl([[maybe_unused]] QVariantMap& config) { - static_cast(config); } -void Plugin::reconfigureImpl(const QVariantMap& config) +void Plugin::reconfigureImpl([[maybe_unused]] const QVariantMap& config) { - static_cast(config); } PluginProperties& Plugin::pluginProperties() diff --git a/lib/src/PluginMgr.cpp b/lib/src/PluginMgr.cpp index ae6cdb47..810761b8 100644 --- a/lib/src/PluginMgr.cpp +++ b/lib/src/PluginMgr.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/PluginMgrImpl.cpp b/lib/src/PluginMgrImpl.cpp index 8a0c08d5..1c0f0bc2 100644 --- a/lib/src/PluginMgrImpl.cpp +++ b/lib/src/PluginMgrImpl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,15 +22,11 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Plugin.h" diff --git a/lib/src/PluginMgrImpl.h b/lib/src/PluginMgrImpl.h index 49446d02..756f6a65 100644 --- a/lib/src/PluginMgrImpl.h +++ b/lib/src/PluginMgrImpl.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,14 +22,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Plugin.h" #include "cc_tools_qt/PluginMgr.h" diff --git a/lib/src/PluginProperties.cpp b/lib/src/PluginProperties.cpp index f298f779..4280d8a1 100644 --- a/lib/src/PluginProperties.cpp +++ b/lib/src/PluginProperties.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -90,8 +90,7 @@ PluginProperties& PluginProperties::setCustomProperty( { do { if (name.startsWith(PropPrefix)) { - static constexpr bool Wrong_property_name = false; - static_cast(Wrong_property_name); + [[maybe_unused]] static constexpr bool Wrong_property_name = false; assert(Wrong_property_name); // Custom property cannot start with cc.PluginProp_ break; } @@ -129,8 +128,7 @@ PluginProperties::ConfigWidgetCreateFunc PluginProperties::getConfigWidgetCreate QVariant PluginProperties::getCustomProperty(const QString& name) const { if (name.startsWith(PropPrefix)) { - static constexpr bool Wrong_property_name = false; - static_cast(Wrong_property_name); + [[maybe_unused]] static constexpr bool Wrong_property_name = false; assert(Wrong_property_name); // Custom property cannot start with cc.PluginProp_ return QVariant(); } diff --git a/lib/src/Protocol.cpp b/lib/src/Protocol.cpp index f7ce8435..fdc7278f 100644 --- a/lib/src/Protocol.cpp +++ b/lib/src/Protocol.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,13 +17,9 @@ #include "cc_tools_qt/Protocol.h" -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/property/message.h" @@ -94,8 +90,7 @@ Protocol::UpdateStatus Protocol::updateMessage(Message& msg) auto infoMsg = createExtraInfoMessageImpl(); if (!infoMsg) { - static constexpr bool Info_must_be_created = false; - static_cast(Info_must_be_created); + [[maybe_unused]] static constexpr bool Info_must_be_created = false; assert(Info_must_be_created); return UpdateStatus::NoChange; } @@ -171,6 +166,15 @@ MessagePtr Protocol::createInvalidMessage(const MsgDataSeq& data) return invalidMsg; } +void Protocol::socketConnectionReport(bool connected) +{ + socketConnectionReportImpl(connected); +} + +void Protocol::socketConnectionReportImpl([[maybe_unused]] bool connected) +{ +} + void Protocol::setNameToMessageProperties(Message& msg) { property::message::ProtocolName().setTo(name(), msg); diff --git a/lib/src/Socket.cpp b/lib/src/Socket.cpp index 698dafff..eb39ed03 100644 --- a/lib/src/Socket.cpp +++ b/lib/src/Socket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -47,6 +47,9 @@ bool Socket::isRunning() const bool Socket::socketConnect() { m_connected = socketConnectImpl(); + if (m_connectionStatusReportCallback) { + m_connectionStatusReportCallback(m_connected); + } return m_connected; } @@ -54,6 +57,9 @@ void Socket::socketDisconnect() { socketDisconnectImpl(); m_connected = false; + if (m_connectionStatusReportCallback) { + m_connectionStatusReportCallback(false); + } } bool Socket::isSocketConnected() const @@ -125,8 +131,8 @@ void Socket::reportError(const QString& msg) void Socket::reportDisconnected() { m_connected = false; - if (m_running && m_disconnectedReportCallback) { - m_disconnectedReportCallback(); + if (m_running && m_connectionStatusReportCallback) { + m_connectionStatusReportCallback(false); } } diff --git a/lib/src/field_wrapper/ArrayListRawDataWrapper.cpp b/lib/src/field_wrapper/ArrayListRawDataWrapper.cpp index 0fb21ce6..638eb58b 100644 --- a/lib/src/field_wrapper/ArrayListRawDataWrapper.cpp +++ b/lib/src/field_wrapper/ArrayListRawDataWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/ArrayListWrapper.cpp b/lib/src/field_wrapper/ArrayListWrapper.cpp index 782ba366..8b42e6e3 100644 --- a/lib/src/field_wrapper/ArrayListWrapper.cpp +++ b/lib/src/field_wrapper/ArrayListWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/BitfieldWrapper.cpp b/lib/src/field_wrapper/BitfieldWrapper.cpp index 54840319..0c4ad44c 100644 --- a/lib/src/field_wrapper/BitfieldWrapper.cpp +++ b/lib/src/field_wrapper/BitfieldWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/BitmaskValueWrapper.cpp b/lib/src/field_wrapper/BitmaskValueWrapper.cpp index ca2c6356..17608364 100644 --- a/lib/src/field_wrapper/BitmaskValueWrapper.cpp +++ b/lib/src/field_wrapper/BitmaskValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/BundleWrapper.cpp b/lib/src/field_wrapper/BundleWrapper.cpp index bd1153f8..9137e118 100644 --- a/lib/src/field_wrapper/BundleWrapper.cpp +++ b/lib/src/field_wrapper/BundleWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/EnumValueWrapper.cpp b/lib/src/field_wrapper/EnumValueWrapper.cpp index 82e36f13..ca84b9d8 100644 --- a/lib/src/field_wrapper/EnumValueWrapper.cpp +++ b/lib/src/field_wrapper/EnumValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/FieldWrapper.cpp b/lib/src/field_wrapper/FieldWrapper.cpp index e53a0f71..8cc58a4e 100644 --- a/lib/src/field_wrapper/FieldWrapper.cpp +++ b/lib/src/field_wrapper/FieldWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/FloatValueWrapper.cpp b/lib/src/field_wrapper/FloatValueWrapper.cpp index 92beebb3..f46077e9 100644 --- a/lib/src/field_wrapper/FloatValueWrapper.cpp +++ b/lib/src/field_wrapper/FloatValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/IntValueWrapper.cpp b/lib/src/field_wrapper/IntValueWrapper.cpp index f4de370a..c101f793 100644 --- a/lib/src/field_wrapper/IntValueWrapper.cpp +++ b/lib/src/field_wrapper/IntValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/OptionalWrapper.cpp b/lib/src/field_wrapper/OptionalWrapper.cpp index 81584633..5729dde5 100644 --- a/lib/src/field_wrapper/OptionalWrapper.cpp +++ b/lib/src/field_wrapper/OptionalWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/StringWrapper.cpp b/lib/src/field_wrapper/StringWrapper.cpp index 9c2b4720..ce67b229 100644 --- a/lib/src/field_wrapper/StringWrapper.cpp +++ b/lib/src/field_wrapper/StringWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/UnknownValueWrapper.cpp b/lib/src/field_wrapper/UnknownValueWrapper.cpp index 7780db26..f5b64b9e 100644 --- a/lib/src/field_wrapper/UnknownValueWrapper.cpp +++ b/lib/src/field_wrapper/UnknownValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/UnsignedLongValueWrapper.cpp b/lib/src/field_wrapper/UnsignedLongValueWrapper.cpp index a3960ebf..8143be07 100644 --- a/lib/src/field_wrapper/UnsignedLongValueWrapper.cpp +++ b/lib/src/field_wrapper/UnsignedLongValueWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2017 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/field_wrapper/VariantWrapper.cpp b/lib/src/field_wrapper/VariantWrapper.cpp index 15e7ebba..3085b333 100644 --- a/lib/src/field_wrapper/VariantWrapper.cpp +++ b/lib/src/field_wrapper/VariantWrapper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/property/field.cpp b/lib/src/property/field.cpp index bf806638..5e2d8e71 100644 --- a/lib/src/property/field.cpp +++ b/lib/src/property/field.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/lib/src/property/message.cpp b/lib/src/property/message.cpp index c1629c7f..8591b98e 100644 --- a/lib/src/property/message.cpp +++ b/lib/src/property/message.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/echo_socket/CMakeLists.txt b/plugin/echo_socket/CMakeLists.txt index 7dc3637c..f3c7d85a 100644 --- a/plugin/echo_socket/CMakeLists.txt +++ b/plugin/echo_socket/CMakeLists.txt @@ -1,6 +1,11 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_ECHO_SOCKET) + return() +endif () + +###################################################################### function (plugin_echo_socket) - set (name "echo_socket") + set (name "cc_tools_plugin_echo_socket") set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/echo_socket.json") set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/refresh_stamp.txt") @@ -29,11 +34,9 @@ function (plugin_echo_socket) add_library (${name} MODULE ${src} ${moc}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/echo_socket/EchoSocket.cpp b/plugin/echo_socket/EchoSocket.cpp index 50531a59..ac93a943 100644 --- a/plugin/echo_socket/EchoSocket.cpp +++ b/plugin/echo_socket/EchoSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,6 +22,9 @@ namespace cc_tools_qt { +namespace plugin +{ + EchoSocket::EchoSocket() { m_timer.setSingleShot(true); @@ -64,6 +67,8 @@ void EchoSocket::sendDataPostponed() } } +} // namespace plugin + } // namespace cc_tools_qt diff --git a/plugin/echo_socket/EchoSocket.h b/plugin/echo_socket/EchoSocket.h index fa4049c7..39be3346 100644 --- a/plugin/echo_socket/EchoSocket.h +++ b/plugin/echo_socket/EchoSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,17 +20,16 @@ #include -#include "comms/CompileControl.h" -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() - #include "cc_tools_qt/Socket.h" namespace cc_tools_qt { +namespace plugin +{ + class EchoSocket : public QObject, public Socket { Q_OBJECT @@ -58,6 +57,8 @@ SocketPtr makeEchoSocket() return SocketPtr(new EchoSocket()); } +} // namespace plugin + } // namespace cc_tools_qt diff --git a/plugin/echo_socket/EchoSocketPlugin.cpp b/plugin/echo_socket/EchoSocketPlugin.cpp index c764e225..f0410c8c 100644 --- a/plugin/echo_socket/EchoSocketPlugin.cpp +++ b/plugin/echo_socket/EchoSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/echo_socket/EchoSocketPlugin.h b/plugin/echo_socket/EchoSocketPlugin.h index bf29afed..1837d5d7 100644 --- a/plugin/echo_socket/EchoSocketPlugin.h +++ b/plugin/echo_socket/EchoSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/echo_socket/echo_socket.json b/plugin/echo_socket/echo_socket.json index b11e8264..51a6b8cb 100644 --- a/plugin/echo_socket/echo_socket.json +++ b/plugin/echo_socket/echo_socket.json @@ -1,5 +1,5 @@ { - "name" : "Echo Socket", + "name" : "CC Echo Socket", "desc" : [ "This socket duplicates outgoing data and echoes it as an incoming one." ], diff --git a/plugin/null_socket/CMakeLists.txt b/plugin/null_socket/CMakeLists.txt index 4da132d2..5a7c2520 100644 --- a/plugin/null_socket/CMakeLists.txt +++ b/plugin/null_socket/CMakeLists.txt @@ -1,5 +1,11 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_NULL_SOCKET) + return() +endif () + +###################################################################### + function (plugin_null_socket) - set (name "null_socket") + set (name "cc_tools_plugin_null_socket") set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/null_socket.json") set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/refresh_stamp.txt") @@ -27,11 +33,9 @@ function (plugin_null_socket) add_library (${name} MODULE ${src} ${moc}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/null_socket/NullSocket.cpp b/plugin/null_socket/NullSocket.cpp index c9f814c7..8888d12b 100644 --- a/plugin/null_socket/NullSocket.cpp +++ b/plugin/null_socket/NullSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,13 +22,15 @@ namespace cc_tools_qt { +namespace plugin +{ + NullSocket::NullSocket() = default; NullSocket::~NullSocket() noexcept = default; -void NullSocket::sendDataImpl(DataInfoPtr dataPtr) +void NullSocket::sendDataImpl([[maybe_unused]] DataInfoPtr dataPtr) { - static_cast(dataPtr); } unsigned NullSocket::connectionPropertiesImpl() const @@ -36,6 +38,8 @@ unsigned NullSocket::connectionPropertiesImpl() const return ConnectionProperty_Autoconnect | ConnectionProperty_NonDisconnectable; } +} // namespace plugin + } // namespace cc_tools_qt diff --git a/plugin/null_socket/NullSocket.h b/plugin/null_socket/NullSocket.h index 4eaaf532..5eeec08e 100644 --- a/plugin/null_socket/NullSocket.h +++ b/plugin/null_socket/NullSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2014 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -23,6 +23,9 @@ namespace cc_tools_qt { +namespace plugin +{ + class NullSocket : public Socket { public: @@ -40,6 +43,8 @@ SocketPtr makeNullSocket() return SocketPtr(new NullSocket()); } +} // namespace plugin + } // namespace cc_tools_qt diff --git a/plugin/null_socket/NullSocketPlugin.cpp b/plugin/null_socket/NullSocketPlugin.cpp index c126bb1d..185b8dbb 100644 --- a/plugin/null_socket/NullSocketPlugin.cpp +++ b/plugin/null_socket/NullSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/null_socket/NullSocketPlugin.h b/plugin/null_socket/NullSocketPlugin.h index be7a30aa..5d0b28ca 100644 --- a/plugin/null_socket/NullSocketPlugin.h +++ b/plugin/null_socket/NullSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/null_socket/null_socket.json b/plugin/null_socket/null_socket.json index 1d3fff91..8e13c912 100644 --- a/plugin/null_socket/null_socket.json +++ b/plugin/null_socket/null_socket.json @@ -1,5 +1,5 @@ { - "name" : "NULL Socket", + "name" : "CC NULL Socket", "desc" : [ "This socket doesn't generate any incoming data and discards all ", "the data being written to it." diff --git a/plugin/raw_data_protocol/CMakeLists.txt b/plugin/raw_data_protocol/CMakeLists.txt index 349319a5..2bd580e2 100644 --- a/plugin/raw_data_protocol/CMakeLists.txt +++ b/plugin/raw_data_protocol/CMakeLists.txt @@ -1,3 +1,9 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_RAW_DATA_PROTOCOL) + return() +endif () + +###################################################################### + include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} @@ -5,9 +11,7 @@ include_directories ( add_subdirectory (cc_plugin) -if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/config/ - DESTINATION ${CONFIG_INSTALL_DIR} - ) -endif () \ No newline at end of file +install ( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/config/ + DESTINATION ${CONFIG_INSTALL_DIR} +) \ No newline at end of file diff --git a/plugin/raw_data_protocol/Plugin.h b/plugin/raw_data_protocol/Plugin.h deleted file mode 100644 index e69de29b..00000000 diff --git a/plugin/raw_data_protocol/cc_plugin/CMakeLists.txt b/plugin/raw_data_protocol/cc_plugin/CMakeLists.txt index d71259c7..9e7f6979 100644 --- a/plugin/raw_data_protocol/cc_plugin/CMakeLists.txt +++ b/plugin/raw_data_protocol/cc_plugin/CMakeLists.txt @@ -1,5 +1,5 @@ function (cc_plugin_raw_data_protocol) - set (name "raw_data_protocol") + set (name "cc_tools_plugin_raw_data_protocol") set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/raw_data_protocol.json") set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/refresh_stamp.txt") @@ -7,21 +7,21 @@ function (cc_plugin_raw_data_protocol) set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/Plugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/RawDataProtocolPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - Plugin.cpp - Protocol.cpp - TransportMessage.cpp - DataMessage.cpp + RawDataProtocolPlugin.cpp + RawDataProtocol.cpp + RawDataProtocolTransportMessage.cpp + RawDataProtocolDataMessage.cpp ) set (hdr - Plugin.h + RawDataProtocolPlugin.h ) cc_qt_wrap_cpp( @@ -32,11 +32,9 @@ function (cc_plugin_raw_data_protocol) add_library (${name} MODULE ${src} ${moc}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/raw_data_protocol/cc_plugin/Protocol.cpp b/plugin/raw_data_protocol/cc_plugin/RawDataProtocol.cpp similarity index 83% rename from plugin/raw_data_protocol/cc_plugin/Protocol.cpp rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocol.cpp index 98897a90..5bcd0ca5 100644 --- a/plugin/raw_data_protocol/cc_plugin/Protocol.cpp +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocol.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "Protocol.h" +#include "RawDataProtocol.h" #include "comms/comms.h" @@ -33,9 +33,9 @@ namespace raw_data_protocol namespace cc_plugin { -Protocol::~Protocol() noexcept = default; +RawDataProtocol::~RawDataProtocol() noexcept = default; -const QString& Protocol::nameImpl() const +const QString& RawDataProtocol::nameImpl() const { static const QString& Str("Raw Data Protocol"); return Str; diff --git a/plugin/raw_data_protocol/cc_plugin/Protocol.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocol.h similarity index 70% rename from plugin/raw_data_protocol/cc_plugin/Protocol.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocol.h index adf585ad..f1bc5e4c 100644 --- a/plugin/raw_data_protocol/cc_plugin/Protocol.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocol.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,8 +19,8 @@ #pragma once #include "cc_tools_qt/cc_tools_qt.h" -#include "cc_plugin/Stack.h" -#include "cc_plugin/TransportMessage.h" +#include "cc_plugin/RawDataProtocolStack.h" +#include "cc_plugin/RawDataProtocolTransportMessage.h" namespace cc_tools_qt { @@ -34,19 +34,19 @@ namespace raw_data_protocol namespace cc_plugin { -class Protocol : public +class RawDataProtocol : public cc_tools_qt::ProtocolBase< - cc_plugin::Stack, - TransportMessage + cc_plugin::RawDataProtocolStack, + cc_plugin::RawDataProtocolTransportMessage > { typedef cc_tools_qt::ProtocolBase< - cc_plugin::Stack, - TransportMessage + cc_plugin::RawDataProtocolStack, + cc_plugin::RawDataProtocolTransportMessage > Base; public: - Protocol() = default; - virtual ~Protocol() noexcept; + RawDataProtocol() = default; + virtual ~RawDataProtocol() noexcept; protected: virtual const QString& nameImpl() const override; diff --git a/plugin/raw_data_protocol/cc_plugin/DataMessage.cpp b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.cpp similarity index 61% rename from plugin/raw_data_protocol/cc_plugin/DataMessage.cpp rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.cpp index 1972a37f..3f529970 100644 --- a/plugin/raw_data_protocol/cc_plugin/DataMessage.cpp +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ #include -#include "DataMessage.h" +#include "RawDataProtocolDataMessage.h" namespace cc = cc_tools_qt; @@ -36,32 +36,32 @@ namespace cc_plugin namespace { -typedef raw_data_protocol::DataMessageFields DataMessageFields; +typedef raw_data_protocol::DataMessageFields DataMessageFields; QVariantList createFieldsProperties() { QVariantList props; props.append(cc::property::field::ForField().name("data").asMap()); - assert(props.size() == DataMessage::FieldIdx_numOfValues); + assert(props.size() == RawDataProtocolDataMessage::FieldIdx_numOfValues); return props; } } // namespace -DataMessage::DataMessage() = default; -DataMessage::~DataMessage() noexcept = default; +RawDataProtocolDataMessage::RawDataProtocolDataMessage() = default; +RawDataProtocolDataMessage::~RawDataProtocolDataMessage() noexcept = default; -DataMessage& DataMessage::operator=(const DataMessage&) = default; -DataMessage& DataMessage::operator=(DataMessage&&) = default; +RawDataProtocolDataMessage& RawDataProtocolDataMessage::operator=(const RawDataProtocolDataMessage&) = default; +RawDataProtocolDataMessage& RawDataProtocolDataMessage::operator=(RawDataProtocolDataMessage&&) = default; -const char* DataMessage::nameImpl() const +const char* RawDataProtocolDataMessage::nameImpl() const { static const char* Str = "Raw Data"; return Str; } -const QVariantList& DataMessage::fieldsPropertiesImpl() const +const QVariantList& RawDataProtocolDataMessage::fieldsPropertiesImpl() const { static const auto Props = createFieldsProperties(); return Props; diff --git a/plugin/raw_data_protocol/cc_plugin/DataMessage.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.h similarity index 66% rename from plugin/raw_data_protocol/cc_plugin/DataMessage.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.h index 8b9df526..c4baacd9 100644 --- a/plugin/raw_data_protocol/cc_plugin/DataMessage.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolDataMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ #include "cc_tools_qt/cc_tools_qt.h" #include "raw_data_protocol/DataMessage.h" -#include "cc_plugin/Message.h" +#include "cc_plugin/RawDataProtocolMessage.h" namespace cc_tools_qt { @@ -34,19 +34,19 @@ namespace raw_data_protocol namespace cc_plugin { -class DataMessage : public +class RawDataProtocolDataMessage : public cc_tools_qt::ProtocolMessageBase< - raw_data_protocol::DataMessage, - DataMessage> + raw_data_protocol::DataMessage, + RawDataProtocolDataMessage> { public: - DataMessage(); - DataMessage(const DataMessage&) = delete; - DataMessage(DataMessage&&) = delete; - virtual ~DataMessage() noexcept; + RawDataProtocolDataMessage(); + RawDataProtocolDataMessage(const RawDataProtocolDataMessage&) = delete; + RawDataProtocolDataMessage(RawDataProtocolDataMessage&&) = delete; + virtual ~RawDataProtocolDataMessage() noexcept; - DataMessage& operator=(const DataMessage&); - DataMessage& operator=(DataMessage&&); + RawDataProtocolDataMessage& operator=(const RawDataProtocolDataMessage&); + RawDataProtocolDataMessage& operator=(RawDataProtocolDataMessage&&); protected: virtual const char* nameImpl() const override; diff --git a/plugin/raw_data_protocol/cc_plugin/Message.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolMessage.h similarity index 87% rename from plugin/raw_data_protocol/cc_plugin/Message.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolMessage.h index 27013185..46ad3490 100644 --- a/plugin/raw_data_protocol/cc_plugin/Message.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -34,12 +34,12 @@ namespace cc_plugin { template -class MessageT : +class RawDataProtocolMessageT : public cc_tools_qt::MessageBase { typedef cc_tools_qt::MessageBase Base; public: - virtual ~MessageT() {} + virtual ~RawDataProtocolMessageT() {} protected: @@ -55,7 +55,7 @@ class MessageT : } }; -typedef MessageT<> Message; +typedef RawDataProtocolMessageT<> RawDataProtocolMessage; } // namespace cc_plugin diff --git a/plugin/raw_data_protocol/cc_plugin/Plugin.cpp b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.cpp similarity index 76% rename from plugin/raw_data_protocol/cc_plugin/Plugin.cpp rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.cpp index bd4a0f8e..081b1f04 100644 --- a/plugin/raw_data_protocol/cc_plugin/Plugin.cpp +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -16,8 +16,8 @@ // along with this program. If not, see . -#include "Plugin.h" -#include "Protocol.h" +#include "RawDataProtocolPlugin.h" +#include "RawDataProtocol.h" namespace cc = cc_tools_qt; @@ -33,17 +33,17 @@ namespace raw_data_protocol namespace cc_plugin { -Plugin::Plugin() +RawDataProtocolPlugin::RawDataProtocolPlugin() { pluginProperties() .setProtocolCreateFunc( []() { - return cc::ProtocolPtr(new Protocol()); + return cc::ProtocolPtr(new RawDataProtocol()); }); } -Plugin::~Plugin() noexcept = default; +RawDataProtocolPlugin::~RawDataProtocolPlugin() noexcept = default; } // namespace cc_plugin diff --git a/plugin/raw_data_protocol/cc_plugin/Plugin.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.h similarity index 85% rename from plugin/raw_data_protocol/cc_plugin/Plugin.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.h index 31ca13db..bcd0230f 100644 --- a/plugin/raw_data_protocol/cc_plugin/Plugin.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -34,15 +34,15 @@ namespace raw_data_protocol namespace cc_plugin { -class Plugin : public cc_tools_qt::Plugin +class RawDataProtocolPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.RawDataProtocol" FILE "raw_data_protocol.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - Plugin(); - ~Plugin() noexcept; + RawDataProtocolPlugin(); + ~RawDataProtocolPlugin() noexcept; }; } // namespace cc_plugin diff --git a/plugin/raw_data_protocol/cc_plugin/Stack.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolStack.h similarity index 75% rename from plugin/raw_data_protocol/cc_plugin/Stack.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolStack.h index a9fd7a2b..04d0b3ae 100644 --- a/plugin/raw_data_protocol/cc_plugin/Stack.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolStack.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,8 +19,8 @@ #pragma once #include "raw_data_protocol/Stack.h" -#include "Message.h" -#include "DataMessage.h" +#include "RawDataProtocolMessage.h" +#include "RawDataProtocolDataMessage.h" namespace cc_tools_qt { @@ -34,10 +34,11 @@ namespace raw_data_protocol namespace cc_plugin { -typedef raw_data_protocol::Stack< - cc_plugin::Message, - cc_plugin::DataMessage -> Stack; +using RawDataProtocolStack = + raw_data_protocol::Stack< + cc_plugin::RawDataProtocolMessage, + cc_plugin::RawDataProtocolDataMessage + >; } // namespace cc_plugin diff --git a/plugin/raw_data_protocol/cc_plugin/TransportMessage.cpp b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.cpp similarity index 80% rename from plugin/raw_data_protocol/cc_plugin/TransportMessage.cpp rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.cpp index a0abce4f..c90658ac 100644 --- a/plugin/raw_data_protocol/cc_plugin/TransportMessage.cpp +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "TransportMessage.h" +#include "RawDataProtocolTransportMessage.h" #include @@ -38,7 +38,7 @@ namespace cc_plugin namespace { -typedef TransportMessage::Field FieldBase; +typedef RawDataProtocolTransportMessage::Field FieldBase; typedef raw_data_protocol::IdField IdField; typedef raw_data_protocol::DataField<> DataField; @@ -47,13 +47,13 @@ QVariantList createFieldsProperties() QVariantList props; props.append(cc::property::field::ForField().hidden().asMap()); props.append(cc::property::field::ForField().name("Data").asMap()); - assert(props.size() == TransportMessage::FieldIdx_NumOfValues); + assert(props.size() == RawDataProtocolTransportMessage::FieldIdx_NumOfValues); return props; } } // namespace -const QVariantList& TransportMessage::fieldsPropertiesImpl() const +const QVariantList& RawDataProtocolTransportMessage::fieldsPropertiesImpl() const { static const auto Props = createFieldsProperties(); return Props; diff --git a/plugin/raw_data_protocol/cc_plugin/TransportMessage.h b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.h similarity index 68% rename from plugin/raw_data_protocol/cc_plugin/TransportMessage.h rename to plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.h index 72fb6b25..6e427fb6 100644 --- a/plugin/raw_data_protocol/cc_plugin/TransportMessage.h +++ b/plugin/raw_data_protocol/cc_plugin/RawDataProtocolTransportMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,8 +19,8 @@ #pragma once #include "cc_tools_qt/cc_tools_qt.h" -#include "cc_plugin/Message.h" -#include "cc_plugin/Stack.h" +#include "cc_plugin/RawDataProtocolMessage.h" +#include "cc_plugin/RawDataProtocolStack.h" namespace cc_tools_qt { @@ -37,22 +37,22 @@ namespace cc_plugin namespace details { -using TransportMessageFields = +using RawDataProtocolTransportMessageFields = std::tuple< - comms::field::IntValue, + comms::field::IntValue, raw_data_protocol::DataField<> >; } // namespace details -class TransportMessage : public +class RawDataProtocolTransportMessage : public cc_tools_qt::TransportMessageBase< - cc_plugin::Stack::Message, - details::TransportMessageFields> + cc_plugin::RawDataProtocolStack::Message, + details::RawDataProtocolTransportMessageFields> { typedef cc_tools_qt::TransportMessageBase< - cc_plugin::Stack::Message, - details::TransportMessageFields> Base; + cc_plugin::RawDataProtocolStack::Message, + details::RawDataProtocolTransportMessageFields> Base; public: enum FieldIdx { diff --git a/plugin/raw_data_protocol/cc_plugin/raw_data_protocol.json b/plugin/raw_data_protocol/cc_plugin/raw_data_protocol.json index 998794b2..4a1c038c 100644 --- a/plugin/raw_data_protocol/cc_plugin/raw_data_protocol.json +++ b/plugin/raw_data_protocol/cc_plugin/raw_data_protocol.json @@ -1,5 +1,5 @@ { - "name" : "Raw Data Protocol", + "name" : "CC Raw Data Protocol", "desc" : [ "Raw Binary Data Dump Protocol." ], diff --git a/plugin/raw_data_protocol/include/raw_data_protocol/DataMessage.h b/plugin/raw_data_protocol/include/raw_data_protocol/DataMessage.h index f98beb9d..3d4b42fa 100644 --- a/plugin/raw_data_protocol/include/raw_data_protocol/DataMessage.h +++ b/plugin/raw_data_protocol/include/raw_data_protocol/DataMessage.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/raw_data_protocol/include/raw_data_protocol/Message.h b/plugin/raw_data_protocol/include/raw_data_protocol/Message.h index 1095d9bd..943806c5 100644 --- a/plugin/raw_data_protocol/include/raw_data_protocol/Message.h +++ b/plugin/raw_data_protocol/include/raw_data_protocol/Message.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/raw_data_protocol/include/raw_data_protocol/Stack.h b/plugin/raw_data_protocol/include/raw_data_protocol/Stack.h index b2ef97b9..0fad1275 100644 --- a/plugin/raw_data_protocol/include/raw_data_protocol/Stack.h +++ b/plugin/raw_data_protocol/include/raw_data_protocol/Stack.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/serial_socket/CMakeLists.txt b/plugin/serial_socket/CMakeLists.txt index 1259ea8d..9eb0401f 100644 --- a/plugin/serial_socket/CMakeLists.txt +++ b/plugin/serial_socket/CMakeLists.txt @@ -1,5 +1,11 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_SERIAL_SOCKET) + return() +endif () + +###################################################################### + function (plugin_serial_socket) - set (name "serial_socket") + set (name "cc_tools_plugin_serial_socket") if (NOT TARGET Qt::SerialPort) message(WARNING "Can NOT build ${name} due to missing Qt::SerialPort library") @@ -42,11 +48,9 @@ function (plugin_serial_socket) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::SerialPort Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/serial_socket/SerialSocket.cpp b/plugin/serial_socket/SerialSocket.cpp index a6bd370c..88068ffd 100644 --- a/plugin/serial_socket/SerialSocket.cpp +++ b/plugin/serial_socket/SerialSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,12 +18,8 @@ #include #include "SerialSocket.h" -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include @@ -127,7 +123,6 @@ void SerialSocket::errorOccurred(QSerialPort::SerialPortError err) return; } - static_cast(err); reportError(m_serial.errorString()); m_serial.clearError(); if (!m_serial.isOpen()) { diff --git a/plugin/serial_socket/SerialSocket.h b/plugin/serial_socket/SerialSocket.h index 5b1cdb43..f454823a 100644 --- a/plugin/serial_socket/SerialSocket.h +++ b/plugin/serial_socket/SerialSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" diff --git a/plugin/serial_socket/SerialSocketConfigWidget.cpp b/plugin/serial_socket/SerialSocketConfigWidget.cpp index b067404c..98ed7a0d 100644 --- a/plugin/serial_socket/SerialSocketConfigWidget.cpp +++ b/plugin/serial_socket/SerialSocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -57,8 +57,7 @@ const int NumOfStopBitValues = QSerialPort::Parity mapParityFromIdx(int idx) { if ((idx < 0) || (NumOfParityValues <= idx)) { - static constexpr bool Invalid_index = false; - static_cast(Invalid_index); + [[maybe_unused]] static constexpr bool Invalid_index = false; assert(Invalid_index); return ParityMap[0]; } @@ -70,8 +69,7 @@ int mapParityToIdx(QSerialPort::Parity value) { auto iter = std::find(std::begin(ParityMap), std::end(ParityMap), value); if (iter == std::end(ParityMap)) { - static constexpr bool Invalid_value = false; - static_cast(Invalid_value); + [[maybe_unused]] static constexpr bool Invalid_value = false; assert(Invalid_value); return 0; } @@ -82,8 +80,7 @@ int mapParityToIdx(QSerialPort::Parity value) QSerialPort::StopBits mapStopBitsFromIdx(int idx) { if ((idx < 0) || (NumOfStopBitValues <= idx)) { - static constexpr bool Invalid_index = false; - static_cast(Invalid_index); + [[maybe_unused]] static constexpr bool Invalid_index = false; assert(Invalid_index); return StopBitMap[0]; } @@ -95,8 +92,7 @@ int mapStopBitToIdx(QSerialPort::StopBits value) { auto iter = std::find(std::begin(StopBitMap), std::end(StopBitMap), value); if (iter == std::end(StopBitMap)) { - static constexpr bool Invalid_value = false; - static_cast(Invalid_value); + [[maybe_unused]] static constexpr bool Invalid_value = false; assert(Invalid_value); return 0; } diff --git a/plugin/serial_socket/SerialSocketConfigWidget.h b/plugin/serial_socket/SerialSocketConfigWidget.h index 299f9a2a..8fa5d3b2 100644 --- a/plugin/serial_socket/SerialSocketConfigWidget.h +++ b/plugin/serial_socket/SerialSocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,11 +18,7 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "SerialSocket.h" #include "ui_SerialSocketConfigWidget.h" diff --git a/plugin/serial_socket/SerialSocketPlugin.cpp b/plugin/serial_socket/SerialSocketPlugin.cpp index 3c70393c..55ac2750 100644 --- a/plugin/serial_socket/SerialSocketPlugin.cpp +++ b/plugin/serial_socket/SerialSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/serial_socket/SerialSocketPlugin.h b/plugin/serial_socket/SerialSocketPlugin.h index 495ce768..8abcc55d 100644 --- a/plugin/serial_socket/SerialSocketPlugin.h +++ b/plugin/serial_socket/SerialSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify diff --git a/plugin/serial_socket/serial_socket.json b/plugin/serial_socket/serial_socket.json index 9b4c0dbe..86834983 100644 --- a/plugin/serial_socket/serial_socket.json +++ b/plugin/serial_socket/serial_socket.json @@ -1,5 +1,5 @@ { - "name" : "Serial Socket", + "name" : "CC Serial Socket", "desc" : [ "I/O socket that allows communication via local serial port." ], diff --git a/plugin/ssl_socket/client/CMakeLists.txt b/plugin/ssl_socket/client/CMakeLists.txt index 265dcbf6..0553acad 100644 --- a/plugin/ssl_socket/client/CMakeLists.txt +++ b/plugin/ssl_socket/client/CMakeLists.txt @@ -1,6 +1,12 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_SSL_CLIENT_SOCKET) + return() +endif () + +###################################################################### + function (plugin_ssl_client_socket) - set (name "ssl_client_socket") + set (name "cc_tools_plugin_ssl_client_socket") if (NOT TARGET Qt::Network) message(WARNING "Can NOT build ${name} due to missing Qt::Network library") @@ -13,21 +19,21 @@ function (plugin_ssl_client_socket) set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SslSocketPlugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SslClientSocketPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - SslSocket.cpp - SslSocketPlugin.cpp - SslSocketConfigWidget.cpp + SslClientSocket.cpp + SslClientSocketPlugin.cpp + SslClientSocketConfigWidget.cpp ) set (hdr - SslSocket.h - SslSocketPlugin.h - SslSocketConfigWidget.h + SslClientSocket.h + SslClientSocketPlugin.h + SslClientSocketConfigWidget.h ) cc_qt_wrap_cpp( @@ -37,17 +43,15 @@ function (plugin_ssl_client_socket) cc_qt_wrap_ui( ui - SslSocketConfigWidget.ui + SslClientSocketConfigWidget.ui ) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Network Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/ssl_socket/client/SslSocket.cpp b/plugin/ssl_socket/client/SslClientSocket.cpp similarity index 84% rename from plugin/ssl_socket/client/SslSocket.cpp rename to plugin/ssl_socket/client/SslClientSocket.cpp index 290c7361..e14cf25b 100644 --- a/plugin/ssl_socket/client/SslSocket.cpp +++ b/plugin/ssl_socket/client/SslClientSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,14 +17,10 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() -#include "SslSocket.h" +#include "SslClientSocket.h" namespace cc_tools_qt { @@ -32,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - namespace { @@ -47,36 +37,35 @@ const QString ToPropName("ssl.to"); } // namespace -SslSocket::SslSocket() +SslClientSocket::SslClientSocket() { connect( &m_socket, &QSslSocket::disconnected, - this, &SslSocket::socketDisconnected); + this, &SslClientSocket::socketDisconnected); connect( &m_socket, &QSslSocket::readyRead, - this, &SslSocket::readFromSocket); + this, &SslClientSocket::readFromSocket); connect( &m_socket, &QSslSocket::errorOccurred, - this, &SslSocket::socketErrorOccurred); + this, &SslClientSocket::socketErrorOccurred); connect( &m_socket, SIGNAL(sslErrors(const QList&)), this, SLOT(sslErrorsOccurred(const QList&))); } -SslSocket::~SslSocket() noexcept +SslClientSocket::~SslClientSocket() noexcept { m_socket.blockSignals(true); } -bool SslSocket::socketConnectImpl() +bool SslClientSocket::socketConnectImpl() { if ((m_socket.state() == QSslSocket::ConnectedState) || (m_socket.state() == QSslSocket::ConnectingState)) { - static constexpr bool Already_connected = false; - static_cast(Already_connected); + [[maybe_unused]] static constexpr bool Already_connected = false; assert(Already_connected); static const QString AlreadyConnectedError( tr("SSL Client is already connected or trying to connect.")); @@ -129,7 +118,7 @@ bool SslSocket::socketConnectImpl() return true; } -void SslSocket::socketDisconnectImpl() +void SslClientSocket::socketDisconnectImpl() { m_socket.blockSignals(true); m_socket.flush(); @@ -138,7 +127,7 @@ void SslSocket::socketDisconnectImpl() m_socket.blockSignals(false); } -void SslSocket::sendDataImpl(DataInfoPtr dataPtr) +void SslClientSocket::sendDataImpl(DataInfoPtr dataPtr) { assert(dataPtr); m_socket.write( @@ -158,12 +147,12 @@ void SslSocket::sendDataImpl(DataInfoPtr dataPtr) } -void SslSocket::socketDisconnected() +void SslClientSocket::socketDisconnected() { reportDisconnected(); } -void SslSocket::readFromSocket() +void SslClientSocket::readFromSocket() { auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -191,9 +180,8 @@ void SslSocket::readFromSocket() reportDataReceived(std::move(dataPtr)); } -void SslSocket::socketErrorOccurred(QAbstractSocket::SocketError err) +void SslClientSocket::socketErrorOccurred([[maybe_unused]] QAbstractSocket::SocketError err) { - static_cast(err); auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -204,17 +192,13 @@ void SslSocket::socketErrorOccurred(QAbstractSocket::SocketError err) } } -void SslSocket::sslErrorsOccurred(const QList& errs) +void SslClientSocket::sslErrorsOccurred(const QList& errs) { for (auto& e : errs) { reportError(e.errorString()); } } -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/SslSocket.h b/plugin/ssl_socket/client/SslClientSocket.h similarity index 93% rename from plugin/ssl_socket/client/SslSocket.h rename to plugin/ssl_socket/client/SslClientSocket.h index 56fcde7a..380d04ec 100644 --- a/plugin/ssl_socket/client/SslSocket.h +++ b/plugin/ssl_socket/client/SslClientSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,11 +19,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" @@ -34,13 +30,7 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - -class SslSocket : public QObject, +class SslClientSocket : public QObject, public cc_tools_qt::Socket { Q_OBJECT @@ -49,8 +39,8 @@ class SslSocket : public QObject, public: typedef unsigned short PortType; - SslSocket(); - ~SslSocket() noexcept; + SslClientSocket(); + ~SslClientSocket() noexcept; void setHost(const QString& value) { @@ -233,10 +223,6 @@ private slots: QSslSocket m_socket; }; -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/SslSocketConfigWidget.cpp b/plugin/ssl_socket/client/SslClientSocketConfigWidget.cpp similarity index 81% rename from plugin/ssl_socket/client/SslSocketConfigWidget.cpp rename to plugin/ssl_socket/client/SslClientSocketConfigWidget.cpp index d4852f47..dd22f294 100644 --- a/plugin/ssl_socket/client/SslSocketConfigWidget.cpp +++ b/plugin/ssl_socket/client/SslClientSocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SslSocketConfigWidget.h" +#include "SslClientSocketConfigWidget.h" #include #include @@ -31,12 +31,6 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - namespace { @@ -129,8 +123,8 @@ const KeyAlgorithmMap& keyAlgorithmMap() } // namespace -SslSocketConfigWidget::SslSocketConfigWidget( - SslSocket& socket, +SslClientSocketConfigWidget::SslClientSocketConfigWidget( + SslClientSocket& socket, QWidget* parentObj) : Base(parentObj), m_socket(socket) @@ -176,7 +170,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_hostLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::hostValueChanged); + this, &SslClientSocketConfigWidget::hostValueChanged); connect( m_ui.m_portSpinBox, SIGNAL(valueChanged(int)), @@ -184,7 +178,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_caDirLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::caDirValueChanged); + this, &SslClientSocketConfigWidget::caDirValueChanged); connect( m_ui.m_caDirToolButton, SIGNAL(clicked()), @@ -196,7 +190,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_caFileLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::caFileValueChanged); + this, &SslClientSocketConfigWidget::caFileValueChanged); connect( m_ui.m_caFileToolButton, SIGNAL(clicked()), @@ -212,7 +206,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_verifyNameLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::verifyNameValueChanged); + this, &SslClientSocketConfigWidget::verifyNameValueChanged); connect( m_ui.m_protocolComboBox, SIGNAL(currentIndexChanged(int)), @@ -220,7 +214,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_certLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::certValueChanged); + this, &SslClientSocketConfigWidget::certValueChanged); connect( m_ui.m_certToolButton, SIGNAL(clicked()), @@ -232,7 +226,7 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_privKeyLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::privKeyValueChanged); + this, &SslClientSocketConfigWidget::privKeyValueChanged); connect( m_ui.m_privKeyToolButton, SIGNAL(clicked()), @@ -248,27 +242,27 @@ SslSocketConfigWidget::SslSocketConfigWidget( connect( m_ui.m_privKeyPassLineEdit, &QLineEdit::textChanged, - this, &SslSocketConfigWidget::privKeyPassValueChanged); + this, &SslClientSocketConfigWidget::privKeyPassValueChanged); } -SslSocketConfigWidget::~SslSocketConfigWidget() noexcept = default; +SslClientSocketConfigWidget::~SslClientSocketConfigWidget() noexcept = default; -void SslSocketConfigWidget::hostValueChanged(const QString& value) +void SslClientSocketConfigWidget::hostValueChanged(const QString& value) { m_socket.setHost(value); } -void SslSocketConfigWidget::portValueChanged(int value) +void SslClientSocketConfigWidget::portValueChanged(int value) { m_socket.setPort(static_cast(value)); } -void SslSocketConfigWidget::caDirValueChanged(const QString& value) +void SslClientSocketConfigWidget::caDirValueChanged(const QString& value) { m_socket.setCaDir(value); } -void SslSocketConfigWidget::caDirSelectClicked() +void SslClientSocketConfigWidget::caDirSelectClicked() { QString dir = QFileDialog::getExistingDirectory( @@ -282,18 +276,17 @@ void SslSocketConfigWidget::caDirSelectClicked() } } -void SslSocketConfigWidget::caDirFormatIndexChanged(int value) +void SslClientSocketConfigWidget::caDirFormatIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setCaDirFormat(static_cast(m_ui.m_caDirFormatComboBox->currentData().toInt())); } -void SslSocketConfigWidget::caFileValueChanged(const QString& value) +void SslClientSocketConfigWidget::caFileValueChanged(const QString& value) { m_socket.setCaFile(value); } -void SslSocketConfigWidget::caFileSelectClicked() +void SslClientSocketConfigWidget::caFileSelectClicked() { QString file = QFileDialog::getOpenFileName( @@ -306,35 +299,32 @@ void SslSocketConfigWidget::caFileSelectClicked() } } -void SslSocketConfigWidget::caFileFormatIndexChanged(int value) +void SslClientSocketConfigWidget::caFileFormatIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setCaFileFormat(static_cast(m_ui.m_caFileFormatComboBox->currentData().toInt())); } -void SslSocketConfigWidget::verifyHostIndexChanged(int value) +void SslClientSocketConfigWidget::verifyHostIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setVerifyMode(static_cast(m_ui.m_verifyHostComboBox->currentData().toInt())); } -void SslSocketConfigWidget::verifyNameValueChanged(const QString& value) +void SslClientSocketConfigWidget::verifyNameValueChanged(const QString& value) { m_socket.setVerifyName(value); } -void SslSocketConfigWidget::sslProtocolIndexChanged(int value) +void SslClientSocketConfigWidget::sslProtocolIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setSslProtocol(static_cast(m_ui.m_protocolComboBox->currentData().toInt())); } -void SslSocketConfigWidget::certValueChanged(const QString& value) +void SslClientSocketConfigWidget::certValueChanged(const QString& value) { m_socket.setCertFile(value); } -void SslSocketConfigWidget::certSelectClicked() +void SslClientSocketConfigWidget::certSelectClicked() { QString file = QFileDialog::getOpenFileName( @@ -347,18 +337,17 @@ void SslSocketConfigWidget::certSelectClicked() } } -void SslSocketConfigWidget::certFormatIndexChanged(int value) +void SslClientSocketConfigWidget::certFormatIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setCertFormat(static_cast(m_ui.m_certFormatComboBox->currentData().toInt())); } -void SslSocketConfigWidget::privKeyValueChanged(const QString& value) +void SslClientSocketConfigWidget::privKeyValueChanged(const QString& value) { m_socket.setPrivKeyFile(value); } -void SslSocketConfigWidget::privKeySelectClicked() +void SslClientSocketConfigWidget::privKeySelectClicked() { QString file = QFileDialog::getOpenFileName( @@ -371,27 +360,21 @@ void SslSocketConfigWidget::privKeySelectClicked() } } -void SslSocketConfigWidget::privKeyAlgIndexChanged(int value) +void SslClientSocketConfigWidget::privKeyAlgIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setPrivKeyAlg(static_cast(m_ui.m_privKeyAlgComboBox->currentData().toInt())); } -void SslSocketConfigWidget::privKeyFormatIndexChanged(int value) +void SslClientSocketConfigWidget::privKeyFormatIndexChanged([[maybe_unused]] int value) { - static_cast(value); m_socket.setPrivKeyFormat(static_cast(m_ui.m_privKeyFormatComboBox->currentData().toInt())); } -void SslSocketConfigWidget::privKeyPassValueChanged(const QString& value) +void SslClientSocketConfigWidget::privKeyPassValueChanged(const QString& value) { m_socket.setPrivKeyPass(value); } -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/SslSocketConfigWidget.h b/plugin/ssl_socket/client/SslClientSocketConfigWidget.h similarity index 77% rename from plugin/ssl_socket/client/SslSocketConfigWidget.h rename to plugin/ssl_socket/client/SslClientSocketConfigWidget.h index e76b837c..1a4954a5 100644 --- a/plugin/ssl_socket/client/SslSocketConfigWidget.h +++ b/plugin/ssl_socket/client/SslClientSocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2023 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2023 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -#include "ui_SslSocketConfigWidget.h" -CC_ENABLE_WARNINGS() +#include "ui_SslClientSocketConfigWidget.h" -#include "SslSocket.h" +#include "SslClientSocket.h" namespace cc_tools_qt { @@ -33,24 +29,18 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - -class SslSocketConfigWidget : public QWidget +class SslClientSocketConfigWidget : public QWidget { Q_OBJECT typedef QWidget Base; public: - typedef SslSocket::PortType PortType; + typedef SslClientSocket::PortType PortType; - explicit SslSocketConfigWidget( - SslSocket& socket, + explicit SslClientSocketConfigWidget( + SslClientSocket& socket, QWidget* parentObj = nullptr); - ~SslSocketConfigWidget() noexcept; + ~SslClientSocketConfigWidget() noexcept; private slots: void hostValueChanged(const QString& value); @@ -74,14 +64,10 @@ private slots: void privKeyPassValueChanged(const QString& value); private: - SslSocket& m_socket; + SslClientSocket& m_socket; Ui::SslClientSocketConfigWidget m_ui; }; -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/SslSocketConfigWidget.ui b/plugin/ssl_socket/client/SslClientSocketConfigWidget.ui similarity index 100% rename from plugin/ssl_socket/client/SslSocketConfigWidget.ui rename to plugin/ssl_socket/client/SslClientSocketConfigWidget.ui diff --git a/plugin/ssl_socket/client/SslSocketPlugin.cpp b/plugin/ssl_socket/client/SslClientSocketPlugin.cpp similarity index 91% rename from plugin/ssl_socket/client/SslSocketPlugin.cpp rename to plugin/ssl_socket/client/SslClientSocketPlugin.cpp index 2a75d74f..53478c03 100644 --- a/plugin/ssl_socket/client/SslSocketPlugin.cpp +++ b/plugin/ssl_socket/client/SslClientSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,12 +15,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SslSocketPlugin.h" +#include "SslClientSocketPlugin.h" #include #include -#include "SslSocketConfigWidget.h" +#include "SslClientSocketConfigWidget.h" namespace cc_tools_qt { @@ -28,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - namespace { @@ -56,7 +50,7 @@ const QString PrivFormatSubKey("priv_format"); } // namespace -SslSocketPlugin::SslSocketPlugin() +SslClientSocketPlugin::SslClientSocketPlugin() { pluginProperties() .setSocketCreateFunc( @@ -69,13 +63,13 @@ SslSocketPlugin::SslSocketPlugin() [this]() { createSocketIfNeeded(); - return new SslSocketConfigWidget(*m_socket); + return new SslClientSocketConfigWidget(*m_socket); }); } -SslSocketPlugin::~SslSocketPlugin() noexcept = default; +SslClientSocketPlugin::~SslClientSocketPlugin() noexcept = default; -void SslSocketPlugin::getCurrentConfigImpl(QVariantMap& config) +void SslClientSocketPlugin::getCurrentConfigImpl(QVariantMap& config) { createSocketIfNeeded(); @@ -97,7 +91,7 @@ void SslSocketPlugin::getCurrentConfigImpl(QVariantMap& config) config.insert(MainConfigKey, QVariant::fromValue(subConfig)); } -void SslSocketPlugin::reconfigureImpl(const QVariantMap& config) +void SslClientSocketPlugin::reconfigureImpl(const QVariantMap& config) { auto subConfigVar = config.value(MainConfigKey); if ((!subConfigVar.isValid()) || (!subConfigVar.canConvert())) { @@ -114,7 +108,7 @@ void SslSocketPlugin::reconfigureImpl(const QVariantMap& config) m_socket->setHost(host); } - typedef SslSocket::PortType PortType; + typedef SslClientSocket::PortType PortType; auto portVar = subConfig.value(PortSubKey); if (portVar.isValid() && portVar.canConvert()) { auto port = portVar.value(); @@ -194,17 +188,13 @@ void SslSocketPlugin::reconfigureImpl(const QVariantMap& config) } } -void SslSocketPlugin::createSocketIfNeeded() +void SslClientSocketPlugin::createSocketIfNeeded() { if (!m_socket) { - m_socket.reset(new SslSocket()); + m_socket.reset(new SslClientSocket()); } } -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/SslSocketPlugin.h b/plugin/ssl_socket/client/SslClientSocketPlugin.h similarity index 77% rename from plugin/ssl_socket/client/SslSocketPlugin.h rename to plugin/ssl_socket/client/SslClientSocketPlugin.h index 329640a4..19b3bac8 100644 --- a/plugin/ssl_socket/client/SslSocketPlugin.h +++ b/plugin/ssl_socket/client/SslClientSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "cc_tools_qt/Plugin.h" -#include "SslSocket.h" +#include "SslClientSocket.h" namespace cc_tools_qt { @@ -30,21 +30,15 @@ namespace cc_tools_qt namespace plugin { -namespace ssl_socket -{ - -namespace client -{ - -class SslSocketPlugin : public cc_tools_qt::Plugin +class SslClientSocketPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.SslClientSocketPlugin" FILE "ssl_client_socket.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - SslSocketPlugin(); - ~SslSocketPlugin() noexcept; + SslClientSocketPlugin(); + ~SslClientSocketPlugin() noexcept; virtual void getCurrentConfigImpl(QVariantMap& config) override; virtual void reconfigureImpl(const QVariantMap& config) override; @@ -53,13 +47,9 @@ class SslSocketPlugin : public cc_tools_qt::Plugin void createSocketIfNeeded(); - std::shared_ptr m_socket; + std::shared_ptr m_socket; }; -} // namespace client - -} // namespace ssl_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/ssl_socket/client/ssl_client_socket.json b/plugin/ssl_socket/client/ssl_client_socket.json index 6c16a74f..c9045fab 100644 --- a/plugin/ssl_socket/client/ssl_client_socket.json +++ b/plugin/ssl_socket/client/ssl_client_socket.json @@ -1,5 +1,5 @@ { - "name" : "SSL Client Socket", + "name" : "CC SSL Client Socket", "desc" : [ "Network socket that allows encrypted connection and/or remote host verification." ], diff --git a/plugin/tcp_socket/client/CMakeLists.txt b/plugin/tcp_socket/client/CMakeLists.txt index 582653db..66488f5e 100644 --- a/plugin/tcp_socket/client/CMakeLists.txt +++ b/plugin/tcp_socket/client/CMakeLists.txt @@ -1,6 +1,12 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_TCP_CLIENT_SOCKET) + return() +endif () + +###################################################################### + function (plugin_tcp_client_socket) - set (name "tcp_client_socket") + set (name "cc_tools_plugin_tcp_client_socket") if (NOT TARGET Qt::Network) message(WARNING "Can NOT build ${name} due to missing Qt::Network library") @@ -13,21 +19,21 @@ function (plugin_tcp_client_socket) set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SocketPlugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/TcpClientSocketPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - Socket.cpp - SocketPlugin.cpp - SocketConfigWidget.cpp + TcpClientSocket.cpp + TcpClientSocketPlugin.cpp + TcpClientSocketConfigWidget.cpp ) set (hdr - Socket.h - SocketPlugin.h - SocketConfigWidget.h + TcpClientSocket.h + TcpClientSocketPlugin.h + TcpClientSocketConfigWidget.h ) cc_qt_wrap_cpp( @@ -37,17 +43,15 @@ function (plugin_tcp_client_socket) cc_qt_wrap_ui( ui - SocketConfigWidget.ui + TcpClientSocketConfigWidget.ui ) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Network Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/tcp_socket/client/Socket.cpp b/plugin/tcp_socket/client/TcpClientSocket.cpp similarity index 83% rename from plugin/tcp_socket/client/Socket.cpp rename to plugin/tcp_socket/client/TcpClientSocket.cpp index 1dcb9dc0..ca738602 100644 --- a/plugin/tcp_socket/client/Socket.cpp +++ b/plugin/tcp_socket/client/TcpClientSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,14 +17,10 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() -#include "Socket.h" +#include "TcpClientSocket.h" namespace cc_tools_qt { @@ -32,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - namespace { @@ -47,19 +37,19 @@ const QString ToPropName("tcp.to"); } // namespace -Socket::Socket() +TcpClientSocket::TcpClientSocket() { connect( &m_socket, &QTcpSocket::disconnected, - this, &Socket::socketDisconnected); + this, &TcpClientSocket::socketDisconnected); connect( &m_socket, &QTcpSocket::readyRead, - this, &Socket::readFromSocket); + this, &TcpClientSocket::readFromSocket); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( &m_socket, &QTcpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &TcpClientSocket::socketErrorOccurred); #else // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( &m_socket, SIGNAL(error(QAbstractSocket::SocketError)), @@ -67,17 +57,16 @@ Socket::Socket() #endif } -Socket::~Socket() noexcept +TcpClientSocket::~TcpClientSocket() noexcept { m_socket.blockSignals(true); } -bool Socket::socketConnectImpl() +bool TcpClientSocket::socketConnectImpl() { if ((m_socket.state() == QTcpSocket::ConnectedState) || (m_socket.state() == QTcpSocket::ConnectingState)) { - static constexpr bool Already_connected = false; - static_cast(Already_connected); + [[maybe_unused]] static constexpr bool Already_connected = false; assert(Already_connected); static const QString AlreadyConnectedError( tr("TCP/IP Client is already connected or trying to connect.")); @@ -96,7 +85,7 @@ bool Socket::socketConnectImpl() return true; } -void Socket::socketDisconnectImpl() +void TcpClientSocket::socketDisconnectImpl() { m_socket.blockSignals(true); m_socket.flush(); @@ -105,7 +94,7 @@ void Socket::socketDisconnectImpl() m_socket.blockSignals(false); } -void Socket::sendDataImpl(DataInfoPtr dataPtr) +void TcpClientSocket::sendDataImpl(DataInfoPtr dataPtr) { assert(dataPtr); m_socket.write( @@ -125,7 +114,7 @@ void Socket::sendDataImpl(DataInfoPtr dataPtr) } -void Socket::socketDisconnected() +void TcpClientSocket::socketDisconnected() { // static const QString DisconnectedError( // tr("Connection to TCP/IP Server was disconnected.")); @@ -134,7 +123,7 @@ void Socket::socketDisconnected() reportDisconnected(); } -void Socket::readFromSocket() +void TcpClientSocket::readFromSocket() { auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -162,9 +151,8 @@ void Socket::readFromSocket() reportDataReceived(std::move(dataPtr)); } -void Socket::socketErrorOccurred(QAbstractSocket::SocketError err) +void TcpClientSocket::socketErrorOccurred([[maybe_unused]] QAbstractSocket::SocketError err) { - static_cast(err); auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -175,10 +163,6 @@ void Socket::socketErrorOccurred(QAbstractSocket::SocketError err) } } -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/Socket.h b/plugin/tcp_socket/client/TcpClientSocket.h similarity index 82% rename from plugin/tcp_socket/client/Socket.h rename to plugin/tcp_socket/client/TcpClientSocket.h index 53b57efa..a56869ec 100644 --- a/plugin/tcp_socket/client/Socket.h +++ b/plugin/tcp_socket/client/TcpClientSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,11 +19,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" @@ -34,14 +30,7 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - -class Socket : public QObject, - public cc_tools_qt::Socket +class TcpClientSocket : public QObject, public cc_tools_qt::Socket { Q_OBJECT using Base = cc_tools_qt::Socket; @@ -49,8 +38,8 @@ class Socket : public QObject, public: typedef unsigned short PortType; - Socket(); - ~Socket() noexcept; + TcpClientSocket(); + ~TcpClientSocket() noexcept; void setHost(const QString& value) { @@ -90,10 +79,6 @@ private slots: QTcpSocket m_socket; }; -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/SocketConfigWidget.cpp b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.cpp similarity index 77% rename from plugin/tcp_socket/client/SocketConfigWidget.cpp rename to plugin/tcp_socket/client/TcpClientSocketConfigWidget.cpp index a480534a..3f0fa123 100644 --- a/plugin/tcp_socket/client/SocketConfigWidget.cpp +++ b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketConfigWidget.h" +#include "TcpClientSocketConfigWidget.h" #include @@ -25,14 +25,8 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - -SocketConfigWidget::SocketConfigWidget( - Socket& socket, +TcpClientSocketConfigWidget::TcpClientSocketConfigWidget( + TcpClientSocket& socket, QWidget* parentObj) : Base(parentObj), m_socket(socket) @@ -57,22 +51,18 @@ SocketConfigWidget::SocketConfigWidget( this, SLOT(portValueChanged(int))); } -SocketConfigWidget::~SocketConfigWidget() noexcept = default; +TcpClientSocketConfigWidget::~TcpClientSocketConfigWidget() noexcept = default; -void SocketConfigWidget::hostValueChanged(const QString& value) +void TcpClientSocketConfigWidget::hostValueChanged(const QString& value) { m_socket.setHost(value); } -void SocketConfigWidget::portValueChanged(int value) +void TcpClientSocketConfigWidget::portValueChanged(int value) { m_socket.setPort(static_cast(value)); } -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/SocketConfigWidget.h b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.h similarity index 65% rename from plugin/tcp_socket/client/SocketConfigWidget.h rename to plugin/tcp_socket/client/TcpClientSocketConfigWidget.h index 7590eb4f..8acbe487 100644 --- a/plugin/tcp_socket/client/SocketConfigWidget.h +++ b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -#include "ui_SocketConfigWidget.h" -CC_ENABLE_WARNINGS() +#include "ui_TcpClientSocketConfigWidget.h" -#include "Socket.h" +#include "TcpClientSocket.h" namespace cc_tools_qt { @@ -33,38 +29,28 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - -class SocketConfigWidget : public QWidget +class TcpClientSocketConfigWidget : public QWidget { Q_OBJECT typedef QWidget Base; public: - typedef Socket::PortType PortType; + typedef TcpClientSocket::PortType PortType; - explicit SocketConfigWidget( - Socket& socket, + explicit TcpClientSocketConfigWidget( + TcpClientSocket& socket, QWidget* parentObj = nullptr); - ~SocketConfigWidget() noexcept; + ~TcpClientSocketConfigWidget() noexcept; private slots: void hostValueChanged(const QString& value); void portValueChanged(int value); private: - Socket& m_socket; - Ui::ClientSocketConfigWidget m_ui; + TcpClientSocket& m_socket; + Ui::TcpClientSocketConfigWidget m_ui; }; -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/SocketConfigWidget.ui b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.ui similarity index 95% rename from plugin/tcp_socket/client/SocketConfigWidget.ui rename to plugin/tcp_socket/client/TcpClientSocketConfigWidget.ui index 7610af9d..ccd77799 100644 --- a/plugin/tcp_socket/client/SocketConfigWidget.ui +++ b/plugin/tcp_socket/client/TcpClientSocketConfigWidget.ui @@ -1,7 +1,7 @@ - ClientSocketConfigWidget - + TcpClientSocketConfigWidget + 0 diff --git a/plugin/tcp_socket/client/SocketPlugin.cpp b/plugin/tcp_socket/client/TcpClientSocketPlugin.cpp similarity index 78% rename from plugin/tcp_socket/client/SocketPlugin.cpp rename to plugin/tcp_socket/client/TcpClientSocketPlugin.cpp index e9c85753..ae194c67 100644 --- a/plugin/tcp_socket/client/SocketPlugin.cpp +++ b/plugin/tcp_socket/client/TcpClientSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,12 +15,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketPlugin.h" +#include "TcpClientSocketPlugin.h" #include #include -#include "SocketConfigWidget.h" +#include "TcpClientSocketConfigWidget.h" namespace cc_tools_qt { @@ -28,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - namespace { @@ -43,7 +37,7 @@ const QString PortSubKey("port"); } // namespace -SocketPlugin::SocketPlugin() +TcpClientSocketPlugin::TcpClientSocketPlugin() { pluginProperties() .setSocketCreateFunc( @@ -56,13 +50,13 @@ SocketPlugin::SocketPlugin() [this]() { createSocketIfNeeded(); - return new SocketConfigWidget(*m_socket); + return new TcpClientSocketConfigWidget(*m_socket); }); } -SocketPlugin::~SocketPlugin() noexcept = default; +TcpClientSocketPlugin::~TcpClientSocketPlugin() noexcept = default; -void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) +void TcpClientSocketPlugin::getCurrentConfigImpl(QVariantMap& config) { createSocketIfNeeded(); @@ -72,7 +66,7 @@ void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) config.insert(MainConfigKey, QVariant::fromValue(subConfig)); } -void SocketPlugin::reconfigureImpl(const QVariantMap& config) +void TcpClientSocketPlugin::reconfigureImpl(const QVariantMap& config) { auto subConfigVar = config.value(MainConfigKey); if ((!subConfigVar.isValid()) || (!subConfigVar.canConvert())) { @@ -89,7 +83,7 @@ void SocketPlugin::reconfigureImpl(const QVariantMap& config) m_socket->setHost(host); } - typedef Socket::PortType PortType; + typedef TcpClientSocket::PortType PortType; auto portVar = subConfig.value(PortSubKey); if (portVar.isValid() && portVar.canConvert()) { auto port = portVar.value(); @@ -97,17 +91,13 @@ void SocketPlugin::reconfigureImpl(const QVariantMap& config) } } -void SocketPlugin::createSocketIfNeeded() +void TcpClientSocketPlugin::createSocketIfNeeded() { if (!m_socket) { - m_socket.reset(new Socket()); + m_socket.reset(new TcpClientSocket()); } } -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/SocketPlugin.h b/plugin/tcp_socket/client/TcpClientSocketPlugin.h similarity index 78% rename from plugin/tcp_socket/client/SocketPlugin.h rename to plugin/tcp_socket/client/TcpClientSocketPlugin.h index 426d684c..7dd283b8 100644 --- a/plugin/tcp_socket/client/SocketPlugin.h +++ b/plugin/tcp_socket/client/TcpClientSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "cc_tools_qt/Plugin.h" -#include "Socket.h" +#include "TcpClientSocket.h" namespace cc_tools_qt { @@ -30,21 +30,15 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace client -{ - -class SocketPlugin : public cc_tools_qt::Plugin +class TcpClientSocketPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.TcpClientSocketPlugin" FILE "tcp_client_socket.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - SocketPlugin(); - ~SocketPlugin() noexcept; + TcpClientSocketPlugin(); + ~TcpClientSocketPlugin() noexcept; virtual void getCurrentConfigImpl(QVariantMap& config) override; virtual void reconfigureImpl(const QVariantMap& config) override; @@ -53,13 +47,9 @@ class SocketPlugin : public cc_tools_qt::Plugin void createSocketIfNeeded(); - std::shared_ptr m_socket; + std::shared_ptr m_socket; }; -} // namespace client - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/client/tcp_client_socket.json b/plugin/tcp_socket/client/tcp_client_socket.json index c965e9a6..4508cf75 100644 --- a/plugin/tcp_socket/client/tcp_client_socket.json +++ b/plugin/tcp_socket/client/tcp_client_socket.json @@ -1,5 +1,5 @@ { - "name" : "TCP/IP Client Socket", + "name" : "CC TCP/IP Client Socket", "desc" : [ "I/O socket that connects a remote tcp port and allows\n", "communication via TCP/IP connection." diff --git a/plugin/tcp_socket/proxy/CMakeLists.txt b/plugin/tcp_socket/proxy/CMakeLists.txt index d9f3a72e..6d72e98f 100644 --- a/plugin/tcp_socket/proxy/CMakeLists.txt +++ b/plugin/tcp_socket/proxy/CMakeLists.txt @@ -1,5 +1,11 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_TCP_PROXY_SOCKET) + return() +endif () + +###################################################################### + function (plugin_tcp_proxy_socket) - set (name "tcp_proxy_socket") + set (name "cc_tools_plugin_tcp_proxy_socket") if (NOT TARGET Qt::Network) message(WARNING "Can NOT build ${name} due to missing Qt::Network library") @@ -12,21 +18,21 @@ function (plugin_tcp_proxy_socket) set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SocketPlugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/TcpProxySocketPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - Socket.cpp - SocketPlugin.cpp - SocketConfigWidget.cpp + TcpProxySocket.cpp + TcpProxySocketPlugin.cpp + TcpProxySocketConfigWidget.cpp ) set (hdr - Socket.h - SocketPlugin.h - SocketConfigWidget.h + TcpProxySocket.h + TcpProxySocketPlugin.h + TcpProxySocketConfigWidget.h ) cc_qt_wrap_cpp( @@ -36,18 +42,16 @@ function (plugin_tcp_proxy_socket) cc_qt_wrap_ui( ui - SocketConfigWidget.ui + TcpProxySocketConfigWidget.ui ) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Network Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/tcp_socket/proxy/Socket.cpp b/plugin/tcp_socket/proxy/TcpProxySocket.cpp similarity index 82% rename from plugin/tcp_socket/proxy/Socket.cpp rename to plugin/tcp_socket/proxy/TcpProxySocket.cpp index 28dec7c9..20529a7e 100644 --- a/plugin/tcp_socket/proxy/Socket.cpp +++ b/plugin/tcp_socket/proxy/TcpProxySocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,14 +17,10 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() -#include "Socket.h" +#include "TcpProxySocket.h" namespace cc_tools_qt { @@ -32,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - namespace { @@ -46,29 +36,28 @@ const QString ToPropName("tcp.to"); } // namespace -Socket::Socket() +TcpProxySocket::TcpProxySocket() { QObject::connect( &m_server, &QTcpServer::newConnection, - this, &Socket::newConnection); + this, &TcpProxySocket::newConnection); QObject::connect( &m_server, &QTcpServer::acceptError, - this, &Socket::socketErrorOccurred); + this, &TcpProxySocket::socketErrorOccurred); } -Socket::~Socket() noexcept +TcpProxySocket::~TcpProxySocket() noexcept { while (!m_sockets.empty()) { removeConnection(m_sockets.begin()); } } -bool Socket::socketConnectImpl() +bool TcpProxySocket::socketConnectImpl() { if (m_server.isListening()) { - static constexpr bool Already_listening = false; - static_cast(Already_listening); + [[maybe_unused]] static constexpr bool Already_listening = false; assert(Already_listening); static const QString AlreadyListeningError( tr("Previous run of TCP/IP Server socket wasn't terminated properly.")); @@ -103,12 +92,12 @@ bool Socket::socketConnectImpl() return true; } -void Socket::socketDisconnectImpl() +void TcpProxySocket::socketDisconnectImpl() { m_server.close(); } -void Socket::sendDataImpl(DataInfoPtr dataPtr) +void TcpProxySocket::sendDataImpl(DataInfoPtr dataPtr) { assert(dataPtr); QVariantList toList; @@ -138,22 +127,22 @@ void Socket::sendDataImpl(DataInfoPtr dataPtr) dataPtr->m_extraProperties.insert(ToPropName, toList); } -unsigned Socket::connectionPropertiesImpl() const +unsigned TcpProxySocket::connectionPropertiesImpl() const { return ConnectionProperty_Autoconnect; } -void Socket::newConnection() +void TcpProxySocket::newConnection() { auto *newConnSocket = m_server.nextPendingConnection(); connect( newConnSocket, &QTcpSocket::disconnected, - this, &Socket::clientConnectionTerminated); + this, &TcpProxySocket::clientConnectionTerminated); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( newConnSocket, &QTcpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &TcpProxySocket::socketErrorOccurred); #else // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( newConnSocket, SIGNAL(error(QAbstractSocket::SocketError)), @@ -163,18 +152,18 @@ void Socket::newConnection() ConnectionSocketPtr connectionSocket(new QTcpSocket); connect( connectionSocket.get(), &QTcpSocket::connected, - this, &Socket::connectionSocketConnected); + this, &TcpProxySocket::connectionSocketConnected); connect( connectionSocket.get(), &QTcpSocket::disconnected, - this, &Socket::connectionSocketDisconnected); + this, &TcpProxySocket::connectionSocketDisconnected); connect( connectionSocket.get(), &QTcpSocket::readyRead, - this, &Socket::readFromConnectionSocket); + this, &TcpProxySocket::readFromConnectionSocket); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( connectionSocket.get(), &QTcpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &TcpProxySocket::socketErrorOccurred); #else // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( connectionSocket.get(), SIGNAL(error(QAbstractSocket::SocketError)), @@ -189,12 +178,11 @@ void Socket::newConnection() m_sockets.emplace_back(newConnSocket, std::move(connectionSocket)); } -void Socket::clientConnectionTerminated() +void TcpProxySocket::clientConnectionTerminated() { auto* socket = qobject_cast(sender()); if (socket == nullptr) { - static constexpr bool Signal_from_unknown_object = false; - static_cast(Signal_from_unknown_object); + [[maybe_unused]] static constexpr bool Signal_from_unknown_object = false; assert(Signal_from_unknown_object); return; } @@ -212,7 +200,7 @@ void Socket::clientConnectionTerminated() socket->deleteLater(); } -void Socket::readFromClientSocket() +void TcpProxySocket::readFromClientSocket() { auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -225,35 +213,32 @@ void Socket::readFromClientSocket() performReadWrite(*socket, connectionSocket); } -void Socket::socketErrorOccurred(QAbstractSocket::SocketError err) +void TcpProxySocket::socketErrorOccurred(QAbstractSocket::SocketError err) { if (err == QAbstractSocket::RemoteHostClosedError) { // Ignore remote client disconnection return; } - static_cast(err); auto* socket = qobject_cast(sender()); assert(socket != nullptr); reportError(socket->errorString()); } -void Socket::acceptErrorOccurred(QAbstractSocket::SocketError err) +void TcpProxySocket::acceptErrorOccurred([[maybe_unused]] QAbstractSocket::SocketError err) { - static_cast(err); reportError(m_server.errorString()); if (!m_server.isListening()) { reportDisconnected(); } } -void Socket::connectionSocketConnected() +void TcpProxySocket::connectionSocketConnected() { auto* socket = qobject_cast(sender()); if (socket == nullptr) { - static constexpr bool Signal_from_unknown_object = false; - static_cast(Signal_from_unknown_object); + [[maybe_unused]] static constexpr bool Signal_from_unknown_object = false; assert(Signal_from_unknown_object); return; } @@ -272,12 +257,11 @@ void Socket::connectionSocketConnected() } } -void Socket::connectionSocketDisconnected() +void TcpProxySocket::connectionSocketDisconnected() { auto* socket = qobject_cast(sender()); if (socket == nullptr) { - static constexpr bool Signal_from_unknown_object = false; - static_cast(Signal_from_unknown_object); + [[maybe_unused]] static constexpr bool Signal_from_unknown_object = false; assert(Signal_from_unknown_object); return; } @@ -298,7 +282,7 @@ void Socket::connectionSocketDisconnected() m_sockets.erase(iter); } -void Socket::readFromConnectionSocket() +void TcpProxySocket::readFromConnectionSocket() { auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -310,7 +294,7 @@ void Socket::readFromConnectionSocket() performReadWrite(*socket, clientSocket); } -Socket::SocketsList::iterator Socket::findByClient(QTcpSocket* socket) +TcpProxySocket::SocketsList::iterator TcpProxySocket::findByClient(QTcpSocket* socket) { return std::find_if( m_sockets.begin(), m_sockets.end(), @@ -320,7 +304,7 @@ Socket::SocketsList::iterator Socket::findByClient(QTcpSocket* socket) }); } -Socket::SocketsList::iterator Socket::findByConnection(QTcpSocket* socket) +TcpProxySocket::SocketsList::iterator TcpProxySocket::findByConnection(QTcpSocket* socket) { return std::find_if( m_sockets.begin(), m_sockets.end(), @@ -331,7 +315,7 @@ Socket::SocketsList::iterator Socket::findByConnection(QTcpSocket* socket) } -void Socket::removeConnection(SocketsList::iterator iter) +void TcpProxySocket::removeConnection(SocketsList::iterator iter) { assert(iter != m_sockets.end()); auto* clientSocket = iter->first; @@ -358,7 +342,7 @@ void Socket::removeConnection(SocketsList::iterator iter) } } -void Socket::performReadWrite(QTcpSocket& readFromSocket, QTcpSocket& writeToSocket) +void TcpProxySocket::performReadWrite(QTcpSocket& readFromSocket, QTcpSocket& writeToSocket) { if (readFromSocket.bytesAvailable() == 0) { return; @@ -393,10 +377,6 @@ void Socket::performReadWrite(QTcpSocket& readFromSocket, QTcpSocket& writeToSoc reportDataReceived(std::move(dataPtr)); } -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/Socket.h b/plugin/tcp_socket/proxy/TcpProxySocket.h similarity index 88% rename from plugin/tcp_socket/proxy/Socket.h rename to plugin/tcp_socket/proxy/TcpProxySocket.h index 20de8da7..8423e780 100644 --- a/plugin/tcp_socket/proxy/Socket.h +++ b/plugin/tcp_socket/proxy/TcpProxySocket.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" @@ -35,14 +31,7 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - -class Socket : public QObject, - public cc_tools_qt::Socket +class TcpProxySocket : public QObject, public cc_tools_qt::Socket { Q_OBJECT using Base = cc_tools_qt::Socket; @@ -50,8 +39,8 @@ class Socket : public QObject, public: typedef unsigned short PortType; - Socket(); - ~Socket() noexcept; + TcpProxySocket(); + ~TcpProxySocket() noexcept; void setPort(PortType value) { @@ -119,10 +108,6 @@ private slots: SocketsList m_sockets; }; -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/SocketConfigWidget.cpp b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.cpp similarity index 79% rename from plugin/tcp_socket/proxy/SocketConfigWidget.cpp rename to plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.cpp index a0a91a3e..216e23f3 100644 --- a/plugin/tcp_socket/proxy/SocketConfigWidget.cpp +++ b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketConfigWidget.h" +#include "TcpProxySocketConfigWidget.h" #include @@ -25,14 +25,8 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - -SocketConfigWidget::SocketConfigWidget( - Socket& socket, +TcpProxySocketConfigWidget::TcpProxySocketConfigWidget( + TcpProxySocket& socket, QWidget* parentObj) : Base(parentObj), m_socket(socket) @@ -68,27 +62,23 @@ SocketConfigWidget::SocketConfigWidget( this, SLOT(remotePortValueChanged(int))); } -SocketConfigWidget::~SocketConfigWidget() noexcept = default; +TcpProxySocketConfigWidget::~TcpProxySocketConfigWidget() noexcept = default; -void SocketConfigWidget::localPortValueChanged(int value) +void TcpProxySocketConfigWidget::localPortValueChanged(int value) { m_socket.setPort(static_cast(value)); } -void SocketConfigWidget::remoteHostValueChanged(const QString& value) +void TcpProxySocketConfigWidget::remoteHostValueChanged(const QString& value) { m_socket.setRemoteHost(value); } -void SocketConfigWidget::remotePortValueChanged(int value) +void TcpProxySocketConfigWidget::remotePortValueChanged(int value) { m_socket.setRemotePort(static_cast(value)); } -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/SocketConfigWidget.h b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.h similarity index 66% rename from plugin/tcp_socket/proxy/SocketConfigWidget.h rename to plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.h index 1df4c4bb..264b902d 100644 --- a/plugin/tcp_socket/proxy/SocketConfigWidget.h +++ b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -#include "ui_SocketConfigWidget.h" -CC_ENABLE_WARNINGS() +#include "ui_TcpProxySocketConfigWidget.h" -#include "Socket.h" +#include "TcpProxySocket.h" namespace cc_tools_qt { @@ -33,24 +29,18 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - -class SocketConfigWidget : public QWidget +class TcpProxySocketConfigWidget : public QWidget { Q_OBJECT typedef QWidget Base; public: - typedef Socket::PortType PortType; + typedef TcpProxySocket::PortType PortType; - explicit SocketConfigWidget( - Socket& socket, + explicit TcpProxySocketConfigWidget( + TcpProxySocket& socket, QWidget* parentObj = nullptr); - ~SocketConfigWidget() noexcept; + ~TcpProxySocketConfigWidget() noexcept; private slots: void localPortValueChanged(int value); @@ -58,14 +48,10 @@ private slots: void remotePortValueChanged(int value); private: - Socket& m_socket; - Ui::ProxySocketConfigWidget m_ui; + TcpProxySocket& m_socket; + Ui::TcpProxySocketConfigWidget m_ui; }; -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/SocketConfigWidget.ui b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.ui similarity index 96% rename from plugin/tcp_socket/proxy/SocketConfigWidget.ui rename to plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.ui index 7820828b..6b13bb81 100644 --- a/plugin/tcp_socket/proxy/SocketConfigWidget.ui +++ b/plugin/tcp_socket/proxy/TcpProxySocketConfigWidget.ui @@ -1,7 +1,7 @@ - ProxySocketConfigWidget - + TcpProxySocketConfigWidget + 0 diff --git a/plugin/tcp_socket/proxy/SocketPlugin.cpp b/plugin/tcp_socket/proxy/TcpProxySocketPlugin.cpp similarity index 81% rename from plugin/tcp_socket/proxy/SocketPlugin.cpp rename to plugin/tcp_socket/proxy/TcpProxySocketPlugin.cpp index d63510a3..24e05534 100644 --- a/plugin/tcp_socket/proxy/SocketPlugin.cpp +++ b/plugin/tcp_socket/proxy/TcpProxySocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketPlugin.h" +#include "TcpProxySocketPlugin.h" #include #include -#include "Socket.h" -#include "SocketConfigWidget.h" +#include "TcpProxySocket.h" +#include "TcpProxySocketConfigWidget.h" namespace cc_tools_qt { @@ -29,12 +29,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - namespace { @@ -45,7 +39,7 @@ const QString RemotePortSubKey("remote_port"); } // namespace -SocketPlugin::SocketPlugin() +TcpProxySocketPlugin::TcpProxySocketPlugin() { pluginProperties() .setSocketCreateFunc( @@ -58,13 +52,13 @@ SocketPlugin::SocketPlugin() [this]() { createSocketIfNeeded(); - return new SocketConfigWidget(*m_socket); + return new TcpProxySocketConfigWidget(*m_socket); }); } -SocketPlugin::~SocketPlugin() noexcept = default; +TcpProxySocketPlugin::~TcpProxySocketPlugin() noexcept = default; -void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) +void TcpProxySocketPlugin::getCurrentConfigImpl(QVariantMap& config) { createSocketIfNeeded(); @@ -75,14 +69,14 @@ void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) config.insert(MainConfigKey, QVariant::fromValue(subConfig)); } -void SocketPlugin::reconfigureImpl(const QVariantMap& config) +void TcpProxySocketPlugin::reconfigureImpl(const QVariantMap& config) { auto subConfigVar = config.value(MainConfigKey); if ((!subConfigVar.isValid()) || (!subConfigVar.canConvert())) { return; } - typedef Socket::PortType PortType; + typedef TcpProxySocket::PortType PortType; auto subConfig = subConfigVar.value(); auto localPortVar = subConfig.value(LocalPortSubKey); if ((!localPortVar.isValid()) || (!localPortVar.canConvert())) { @@ -110,17 +104,13 @@ void SocketPlugin::reconfigureImpl(const QVariantMap& config) m_socket->setRemotePort(remotePort); } -void SocketPlugin::createSocketIfNeeded() +void TcpProxySocketPlugin::createSocketIfNeeded() { if (!m_socket) { - m_socket.reset(new Socket()); + m_socket.reset(new TcpProxySocket()); } } -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/SocketPlugin.h b/plugin/tcp_socket/proxy/TcpProxySocketPlugin.h similarity index 78% rename from plugin/tcp_socket/proxy/SocketPlugin.h rename to plugin/tcp_socket/proxy/TcpProxySocketPlugin.h index ebbedee5..557354fe 100644 --- a/plugin/tcp_socket/proxy/SocketPlugin.h +++ b/plugin/tcp_socket/proxy/TcpProxySocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "cc_tools_qt/Plugin.h" -#include "Socket.h" +#include "TcpProxySocket.h" namespace cc_tools_qt { @@ -30,22 +30,16 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace proxy -{ - -class SocketPlugin : public cc_tools_qt::Plugin +class TcpProxySocketPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.TcpProxySocketPlugin" FILE "tcp_proxy_socket.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - SocketPlugin(); - ~SocketPlugin() noexcept; + TcpProxySocketPlugin(); + ~TcpProxySocketPlugin() noexcept; virtual void getCurrentConfigImpl(QVariantMap& config) override; virtual void reconfigureImpl(const QVariantMap& config) override; @@ -54,13 +48,9 @@ class SocketPlugin : public cc_tools_qt::Plugin void createSocketIfNeeded(); - std::shared_ptr m_socket; + std::shared_ptr m_socket; }; -} // namespace proxy - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/proxy/tcp_proxy_socket.json b/plugin/tcp_socket/proxy/tcp_proxy_socket.json index efe249d7..e37e23cb 100644 --- a/plugin/tcp_socket/proxy/tcp_proxy_socket.json +++ b/plugin/tcp_socket/proxy/tcp_proxy_socket.json @@ -1,5 +1,5 @@ { - "name" : "TCP/IP Proxy Socket", + "name" : "CC TCP/IP Proxy Socket", "desc" : [ "I/O socket that serves as proxy TCP/IP server." ], diff --git a/plugin/tcp_socket/server/CMakeLists.txt b/plugin/tcp_socket/server/CMakeLists.txt index f72559ba..78741c21 100644 --- a/plugin/tcp_socket/server/CMakeLists.txt +++ b/plugin/tcp_socket/server/CMakeLists.txt @@ -1,5 +1,11 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_TCP_SERVER_SOCKET) + return() +endif () + +###################################################################### + function (plugin_tcp_server_socket) - set (name "tcp_server_socket") + set (name "cc_tools_plugin_tcp_server_socket") if (NOT TARGET Qt::Network) message(WARNING "Can NOT build ${name} due to missing Qt::Network library") @@ -12,21 +18,21 @@ function (plugin_tcp_server_socket) set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SocketPlugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/TcpServerSocketPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - Socket.cpp - SocketPlugin.cpp - SocketConfigWidget.cpp + TcpServerSocket.cpp + TcpServerSocketPlugin.cpp + TcpServerSocketConfigWidget.cpp ) set (hdr - Socket.h - SocketPlugin.h - SocketConfigWidget.h + TcpServerSocket.h + TcpServerSocketPlugin.h + TcpServerSocketConfigWidget.h ) cc_qt_wrap_cpp( @@ -36,18 +42,16 @@ function (plugin_tcp_server_socket) cc_qt_wrap_ui( ui - SocketConfigWidget.ui + TcpServerSocketConfigWidget.ui ) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Network Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/tcp_socket/server/Socket.cpp b/plugin/tcp_socket/server/TcpServerSocket.cpp similarity index 79% rename from plugin/tcp_socket/server/Socket.cpp rename to plugin/tcp_socket/server/TcpServerSocket.cpp index b71bd5c2..b894d9fa 100644 --- a/plugin/tcp_socket/server/Socket.cpp +++ b/plugin/tcp_socket/server/TcpServerSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -17,14 +17,10 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() -#include "Socket.h" +#include "TcpServerSocket.h" namespace cc_tools_qt { @@ -32,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - namespace { @@ -46,29 +36,28 @@ const QString ToPropName("tcp.to"); } // namespace -Socket::Socket() +TcpServerSocket::TcpServerSocket() { QObject::connect( &m_server, &QTcpServer::acceptError, - this, &Socket::acceptErrorOccurred); + this, &TcpServerSocket::acceptErrorOccurred); QObject::connect( &m_server, &QTcpServer::newConnection, - this, &Socket::newConnection); + this, &TcpServerSocket::newConnection); } -Socket::~Socket() noexcept +TcpServerSocket::~TcpServerSocket() noexcept { for (auto* socket : m_sockets) { socket->flush(); } } -bool Socket::socketConnectImpl() +bool TcpServerSocket::socketConnectImpl() { if (m_server.isListening()) { - static constexpr bool Already_listening = false; - static_cast(Already_listening); + [[maybe_unused]] static constexpr bool Already_listening = false; assert(Already_listening); static const QString AlreadyListeningError( tr("Previous run of TCP/IP Server socket wasn't terminated properly.")); @@ -86,13 +75,13 @@ bool Socket::socketConnectImpl() return true; } -void Socket::socketDisconnectImpl() +void TcpServerSocket::socketDisconnectImpl() { m_server.close(); assert(!m_server.isListening()); } -void Socket::sendDataImpl(DataInfoPtr dataPtr) +void TcpServerSocket::sendDataImpl(DataInfoPtr dataPtr) { assert(dataPtr); @@ -119,29 +108,29 @@ void Socket::sendDataImpl(DataInfoPtr dataPtr) dataPtr->m_extraProperties.insert(ToPropName, toList); } -unsigned Socket::connectionPropertiesImpl() const +unsigned TcpServerSocket::connectionPropertiesImpl() const { return ConnectionProperty_Autoconnect; } -void Socket::newConnection() +void TcpServerSocket::newConnection() { auto *newConnSocket = m_server.nextPendingConnection(); m_sockets.push_back(newConnSocket); connect( newConnSocket, &QTcpSocket::disconnected, - newConnSocket, &Socket::deleteLater); + newConnSocket, &TcpServerSocket::deleteLater); connect( newConnSocket, &QTcpSocket::disconnected, - this, &Socket::connectionTerminated); + this, &TcpServerSocket::connectionTerminated); connect( newConnSocket, &QTcpSocket::readyRead, - this, &Socket::readFromSocket); + this, &TcpServerSocket::readFromSocket); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( newConnSocket, &QTcpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &TcpServerSocket::socketErrorOccurred); #else // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( newConnSocket, SIGNAL(error(QAbstractSocket::SocketError)), @@ -149,13 +138,12 @@ void Socket::newConnection() #endif // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) } -void Socket::connectionTerminated() +void TcpServerSocket::connectionTerminated() { auto* socket = sender(); auto iter = std::find(m_sockets.begin(), m_sockets.end(), socket); if (iter == m_sockets.end()) { - static constexpr bool Must_have_found_socket = false; - static_cast(Must_have_found_socket); + [[maybe_unused]] static constexpr bool Must_have_found_socket = false; assert(Must_have_found_socket); return; } @@ -163,7 +151,7 @@ void Socket::connectionTerminated() m_sockets.erase(iter); } -void Socket::readFromSocket() +void TcpServerSocket::readFromSocket() { auto* socket = qobject_cast(sender()); assert(socket != nullptr); @@ -192,33 +180,27 @@ void Socket::readFromSocket() reportDataReceived(std::move(dataPtr)); } -void Socket::socketErrorOccurred(QAbstractSocket::SocketError err) +void TcpServerSocket::socketErrorOccurred(QAbstractSocket::SocketError err) { if (err == QAbstractSocket::RemoteHostClosedError) { // Ignore remote client disconnection return; } - static_cast(err); auto* socket = qobject_cast(sender()); assert(socket != nullptr); reportError(socket->errorString()); } -void Socket::acceptErrorOccurred(QAbstractSocket::SocketError err) +void TcpServerSocket::acceptErrorOccurred([[maybe_unused]] QAbstractSocket::SocketError err) { - static_cast(err); reportError(m_server.errorString()); if (!m_server.isListening()) { reportDisconnected(); } } -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/Socket.h b/plugin/tcp_socket/server/TcpServerSocket.h similarity index 83% rename from plugin/tcp_socket/server/Socket.h rename to plugin/tcp_socket/server/TcpServerSocket.h index 8b2ee7e5..a0f7137d 100644 --- a/plugin/tcp_socket/server/Socket.h +++ b/plugin/tcp_socket/server/TcpServerSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,12 +19,8 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" @@ -35,14 +31,7 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - -class Socket : public QObject, - public cc_tools_qt::Socket +class TcpServerSocket : public QObject, public cc_tools_qt::Socket { Q_OBJECT using Base = cc_tools_qt::Socket; @@ -50,8 +39,8 @@ class Socket : public QObject, public: typedef unsigned short PortType; - Socket(); - ~Socket() noexcept; + TcpServerSocket(); + ~TcpServerSocket() noexcept; void setPort(PortType value) { @@ -83,10 +72,6 @@ private slots: QTcpServer m_server; }; -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/SocketConfigWidget.cpp b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.cpp similarity index 77% rename from plugin/tcp_socket/server/SocketConfigWidget.cpp rename to plugin/tcp_socket/server/TcpServerSocketConfigWidget.cpp index 8bff613f..a46896d9 100644 --- a/plugin/tcp_socket/server/SocketConfigWidget.cpp +++ b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketConfigWidget.h" +#include "TcpServerSocketConfigWidget.h" #include @@ -25,14 +25,8 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - -SocketConfigWidget::SocketConfigWidget( - Socket& socket, +TcpServerSocketConfigWidget::TcpServerSocketConfigWidget( + TcpServerSocket& socket, QWidget* parentObj) : Base(parentObj), m_socket(socket) @@ -51,17 +45,13 @@ SocketConfigWidget::SocketConfigWidget( this, SLOT(portValueChanged(int))); } -SocketConfigWidget::~SocketConfigWidget() noexcept = default; +TcpServerSocketConfigWidget::~TcpServerSocketConfigWidget() noexcept = default; -void SocketConfigWidget::portValueChanged(int value) +void TcpServerSocketConfigWidget::portValueChanged(int value) { m_socket.setPort(static_cast(value)); } -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/SocketConfigWidget.h b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.h similarity index 64% rename from plugin/tcp_socket/server/SocketConfigWidget.h rename to plugin/tcp_socket/server/TcpServerSocketConfigWidget.h index 3b941614..61e4d333 100644 --- a/plugin/tcp_socket/server/SocketConfigWidget.h +++ b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -#include "ui_SocketConfigWidget.h" -CC_ENABLE_WARNINGS() +#include "ui_TcpServerSocketConfigWidget.h" -#include "Socket.h" +#include "TcpServerSocket.h" namespace cc_tools_qt { @@ -33,37 +29,27 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - -class SocketConfigWidget : public QWidget +class TcpServerSocketConfigWidget : public QWidget { Q_OBJECT typedef QWidget Base; public: - typedef Socket::PortType PortType; + typedef TcpServerSocket::PortType PortType; - explicit SocketConfigWidget( - Socket& socket, + explicit TcpServerSocketConfigWidget( + TcpServerSocket& socket, QWidget* parentObj = nullptr); - ~SocketConfigWidget() noexcept; + ~TcpServerSocketConfigWidget() noexcept; private slots: void portValueChanged(int value); private: - Socket& m_socket; - Ui::ServerSocketConfigWidget m_ui; + TcpServerSocket& m_socket; + Ui::TcpServerSocketConfigWidget m_ui; }; -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/SocketConfigWidget.ui b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.ui similarity index 92% rename from plugin/tcp_socket/server/SocketConfigWidget.ui rename to plugin/tcp_socket/server/TcpServerSocketConfigWidget.ui index 0ee1e1c4..7d832cee 100644 --- a/plugin/tcp_socket/server/SocketConfigWidget.ui +++ b/plugin/tcp_socket/server/TcpServerSocketConfigWidget.ui @@ -1,7 +1,7 @@ - ServerSocketConfigWidget - + TcpServerSocketConfigWidget + 0 diff --git a/plugin/tcp_socket/server/SocketPlugin.cpp b/plugin/tcp_socket/server/TcpServerSocketPlugin.cpp similarity index 75% rename from plugin/tcp_socket/server/SocketPlugin.cpp rename to plugin/tcp_socket/server/TcpServerSocketPlugin.cpp index e2084856..084682f6 100644 --- a/plugin/tcp_socket/server/SocketPlugin.cpp +++ b/plugin/tcp_socket/server/TcpServerSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketPlugin.h" +#include "TcpServerSocketPlugin.h" #include #include -#include "Socket.h" -#include "SocketConfigWidget.h" +#include "TcpServerSocket.h" +#include "TcpServerSocketConfigWidget.h" namespace cc_tools_qt { @@ -29,12 +29,6 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - namespace { @@ -43,7 +37,7 @@ const QString PortSubKey("port"); } // namespace -SocketPlugin::SocketPlugin() +TcpServerSocketPlugin::TcpServerSocketPlugin() { pluginProperties() .setSocketCreateFunc( @@ -56,13 +50,13 @@ SocketPlugin::SocketPlugin() [this]() { createSocketIfNeeded(); - return new SocketConfigWidget(*m_socket); + return new TcpServerSocketConfigWidget(*m_socket); }); } -SocketPlugin::~SocketPlugin() noexcept = default; +TcpServerSocketPlugin::~TcpServerSocketPlugin() noexcept = default; -void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) +void TcpServerSocketPlugin::getCurrentConfigImpl(QVariantMap& config) { createSocketIfNeeded(); @@ -71,14 +65,14 @@ void SocketPlugin::getCurrentConfigImpl(QVariantMap& config) config.insert(MainConfigKey, QVariant::fromValue(subConfig)); } -void SocketPlugin::reconfigureImpl(const QVariantMap& config) +void TcpServerSocketPlugin::reconfigureImpl(const QVariantMap& config) { auto subConfigVar = config.value(MainConfigKey); if ((!subConfigVar.isValid()) || (!subConfigVar.canConvert())) { return; } - typedef Socket::PortType PortType; + typedef TcpServerSocket::PortType PortType; auto subConfig = subConfigVar.value(); auto portVar = subConfig.value(PortSubKey); if ((!portVar.isValid()) || (!portVar.canConvert())) { @@ -92,17 +86,13 @@ void SocketPlugin::reconfigureImpl(const QVariantMap& config) m_socket->setPort(port); } -void SocketPlugin::createSocketIfNeeded() +void TcpServerSocketPlugin::createSocketIfNeeded() { if (!m_socket) { - m_socket.reset(new Socket()); + m_socket.reset(new TcpServerSocket()); } } -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/SocketPlugin.h b/plugin/tcp_socket/server/TcpServerSocketPlugin.h similarity index 78% rename from plugin/tcp_socket/server/SocketPlugin.h rename to plugin/tcp_socket/server/TcpServerSocketPlugin.h index 42eda5b9..45d9ab8c 100644 --- a/plugin/tcp_socket/server/SocketPlugin.h +++ b/plugin/tcp_socket/server/TcpServerSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2015 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2015 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "cc_tools_qt/Plugin.h" -#include "Socket.h" +#include "TcpServerSocket.h" namespace cc_tools_qt { @@ -30,22 +30,15 @@ namespace cc_tools_qt namespace plugin { -namespace tcp_socket -{ - -namespace server -{ - - -class SocketPlugin : public cc_tools_qt::Plugin +class TcpServerSocketPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.TcpServerSocketPlugin" FILE "tcp_server_socket.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - SocketPlugin(); - ~SocketPlugin() noexcept; + TcpServerSocketPlugin(); + ~TcpServerSocketPlugin() noexcept; virtual void getCurrentConfigImpl(QVariantMap& config) override; virtual void reconfigureImpl(const QVariantMap& config) override; @@ -54,13 +47,9 @@ class SocketPlugin : public cc_tools_qt::Plugin void createSocketIfNeeded(); - std::shared_ptr m_socket; + std::shared_ptr m_socket; }; -} // namespace server - -} // namespace tcp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/tcp_socket/server/tcp_server_socket.json b/plugin/tcp_socket/server/tcp_server_socket.json index f96797b7..9ffaa8ec 100644 --- a/plugin/tcp_socket/server/tcp_server_socket.json +++ b/plugin/tcp_socket/server/tcp_server_socket.json @@ -1,5 +1,5 @@ { - "name" : "TCP/IP Server Socket", + "name" : "CC TCP/IP Server Socket", "desc" : [ "I/O socket that is bound to a local port and allows\n", "communication via TCP/IP connection." diff --git a/plugin/udp_socket/CMakeLists.txt b/plugin/udp_socket/CMakeLists.txt index cb4255a9..db45cfb4 100644 --- a/plugin/udp_socket/CMakeLists.txt +++ b/plugin/udp_socket/CMakeLists.txt @@ -1,33 +1,38 @@ +if (NOT CC_TOOLS_QT_BUILD_PLUGIN_UDP_SOCKET) + return() +endif () + +###################################################################### function (plugin_udp_client_socket) - set (name "udp_client_socket") + set (name "cc_tools_plugin_udp_client_socket") if (NOT TARGET Qt::Network) message(WARNING "Can NOT build ${name} due to missing Qt::Network library") return() endif () - set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/udp_client_socket.json") - set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/client_refresh_stamp.txt") + set (meta_file "${CMAKE_CURRENT_SOURCE_DIR}/udp_socket.json") + set (stamp_file "${CMAKE_CURRENT_BINARY_DIR}/refresh_stamp.txt") set (refresh_plugin_header TRUE) if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file})) execute_process( - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/SocketPlugin.h) + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/UdpSocketPlugin.h) execute_process( COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file}) endif () set (src - Plugin.cpp - Socket.cpp - SocketConfigWidget.cpp + UdpSocket.cpp + UdpSocketPlugin.cpp + UdpSocketConfigWidget.cpp ) set (hdr - Plugin.h - Socket.h - SocketConfigWidget.h + UdpSocketPlugin.h + UdpSocket.h + UdpSocketConfigWidget.h ) cc_qt_wrap_cpp( @@ -37,17 +42,15 @@ function (plugin_udp_client_socket) cc_qt_wrap_ui( ui - SocketConfigWidget.ui + UdpSocketConfigWidget.ui ) add_library (${name} MODULE ${src} ${moc} ${ui}) target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Network Qt::Widgets Qt::Core) - if (CC_TOOLS_QT_INSTALL_PLUGINS) - install ( - TARGETS ${name} - DESTINATION ${PLUGIN_INSTALL_DIR}) - endif () + install ( + TARGETS ${name} + DESTINATION ${PLUGIN_INSTALL_DIR}) endfunction() diff --git a/plugin/udp_socket/SocketPlugin.h b/plugin/udp_socket/SocketPlugin.h deleted file mode 100644 index e69de29b..00000000 diff --git a/plugin/udp_socket/Socket.cpp b/plugin/udp_socket/UdpSocket.cpp similarity index 88% rename from plugin/udp_socket/Socket.cpp rename to plugin/udp_socket/UdpSocket.cpp index 3532d6b2..dd9d2d27 100644 --- a/plugin/udp_socket/Socket.cpp +++ b/plugin/udp_socket/UdpSocket.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #include #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include #include -CC_ENABLE_WARNINGS() -#include "Socket.h" +#include "UdpSocket.h" namespace cc_tools_qt { @@ -33,12 +29,6 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - namespace { @@ -50,28 +40,28 @@ const QString ToPropName("udp.to"); } // namespace -Socket::Socket() +UdpSocket::UdpSocket() : m_host(DefaultHost), m_broadcastPropName(DefaultBroadcastPropName) { connect( &m_socket, &QUdpSocket::disconnected, - this, &Socket::socketDisconnected); + this, &UdpSocket::socketDisconnected); connect( &m_socket, &QUdpSocket::readyRead, - this, &Socket::readFromSocket); + this, &UdpSocket::readFromSocket); connect( &m_broadcastSocket, &QUdpSocket::readyRead, - this, &Socket::readFromBroadcastSocket); + this, &UdpSocket::readFromBroadcastSocket); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( &m_socket, &QUdpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &UdpSocket::socketErrorOccurred); connect( &m_broadcastSocket, &QUdpSocket::errorOccurred, - this, &Socket::socketErrorOccurred); + this, &UdpSocket::socketErrorOccurred); #else // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect( &m_socket, SIGNAL(error(QAbstractSocket::SocketError)), @@ -82,12 +72,12 @@ Socket::Socket() #endif // #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) } -Socket::~Socket() noexcept +UdpSocket::~UdpSocket() noexcept { m_socket.blockSignals(true); } -bool Socket::socketConnectImpl() +bool UdpSocket::socketConnectImpl() { if ((!m_host.isEmpty()) && (m_port == 0)) { static const QString Error = @@ -135,7 +125,7 @@ bool Socket::socketConnectImpl() return true; } -void Socket::socketDisconnectImpl() +void UdpSocket::socketDisconnectImpl() { m_socket.blockSignals(true); m_socket.close(); @@ -144,7 +134,7 @@ void Socket::socketDisconnectImpl() m_socket.blockSignals(false); } -void Socket::sendDataImpl(DataInfoPtr dataPtr) +void UdpSocket::sendDataImpl(DataInfoPtr dataPtr) { assert(dataPtr); QString from = @@ -210,28 +200,27 @@ void Socket::sendDataImpl(DataInfoPtr dataPtr) } -void Socket::socketDisconnected() +void UdpSocket::socketDisconnected() { reportDisconnected(); } -void Socket::readFromSocket() +void UdpSocket::readFromSocket() { readData(m_socket); } -void Socket::readFromBroadcastSocket() +void UdpSocket::readFromBroadcastSocket() { readData(m_broadcastSocket); } -void Socket::socketErrorOccurred(QAbstractSocket::SocketError err) +void UdpSocket::socketErrorOccurred([[maybe_unused]] QAbstractSocket::SocketError err) { - static_cast(err); std::cout << "ERROR: UDP Socket: " << m_socket.errorString().toStdString() << std::endl; } -void Socket::readData(QUdpSocket& socket) +void UdpSocket::readData(QUdpSocket& socket) { while (socket.hasPendingDatagrams()) { QHostAddress senderAddress; @@ -266,7 +255,7 @@ void Socket::readData(QUdpSocket& socket) } } -bool Socket::bindSocket(QUdpSocket& socket) +bool UdpSocket::bindSocket(QUdpSocket& socket) { if (!socket.bind(QHostAddress::AnyIPv4, m_localPort, QUdpSocket::ShareAddress)) { return false; @@ -275,10 +264,6 @@ bool Socket::bindSocket(QUdpSocket& socket) return socket.open(QUdpSocket::ReadWrite); } -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/Socket.h b/plugin/udp_socket/UdpSocket.h similarity index 86% rename from plugin/udp_socket/Socket.h rename to plugin/udp_socket/UdpSocket.h index b78a3de8..b15b983a 100644 --- a/plugin/udp_socket/Socket.h +++ b/plugin/udp_socket/UdpSocket.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -19,11 +19,7 @@ #include -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -CC_ENABLE_WARNINGS() #include "cc_tools_qt/Socket.h" @@ -34,14 +30,7 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - -class Socket : public QObject, - public cc_tools_qt::Socket +class UdpSocket : public QObject, public cc_tools_qt::Socket { Q_OBJECT using Base = cc_tools_qt::Socket; @@ -49,8 +38,8 @@ class Socket : public QObject, public: typedef unsigned short PortType; - Socket(); - ~Socket() noexcept; + UdpSocket(); + ~UdpSocket() noexcept; void setHost(const QString& value) { @@ -118,10 +107,6 @@ private slots: bool m_running = false; }; -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/SocketConfigWidget.cpp b/plugin/udp_socket/UdpSocketConfigWidget.cpp similarity index 79% rename from plugin/udp_socket/SocketConfigWidget.cpp rename to plugin/udp_socket/UdpSocketConfigWidget.cpp index bcb55572..2ef9df61 100644 --- a/plugin/udp_socket/SocketConfigWidget.cpp +++ b/plugin/udp_socket/UdpSocketConfigWidget.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SocketConfigWidget.h" +#include "UdpSocketConfigWidget.h" #include @@ -25,14 +25,8 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - -SocketConfigWidget::SocketConfigWidget( - Socket& socket, +UdpSocketConfigWidget::UdpSocketConfigWidget( + UdpSocket& socket, QWidget* parentObj) : Base(parentObj), m_socket(socket) @@ -75,32 +69,28 @@ SocketConfigWidget::SocketConfigWidget( } -SocketConfigWidget::~SocketConfigWidget() noexcept = default; +UdpSocketConfigWidget::~UdpSocketConfigWidget() noexcept = default; -void SocketConfigWidget::hostValueChanged(const QString& value) +void UdpSocketConfigWidget::hostValueChanged(const QString& value) { m_socket.setHost(value); } -void SocketConfigWidget::portValueChanged(int value) +void UdpSocketConfigWidget::portValueChanged(int value) { m_socket.setPort(static_cast(value)); } -void SocketConfigWidget::localPortValueChanged(int value) +void UdpSocketConfigWidget::localPortValueChanged(int value) { m_socket.setLocalPort(static_cast(value)); } -void SocketConfigWidget::broadcastValueChanged(const QString& value) +void UdpSocketConfigWidget::broadcastValueChanged(const QString& value) { m_socket.setBroadcastPropName(value); } -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/SocketConfigWidget.h b/plugin/udp_socket/UdpSocketConfigWidget.h similarity index 67% rename from plugin/udp_socket/SocketConfigWidget.h rename to plugin/udp_socket/UdpSocketConfigWidget.h index d54c48a8..67975dda 100644 --- a/plugin/udp_socket/SocketConfigWidget.h +++ b/plugin/udp_socket/UdpSocketConfigWidget.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -18,14 +18,10 @@ #pragma once -#include "comms/CompileControl.h" - -CC_DISABLE_WARNINGS() #include -#include "ui_SocketConfigWidget.h" -CC_ENABLE_WARNINGS() +#include "ui_UdpSocketConfigWidget.h" -#include "Socket.h" +#include "UdpSocket.h" namespace cc_tools_qt { @@ -33,24 +29,18 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - -class SocketConfigWidget : public QWidget +class UdpSocketConfigWidget : public QWidget { Q_OBJECT typedef QWidget Base; public: - typedef Socket::PortType PortType; + typedef UdpSocket::PortType PortType; - explicit SocketConfigWidget( - Socket& socket, + explicit UdpSocketConfigWidget( + UdpSocket& socket, QWidget* parentObj = nullptr); - ~SocketConfigWidget() noexcept; + ~UdpSocketConfigWidget() noexcept; private slots: void hostValueChanged(const QString& value); @@ -59,14 +49,10 @@ private slots: void broadcastValueChanged(const QString& value); private: - Socket& m_socket; - Ui::SocketConfigWidget m_ui; + UdpSocket& m_socket; + Ui::UdpSocketConfigWidget m_ui; }; -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/SocketConfigWidget.ui b/plugin/udp_socket/UdpSocketConfigWidget.ui similarity index 97% rename from plugin/udp_socket/SocketConfigWidget.ui rename to plugin/udp_socket/UdpSocketConfigWidget.ui index ede5f40b..6972da70 100644 --- a/plugin/udp_socket/SocketConfigWidget.ui +++ b/plugin/udp_socket/UdpSocketConfigWidget.ui @@ -1,7 +1,7 @@ - SocketConfigWidget - + UdpSocketConfigWidget + 0 diff --git a/plugin/udp_socket/Plugin.cpp b/plugin/udp_socket/UdpSocketPlugin.cpp similarity index 82% rename from plugin/udp_socket/Plugin.cpp rename to plugin/udp_socket/UdpSocketPlugin.cpp index 6250f782..512b013d 100644 --- a/plugin/udp_socket/Plugin.cpp +++ b/plugin/udp_socket/UdpSocketPlugin.cpp @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -15,12 +15,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "Plugin.h" +#include "UdpSocketPlugin.h" #include #include -#include "SocketConfigWidget.h" +#include "UdpSocketConfigWidget.h" namespace cc_tools_qt { @@ -28,12 +28,6 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - namespace { @@ -45,7 +39,7 @@ const QString BroadcastPropName("broadcast_prop"); } // namespace -Plugin::Plugin() +UdpSocketPlugin::UdpSocketPlugin() { pluginProperties() .setSocketCreateFunc( @@ -58,15 +52,14 @@ Plugin::Plugin() [this]() -> QWidget* { createSocketIfNeeded(); - return new SocketConfigWidget(*m_socket); + return new UdpSocketConfigWidget(*m_socket); }); } -Plugin::~Plugin() noexcept = default; +UdpSocketPlugin::~UdpSocketPlugin() noexcept = default; -void Plugin::getCurrentConfigImpl(QVariantMap& config) +void UdpSocketPlugin::getCurrentConfigImpl(QVariantMap& config) { - static_cast(config); createSocketIfNeeded(); QVariantMap subConfig; @@ -77,9 +70,8 @@ void Plugin::getCurrentConfigImpl(QVariantMap& config) config.insert(MainConfigKey, QVariant::fromValue(subConfig)); } -void Plugin::reconfigureImpl(const QVariantMap& config) +void UdpSocketPlugin::reconfigureImpl(const QVariantMap& config) { - static_cast(config); auto subConfigVar = config.value(MainConfigKey); if ((!subConfigVar.isValid()) || (!subConfigVar.canConvert())) { return; @@ -95,7 +87,7 @@ void Plugin::reconfigureImpl(const QVariantMap& config) m_socket->setHost(host); } - typedef Socket::PortType PortType; + typedef UdpSocket::PortType PortType; auto portVar = subConfig.value(PortSubKey); if (portVar.isValid() && portVar.canConvert()) { auto port = portVar.value(); @@ -115,17 +107,13 @@ void Plugin::reconfigureImpl(const QVariantMap& config) } } -void Plugin::createSocketIfNeeded() +void UdpSocketPlugin::createSocketIfNeeded() { if (!m_socket) { - m_socket.reset(new Socket()); + m_socket.reset(new UdpSocket()); } } -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/Plugin.h b/plugin/udp_socket/UdpSocketPlugin.h similarity index 79% rename from plugin/udp_socket/Plugin.h rename to plugin/udp_socket/UdpSocketPlugin.h index 02c92fdd..10471576 100644 --- a/plugin/udp_socket/Plugin.h +++ b/plugin/udp_socket/UdpSocketPlugin.h @@ -1,5 +1,5 @@ // -// Copyright 2016 - 2023 (C). Alex Robenko. All rights reserved. +// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved. // // This file is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "cc_tools_qt/Plugin.h" -#include "Socket.h" +#include "UdpSocket.h" namespace cc_tools_qt { @@ -30,21 +30,15 @@ namespace cc_tools_qt namespace plugin { -namespace udp_socket -{ - -namespace client -{ - -class Plugin : public cc_tools_qt::Plugin +class UdpSocketPlugin : public cc_tools_qt::Plugin { Q_OBJECT Q_PLUGIN_METADATA(IID "cc.UdpSocketPlugin" FILE "udp_socket.json") Q_INTERFACES(cc_tools_qt::Plugin) public: - Plugin(); - ~Plugin() noexcept; + UdpSocketPlugin(); + ~UdpSocketPlugin() noexcept; virtual void getCurrentConfigImpl(QVariantMap& config) override; virtual void reconfigureImpl(const QVariantMap& config) override; @@ -53,13 +47,9 @@ class Plugin : public cc_tools_qt::Plugin void createSocketIfNeeded(); - std::shared_ptr m_socket; + std::shared_ptr m_socket; }; -} // namespace client - -} // namespace udp_socket - } // namespace plugin } // namespace cc_tools_qt diff --git a/plugin/udp_socket/udp_socket.json b/plugin/udp_socket/udp_socket.json index d0f52c42..f74f0e4e 100644 --- a/plugin/udp_socket/udp_socket.json +++ b/plugin/udp_socket/udp_socket.json @@ -1,5 +1,5 @@ { - "name" : "UDP/IP Socket", + "name" : "CC UDP/IP Socket", "desc" : [ "I/O socket that allows communication via UDP/IP connection." ], diff --git a/script/appveyor_install.bat b/script/appveyor_install.bat index f2d37687..b0ee3d69 100644 --- a/script/appveyor_install.bat +++ b/script/appveyor_install.bat @@ -1,18 +1,8 @@ -IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( - set TOOLCHAIN=msvc14 - set QT_SUBDIR=msvc2015 - set QT_VER=5.11 - IF "%PLATFORM%"=="x86" ( - echo Performing x86 build in VS2015 - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 - ) ELSE ( - echo Performing amd64 build in VS2015 - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - ) -) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( +IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set TOOLCHAIN=msvc15 set QT_SUBDIR=msvc2017 set QT_VER=5.13 + set CMAKE_GENERATOR=NMake Makefiles IF "%PLATFORM%"=="x86" ( echo Performing x86 build in VS2017 call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" @@ -23,6 +13,7 @@ IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( ) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( set TOOLCHAIN=msvc16 set QT_SUBDIR=msvc2019 + set CMAKE_GENERATOR=Visual Studio 16 2019 IF "%QT_MAJOR%"=="6" ( set QT_VER=6.4 ) ELSE ( @@ -31,13 +22,16 @@ IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( IF "%PLATFORM%"=="x86" ( echo Performing x86 build in VS2019 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" + set CMAKE_PLATFORM=Win32 ) ELSE ( echo Performing amd64 build in VS2019 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" + set CMAKE_PLATFORM=x64 ) ) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" ( set TOOLCHAIN=msvc17 set QT_SUBDIR=msvc2019 + set CMAKE_GENERATOR=Visual Studio 17 2022 IF "%QT_MAJOR%"=="6" ( set QT_VER=6.4 ) ELSE ( @@ -46,9 +40,11 @@ IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( IF "%PLATFORM%"=="x86" ( echo Performing x86 build in VS2022 call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" + set CMAKE_PLATFORM=Win32 ) ELSE ( echo Performing amd64 build in VS2022 call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" + set CMAKE_PLATFORM=x64 ) ) ELSE ( echo Toolchain %TOOLCHAIN% is not supported diff --git a/script/env_dev_clang.sh b/script/env_dev_clang.sh index 31275a10..72717c7d 100755 --- a/script/env_dev_clang.sh +++ b/script/env_dev_clang.sh @@ -6,4 +6,4 @@ BUILD_DIR="${ROOT_DIR}/build.clang" mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} -CC=clang CXX=clang++ cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON "$@" +CC=clang CXX=clang++ cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON "$@" diff --git a/script/env_dev_gcc.sh b/script/env_dev_gcc.sh index b5dad1dc..9a107151 100755 --- a/script/env_dev_gcc.sh +++ b/script/env_dev_gcc.sh @@ -6,4 +6,4 @@ BUILD_DIR="${ROOT_DIR}/build.gcc" mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} -CC=gcc CXX=g++ cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON "$@" +CC=gcc CXX=g++ cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON "$@" diff --git a/script/full_debug_build.sh b/script/full_debug_build.sh index 7b34c24d..ccf1d238 100755 --- a/script/full_debug_build.sh +++ b/script/full_debug_build.sh @@ -17,7 +17,7 @@ ${SCRIPT_DIR}/prepare_externals.sh cd ${BUILD_DIR} cmake .. -DCMAKE_INSTALL_PREFIX=${COMMON_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} \ - -DCC_TOOLS_QT_BUILD_DEMO_PROTOCOL=ON "$@" + -DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON "$@" procs=$(nproc) if [ -n "${procs}" ]; then diff --git a/script/prepare_externals.bat b/script/prepare_externals.bat index 803e534c..9648a93b 100755 --- a/script/prepare_externals.bat +++ b/script/prepare_externals.bat @@ -1,6 +1,7 @@ rem Input rem BUILD_DIR - Main build directory rem GENERATOR - CMake generator +rem PLATFORM - CMake generator platform rem QTDIR - Path to Qt installation rem EXTERNALS_DIR - (Optional) Directory where externals need to be located rem COMMS_REPO - (Optional) Repository of the COMMS library @@ -15,6 +16,8 @@ if [%BUILD_DIR%] == [] echo "BUILD_DIR hasn't been specified" & exit /b 1 if [%GENERATOR%] == [] set GENERATOR="NMake Makefiles" +if NOT [%PLATFORM%] == [] set PLATFORM_PARAM=-A %PLATFORM% + if [%EXTERNALS_DIR%] == [] set EXTERNALS_DIR=%BUILD_DIR%/externals if [%COMMS_REPO%] == [] set COMMS_REPO="https://github.com/commschamp/comms.git" @@ -48,7 +51,8 @@ if %errorlevel% neq 0 exit /b %errorlevel% echo "Building COMMS library..." mkdir "%COMMS_BUILD_DIR%" cd %COMMS_BUILD_DIR% -cmake -G %GENERATOR% -S %COMMS_SRC_DIR% -B %COMMS_BUILD_DIR% -DCMAKE_INSTALL_PREFIX=%COMMS_INSTALL_DIR% -DCMAKE_BUILD_TYPE=%COMMON_BUILD_TYPE% -DCMAKE_CXX_STANDARD=%COMMON_CXX_STANDARD% +cmake -G %GENERATOR% %PLATFORM_PARAM% -S %COMMS_SRC_DIR% -B %COMMS_BUILD_DIR% ^ + -DCMAKE_INSTALL_PREFIX=%COMMS_INSTALL_DIR% -DCMAKE_BUILD_TYPE=%COMMON_BUILD_TYPE% -DCMAKE_CXX_STANDARD=%COMMON_CXX_STANDARD% if %errorlevel% neq 0 exit /b %errorlevel% cmake --build %COMMS_BUILD_DIR% --config %COMMON_BUILD_TYPE% --target install if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/script/prepare_externals.sh b/script/prepare_externals.sh index a2f83e13..57ee5961 100755 --- a/script/prepare_externals.sh +++ b/script/prepare_externals.sh @@ -10,6 +10,8 @@ # COMMON_INSTALL_DIR - (Optional) Common directory to perform installations # COMMON_BUILD_TYPE - (Optional) CMake build type # COMMON_CXX_STANDARD - (Optional) CMake C++ standard +# COMMON_CMAKE_GENERATOR - (Optional) CMake generator +# COMMON_CMAKE_PLATFORM - (Optional) CMake platform ##################################### @@ -62,7 +64,9 @@ function build_comms() { echo "Building COMMS library..." mkdir -p ${COMMS_BUILD_DIR} - cmake -S ${COMMS_SRC_DIR} -B ${COMMS_BUILD_DIR} -DCMAKE_INSTALL_PREFIX=${COMMS_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} -DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD} + cmake -S ${COMMS_SRC_DIR} -B ${COMMS_BUILD_DIR} \ + ${COMMON_CMAKE_GENERATOR:+"-G ${COMMON_CMAKE_GENERATOR}"} ${COMMON_CMAKE_PLATFORM:+"-A ${COMMON_CMAKE_PLATFORM}"} \ + -DCMAKE_INSTALL_PREFIX=${COMMS_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} -DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD} cmake --build ${COMMS_BUILD_DIR} --config ${COMMON_BUILD_TYPE} --target install ${procs_param} }