From a03cf83d585a64e01c75931b916bce5213c57d51 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Tue, 8 Oct 2024 22:17:42 -0500 Subject: [PATCH 1/6] Bump dependency Qt to 6.8.0 --- .github/workflows/ci.yml | 6 +++--- setup-debug.bat | 2 +- setup-debug.sh | 2 +- setup-release.bat | 2 +- setup-release.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f0dc56..a5f3395f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: compiler: msvc msvc_arch: x64 msvc_version: 2022 - qt_version: 6.7.2 + qt_version: 6.8.0 qt_arch_aqt: win64_msvc2019_64 qt_arch_dir: msvc2019_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport @@ -46,7 +46,7 @@ jobs: env_cc: gcc-11 env_cxx: g++-11 compiler: gcc - qt_version: 6.7.2 + qt_version: 6.8.0 qt_arch_aqt: linux_gcc_64 qt_arch_dir: gcc_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport @@ -64,7 +64,7 @@ jobs: env_cc: clang-17 env_cxx: clang++-17 compiler: clang - qt_version: 6.7.2 + qt_version: 6.8.0 qt_arch_aqt: linux_gcc_64 qt_arch_dir: gcc_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport diff --git a/setup-debug.bat b/setup-debug.bat index 7ad46d78..f57d92f3 100644 --- a/setup-debug.bat +++ b/setup-debug.bat @@ -2,7 +2,7 @@ call tools\setup-common.bat set build_dir=build-debug set build_type=Debug -set qt_version=6.7.2 +set qt_version=6.8.0 mkdir %build_dir% cmake -B %build_dir% -S . ^ diff --git a/setup-debug.sh b/setup-debug.sh index 87067a3b..7516c1e8 100755 --- a/setup-debug.sh +++ b/setup-debug.sh @@ -3,7 +3,7 @@ build_dir=${1:-build-debug} build_type=Debug -qt_version=6.7.2 +qt_version=6.8.0 script_dir="$(dirname "$(readlink -f "$0")")" mkdir -p ${build_dir} diff --git a/setup-release.bat b/setup-release.bat index 3c08d78d..316c50a7 100644 --- a/setup-release.bat +++ b/setup-release.bat @@ -2,7 +2,7 @@ call tools\setup-common.bat set build_dir=build-release set build_type=Release -set qt_version=6.7.2 +set qt_version=6.8.0 mkdir %build_dir% cmake -B %build_dir% -S . ^ diff --git a/setup-release.sh b/setup-release.sh index 6d81ff8f..949cabfc 100755 --- a/setup-release.sh +++ b/setup-release.sh @@ -3,7 +3,7 @@ build_dir=${1:-build-release} build_type=Release -qt_version=6.7.2 +qt_version=6.8.0 script_dir="$(dirname "$(readlink -f "$0")")" mkdir -p ${build_dir} From 1fd51d23f36569558a31f45d40ae816cedb7b68d Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Tue, 8 Oct 2024 22:21:25 -0500 Subject: [PATCH 2/6] Qt 6.8.0 bumped MSVC to 2022 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5f3395f..806f0200 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: msvc_arch: x64 msvc_version: 2022 qt_version: 6.8.0 - qt_arch_aqt: win64_msvc2019_64 - qt_arch_dir: msvc2019_64 + qt_arch_aqt: win64_msvc2022_64 + qt_arch_dir: msvc2022_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport qt_tools: '' conan_arch: x86_64 From 2f37e42b388a60e951c705d30aabe8f839ee49b6 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Wed, 9 Oct 2024 05:54:57 -0500 Subject: [PATCH 3/6] Add qt_arch variable to setup scripts, updating Windows to msvc2022 --- setup-debug.bat | 3 ++- setup-debug.sh | 3 ++- setup-release.bat | 3 ++- setup-release.sh | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/setup-debug.bat b/setup-debug.bat index f57d92f3..14e4f870 100644 --- a/setup-debug.bat +++ b/setup-debug.bat @@ -3,10 +3,11 @@ call tools\setup-common.bat set build_dir=build-debug set build_type=Debug set qt_version=6.8.0 +set qt_arch=msvc2022_64 mkdir %build_dir% cmake -B %build_dir% -S . ^ -DCMAKE_BUILD_TYPE=%build_type% ^ -DCMAKE_CONFIGURATION_TYPES=%build_type% ^ - -DCMAKE_PREFIX_PATH=C:/Qt/%qt_version%/msvc2019_64 + -DCMAKE_PREFIX_PATH=C:/Qt/%qt_version%/%qt_arch% pause diff --git a/setup-debug.sh b/setup-debug.sh index 7516c1e8..4f9e72ea 100755 --- a/setup-debug.sh +++ b/setup-debug.sh @@ -4,6 +4,7 @@ build_dir=${1:-build-debug} build_type=Debug qt_version=6.8.0 +qt_arch=gcc_64 script_dir="$(dirname "$(readlink -f "$0")")" mkdir -p ${build_dir} @@ -11,5 +12,5 @@ cmake -B ${build_dir} -S . \ -DCMAKE_BUILD_TYPE=${build_type} \ -DCMAKE_CONFIGURATION_TYPES=${build_type} \ -DCMAKE_INSTALL_PREFIX=${build_dir}/${build_type}/supercell-wx \ - -DCMAKE_PREFIX_PATH=/opt/Qt/${qt_version}/gcc_64 \ + -DCMAKE_PREFIX_PATH=/opt/Qt/${qt_version}/${qt_arch} \ -G Ninja diff --git a/setup-release.bat b/setup-release.bat index 316c50a7..cfcbd3c9 100644 --- a/setup-release.bat +++ b/setup-release.bat @@ -3,10 +3,11 @@ call tools\setup-common.bat set build_dir=build-release set build_type=Release set qt_version=6.8.0 +set qt_arch=msvc2022_64 mkdir %build_dir% cmake -B %build_dir% -S . ^ -DCMAKE_BUILD_TYPE=%build_type% ^ -DCMAKE_CONFIGURATION_TYPES=%build_type% ^ - -DCMAKE_PREFIX_PATH=C:/Qt/%qt_version%/msvc2019_64 + -DCMAKE_PREFIX_PATH=C:/Qt/%qt_version%/%qt_arch% pause diff --git a/setup-release.sh b/setup-release.sh index 949cabfc..63f52ef6 100755 --- a/setup-release.sh +++ b/setup-release.sh @@ -4,6 +4,7 @@ build_dir=${1:-build-release} build_type=Release qt_version=6.8.0 +qt_arch=gcc_64 script_dir="$(dirname "$(readlink -f "$0")")" mkdir -p ${build_dir} @@ -11,5 +12,5 @@ cmake -B ${build_dir} -S . \ -DCMAKE_BUILD_TYPE=${build_type} \ -DCMAKE_CONFIGURATION_TYPES=${build_type} \ -DCMAKE_INSTALL_PREFIX=${build_dir}/${build_type}/supercell-wx \ - -DCMAKE_PREFIX_PATH=/opt/Qt/${qt_version}/gcc_64 \ + -DCMAKE_PREFIX_PATH=/opt/Qt/${qt_version}/${qt_arch} \ -G Ninja From 685f3cee10976fbdade67add79250f13c316fea6 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Wed, 9 Oct 2024 05:57:27 -0500 Subject: [PATCH 4/6] Update usage of QCheckBox::stateChanged to QCheckBox::checkStateChanged --- scwx-qt/source/scwx/qt/main/main_window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index cadd9c90..861bc69a 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -1080,9 +1080,9 @@ void MainWindowImpl::ConnectOtherSignals() } }); connect(mainWindow_->ui->trackLocationCheckBox, - &QCheckBox::stateChanged, + &QCheckBox::checkStateChanged, mainWindow_, - [this](int state) + [this](Qt::CheckState state) { bool trackingEnabled = (state == Qt::CheckState::Checked); From e9ee5c6911ec8c1e091fce4936a0d06b5b8c10ea Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Fri, 14 Jun 2024 00:41:45 -0500 Subject: [PATCH 5/6] Enable multi-processor compilation for maplibre --- external/maplibre-native-qt.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/external/maplibre-native-qt.cmake b/external/maplibre-native-qt.cmake index 6a508040..49c37bc1 100644 --- a/external/maplibre-native-qt.cmake +++ b/external/maplibre-native-qt.cmake @@ -19,6 +19,17 @@ if (MSVC) target_link_options(MLNQtCore PRIVATE "$<$:/DEBUG>") target_link_options(MLNQtCore PRIVATE "$<$:/OPT:REF>") target_link_options(MLNQtCore PRIVATE "$<$:/OPT:ICF>") + + # Enable multi-processor compilation + target_compile_options(MLNQtCore PRIVATE "/MP") + target_compile_options(mbgl-core PRIVATE "/MP") + target_compile_options(mbgl-vendor-csscolorparser PRIVATE "/MP") + target_compile_options(mbgl-vendor-nunicode PRIVATE "/MP") + target_compile_options(mbgl-vendor-parsedate PRIVATE "/MP") + + if (TARGET mbgl-vendor-sqlite) + target_compile_options(mbgl-vendor-sqlite PRIVATE "/MP") + endif() else() target_compile_options(mbgl-core PRIVATE "$<$:-g>") target_compile_options(MLNQtCore PRIVATE "$<$:-g>") From 9ee6e2ee25375c513293da523382d9a4c18b056b Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 17 Oct 2024 06:17:27 -0500 Subject: [PATCH 6/6] Add Fusion Light and Fusion Dark styles --- scwx-qt/source/scwx/qt/main/main.cpp | 36 +++++++++++++------- scwx-qt/source/scwx/qt/types/qt_types.cpp | 41 ++++++++++++++--------- scwx-qt/source/scwx/qt/types/qt_types.hpp | 11 ++++-- 3 files changed, 58 insertions(+), 30 deletions(-) diff --git a/scwx-qt/source/scwx/qt/main/main.cpp b/scwx-qt/source/scwx/qt/main/main.cpp index 566e9772..d93133a3 100644 --- a/scwx-qt/source/scwx/qt/main/main.cpp +++ b/scwx-qt/source/scwx/qt/main/main.cpp @@ -25,11 +25,13 @@ #include #include #include +#include #include static const std::string logPrefix_ = "scwx::main"; static const auto logger_ = scwx::util::Logger::Create(logPrefix_); +static void ConfigureTheme(const std::vector& args); static void OverrideDefaultStyle(const std::vector& args); int main(int argc, char* argv[]) @@ -103,18 +105,7 @@ int main(int argc, char* argv[]) scwx::qt::manager::ResourceManager::Initialize(); // Theme - auto uiStyle = scwx::qt::types::GetUiStyle( - scwx::qt::settings::GeneralSettings::Instance().theme().GetValue()); - - if (uiStyle == scwx::qt::types::UiStyle::Default) - { - OverrideDefaultStyle(args); - } - else - { - QApplication::setStyle( - QString::fromStdString(scwx::qt::types::GetUiStyleName(uiStyle))); - } + ConfigureTheme(args); // Run initial setup if required if (scwx::qt::ui::setup::SetupWizard::IsSetupRequired()) @@ -152,6 +143,27 @@ int main(int argc, char* argv[]) return result; } +static void ConfigureTheme(const std::vector& args) +{ + auto& generalSettings = scwx::qt::settings::GeneralSettings::Instance(); + + auto uiStyle = + scwx::qt::types::GetUiStyle(generalSettings.theme().GetValue()); + auto qtColorScheme = scwx::qt::types::GetQtColorScheme(uiStyle); + + if (uiStyle == scwx::qt::types::UiStyle::Default) + { + OverrideDefaultStyle(args); + } + else + { + QApplication::setStyle( + QString::fromStdString(scwx::qt::types::GetQtStyleName(uiStyle))); + } + + QGuiApplication::styleHints()->setColorScheme(qtColorScheme); +} + static void OverrideDefaultStyle([[maybe_unused]] const std::vector& args) { diff --git a/scwx-qt/source/scwx/qt/types/qt_types.cpp b/scwx-qt/source/scwx/qt/types/qt_types.cpp index 37717646..da2ef622 100644 --- a/scwx-qt/source/scwx/qt/types/qt_types.cpp +++ b/scwx-qt/source/scwx/qt/types/qt_types.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -9,27 +10,37 @@ namespace qt namespace types { +static const std::unordered_map qtStyleName_ { + {UiStyle::Default, "Default"}, + {UiStyle::Fusion, "Fusion"}, + {UiStyle::FusionLight, "Fusion"}, + {UiStyle::FusionDark, "Fusion"}, + {UiStyle::Unknown, "?"}}; + static const std::unordered_map uiStyleName_ { {UiStyle::Default, "Default"}, {UiStyle::Fusion, "Fusion"}, + {UiStyle::FusionLight, "Fusion Light"}, + {UiStyle::FusionDark, "Fusion Dark"}, {UiStyle::Unknown, "?"}}; -UiStyle GetUiStyle(const std::string& name) +static const std::unordered_map qtColorSchemeMap_ { + {UiStyle::Default, Qt::ColorScheme::Unknown}, + {UiStyle::Fusion, Qt::ColorScheme::Unknown}, + {UiStyle::FusionLight, Qt::ColorScheme::Light}, + {UiStyle::FusionDark, Qt::ColorScheme::Dark}, + {UiStyle::Unknown, Qt::ColorScheme::Unknown}}; + +SCWX_GET_ENUM(UiStyle, GetUiStyle, uiStyleName_) + +Qt::ColorScheme GetQtColorScheme(UiStyle uiStyle) +{ + return qtColorSchemeMap_.at(uiStyle); +} + +std::string GetQtStyleName(UiStyle uiStyle) { - auto result = - std::find_if(uiStyleName_.cbegin(), - uiStyleName_.cend(), - [&](const std::pair& pair) -> bool - { return boost::iequals(pair.second, name); }); - - if (result != uiStyleName_.cend()) - { - return result->first; - } - else - { - return UiStyle::Unknown; - } + return qtStyleName_.at(uiStyle); } std::string GetUiStyleName(UiStyle uiStyle) diff --git a/scwx-qt/source/scwx/qt/types/qt_types.hpp b/scwx-qt/source/scwx/qt/types/qt_types.hpp index 26a41c25..817d5ca1 100644 --- a/scwx-qt/source/scwx/qt/types/qt_types.hpp +++ b/scwx-qt/source/scwx/qt/types/qt_types.hpp @@ -20,17 +20,22 @@ enum ItemDataRole RawDataRole }; -enum UiStyle +enum class UiStyle { Default, Fusion, + FusionLight, + FusionDark, Unknown }; -typedef scwx::util::Iterator +typedef scwx::util::Iterator UiStyleIterator; +Qt::ColorScheme GetQtColorScheme(UiStyle uiStyle); +std::string GetQtStyleName(UiStyle uiStyle); + UiStyle GetUiStyle(const std::string& name); -std::string GetUiStyleName(UiStyle alertAction); +std::string GetUiStyleName(UiStyle uiStyle); } // namespace types } // namespace qt