diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e8730d..dbfdd9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,8 +29,8 @@ jobs: - windows-2019 - ubuntu-22.04 - ubuntu-20.04 + - macos-14 - macos-13 - - macos-12 runs-on: ${{ matrix.runner }} @@ -102,7 +102,11 @@ jobs: echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/ACE_TAO/ACE/lib:$GITHUB_WORKSPACE/OpenDDS/lib" >> $GITHUB_ENV CONFIG_OPTIONS+=" --no-tests --std=c++17 --ipv6 --security" if [ '${{ runner.os }}' == 'macOS' ]; then - CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=/usr/local/opt/openssl@1.1" + if [ '${{ matrix.runner }}' == 'macos-13' ]; then + CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=/usr/local/opt/openssl@1.1" + else + CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=$(brew --prefix openssl)" + fi fi echo "CONFIG_OPTIONS=$CONFIG_OPTIONS" >> $GITHUB_ENV export COMPILER_VERSION=$(c++ --version 2>&1 | head -n 1) @@ -217,13 +221,15 @@ jobs: run: |- cmake -DBUILD_TYPE=debug -DVCPKG_INSTALLED_DIR=%VCPKG_INSTALLED_DIR% -DVCPKG_DEFAULT_TRIPLET=%VCPKG_DEFAULT_TRIPLET% -P BuildQwt.cmake - # Build opendds-monitor - - name: 'Set Up Problem Matcher (Windows)' - if: runner.os == 'Windows' - uses: ammaraskar/msvc-problem-matcher@0.3.0 + # Set up problem matchers - name: 'Set Up Problem Matcher (Linux / macOS)' if: runner.os == 'Linux' || runner.os == 'macOS' uses: ammaraskar/gcc-problem-matcher@0.3.0 + - name: 'Set Up Problem Matcher (Windows)' + if: runner.os == 'Windows' + uses: ammaraskar/msvc-problem-matcher@0.3.0 + + # Build opendds-monitor - name: 'Build opendds-monitor (Linux / macOS)' if: runner.os == 'Linux' || runner.os == 'macOS' shell: bash @@ -235,7 +241,8 @@ jobs: cd build CMAKE_ARGS="" if [ '${{ runner.os }}' == 'macOS' ]; then - CMAKE_ARGS+=" -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5" + export QWT_DIR=$(brew --prefix qwt-qt5) + CMAKE_ARGS+=" -DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)" fi cmake $CMAKE_ARGS .. cmake --build . -t all -t managed_testapp -t unmanaged_testapp diff --git a/.gitignore b/.gitignore index a007fea..2300a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build/* +CMakeLists.txt.user diff --git a/CMakeLists.txt b/CMakeLists.txt index f57f8f9..96d2083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,8 @@ else() set(qt_optional_components DBus) endif() -find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui PrintSupport Svg OpenGL OPTIONAL_COMPONENTS ${qt_optional_components}) +find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core Widgets Gui PrintSupport Svg OpenGL OPTIONAL_COMPONENTS ${qt_optional_components}) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Gui PrintSupport Svg OpenGL OPTIONAL_COMPONENTS ${qt_optional_components}) if(QWT_IS_LOCAL) set(QWT_LIBRARY ${PROJECT_SOURCE_DIR}/qwt/lib/qwt$<$:d>.lib) @@ -78,21 +79,31 @@ if(WIN32) list(APPEND SOURCE ddsmon.rc) endif(WIN32) -qt5_add_resources(RESOURCES ddsmon.qrc) +if (NOT Qt6_FOUND) + qt5_add_resources(RESOURCES ddsmon.qrc) +else() + qt_add_resources(RESOURCES ddsmon.qrc) +endif() -qt5_wrap_cpp(MOC_SOURCE - src/graph_page.h - src/log_page.h - src/main_window.h - src/participant_page.h - src/participant_table_model.h - src/publication_monitor.h - src/recorder_dialog.h - src/subscription_monitor.h - src/table_page.h - src/topic_table_model.h +set(MOC_SOURCE_LIST + src/graph_page.h + src/log_page.h + src/main_window.h + src/participant_page.h + src/participant_table_model.h + src/publication_monitor.h + src/recorder_dialog.h + src/subscription_monitor.h + src/table_page.h + src/topic_table_model.h ) +if (NOT Qt6_FOUND) + qt5_wrap_cpp(MOC_SOURCE ${MOC_SOURCE_LIST}) +else() + qt_wrap_cpp(MOC_SOURCE ${MOC_SOURCE_LIST}) +endif() + add_executable(monitor ${SOURCE} ${HEADER} @@ -124,13 +135,13 @@ target_compile_options(monitor PRIVATE $<$,$>:Qt5::DBus> + Qt${QT_VERSION_MAJOR}::PrintSupport + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Svg + Qt${QT_VERSION_MAJOR}::OpenGL + $<$>:Qt${QT_VERSION_MAJOR}::DBus> ) target_include_directories(monitor PRIVATE diff --git a/src/main_window.cpp b/src/main_window.cpp index b472d40..4bbe300 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -279,7 +279,11 @@ void DDSMonitorMainWindow::parseCmd() for (int i = 1; i < argList.count(); i++) { argString = argList.at(i); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) argString.remove(QRegExp("^-*")); // Remove any - prefix +#else + argString.remove(QRegularExpression("^-*")); // Remove any - prefix +#endif // Help! if (argString == "h" || argString == "help") diff --git a/src/recorder_dialog.cpp b/src/recorder_dialog.cpp index 2d9de1a..0ffd912 100644 --- a/src/recorder_dialog.cpp +++ b/src/recorder_dialog.cpp @@ -3,10 +3,12 @@ #include #include -#include #include #include +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) +#include +#endif //------------------------------------------------------------------------------ RecorderDialog::RecorderDialog(const QString& topicName, @@ -152,7 +154,11 @@ void RecorderDialog::on_recordButton_clicked() // Prepare the output stream m_outputStream.setDevice(&m_outputFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) m_outputStream.setCodec(QTextCodec::codecForName("UTF-8")); +#else + m_outputStream.setEncoding(QStringConverter::Utf8); +#endif m_outputStream.setRealNumberNotation(QTextStream::FixedNotation); m_outputStream.setRealNumberPrecision(6); diff --git a/src/topic_table_model.cpp b/src/topic_table_model.cpp index 8bb8c75..bb89525 100644 --- a/src/topic_table_model.cpp +++ b/src/topic_table_model.cpp @@ -407,7 +407,7 @@ void TopicTableModel::parseData(const std::shared_ptr data) { wchar_t tmpValue[2] = { 0, 0 }; tmpValue[0] = child->getValue(); - dataRow->value = ACE_Wide_To_Ascii(tmpValue).char_rep(); + dataRow->value = QString(ACE_Wide_To_Ascii(tmpValue).char_rep()); break; } case CORBA::tk_octet: @@ -619,14 +619,14 @@ void TopicTableModel::setDataRow(DataRow* const data_row, case CORBA::tk_char: { CORBA::Char value[2] = { 0, 0 }; if (check_rc(data->get_char8_value(value[0], id), "get_char8_value failed")) { - data_row->value = value; + data_row->value = QString(value); } break; } case CORBA::tk_wchar: { CORBA::WChar value[2] = { 0, 0 }; if (check_rc(data->get_char16_value(value[0], id), "get_char16_value failed")) { - data_row->value = ACE_Wide_To_Ascii(value).char_rep(); + data_row->value = QString(ACE_Wide_To_Ascii(value).char_rep()); } break; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 982aefa..5322b13 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20) project(opendds-monitor-tests VERSION 0.0.1 LANGUAGES CXX) add_library(test_common INTERFACE) -target_compile_options(test_common INTERFACE $<$,$,$>: -Wall -Wpedantic -Wno-unused -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wundef -Werror> $<$: /W4>) +target_compile_options(test_common INTERFACE $<$,$,$>: -Wall -Wextra -Wpedantic -Wno-unused -Wunused-parameter> $<$: /W4>) if (MSVC) target_compile_definitions(test_common INTERFACE _CRT_SECURE_NO_WARNINGS) else()