diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f0dc56..806f0200 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: compiler: msvc msvc_arch: x64 msvc_version: 2022 - qt_version: 6.7.2 - qt_arch_aqt: win64_msvc2019_64 - qt_arch_dir: msvc2019_64 + qt_version: 6.8.0 + qt_arch_aqt: win64_msvc2022_64 + qt_arch_dir: msvc2022_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport qt_tools: '' conan_arch: x86_64 @@ -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/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>") 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/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); 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 diff --git a/setup-debug.bat b/setup-debug.bat index 7ad46d78..14e4f870 100644 --- a/setup-debug.bat +++ b/setup-debug.bat @@ -2,11 +2,12 @@ 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 +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 87067a3b..4f9e72ea 100755 --- a/setup-debug.sh +++ b/setup-debug.sh @@ -3,7 +3,8 @@ build_dir=${1:-build-debug} build_type=Debug -qt_version=6.7.2 +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 3c08d78d..cfcbd3c9 100644 --- a/setup-release.bat +++ b/setup-release.bat @@ -2,11 +2,12 @@ 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 +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 6d81ff8f..63f52ef6 100755 --- a/setup-release.sh +++ b/setup-release.sh @@ -3,7 +3,8 @@ build_dir=${1:-build-release} build_type=Release -qt_version=6.7.2 +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