diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48d9f5ff8a..fedc707bd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,14 +27,14 @@ variables: .Ubuntu_Image: tags: - saas-linux-medium-amd64 - image: ubuntu:22.04 + image: ubuntu:24.04 rules: - if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event" Ubuntu_GCC_preprocess: extends: .Ubuntu_Image cache: - key: Ubuntu_GCC_preprocess.ubuntu_22.04.v1 + key: Ubuntu_GCC_preprocess.ubuntu_24.04.v1 paths: - apt-cache/ - .cache/pip/ @@ -43,7 +43,7 @@ Ubuntu_GCC_preprocess: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" before_script: - CI/install_debian_deps.sh openmw-deps openmw-deps-dynamic gcc_preprocess - - pip3 install --user click termtables + - pip3 install --user --break-system-packages click termtables script: - CI/ubuntu_gcc_preprocess.sh rules: @@ -82,7 +82,7 @@ Ubuntu_GCC_preprocess: - if [[ "${BUILD_TESTS_ONLY}" && ! "${BUILD_WITH_CODE_COVERAGE}" ]]; then ./openmw_settings_access_benchmark; fi - ccache -svv - df -h - - if [[ "${BUILD_WITH_CODE_COVERAGE}" ]]; then gcovr --xml-pretty --exclude-unreachable-branches --print-summary --root "${CI_PROJECT_DIR}" -j $(nproc) -o ../coverage.xml; fi + - if [[ "${BUILD_WITH_CODE_COVERAGE}" ]]; then ~/.local/bin/gcovr --xml-pretty --exclude-unreachable-branches --gcov-ignore-parse-errors=negative_hits.warn_once_per_file --print-summary --root "${CI_PROJECT_DIR}" -j $(nproc) -o ../coverage.xml; fi - ls | grep -v -e '^extern$' -e '^install$' -e '^components-tests.xml$' -e '^openmw-tests.xml$' -e '^openmw-cs-tests.xml$' | xargs -I '{}' rm -rf './{}' - cd .. - df -h @@ -97,12 +97,12 @@ Ubuntu_GCC_preprocess: Coverity: tags: - saas-linux-medium-amd64 - image: ubuntu:22.04 + image: ubuntu:24.04 stage: build rules: - if: $CI_PIPELINE_SOURCE == "schedule" cache: - key: Coverity.ubuntu_22.04.v1 + key: Coverity.ubuntu_24.04.v1 paths: - apt-cache/ - ccache/ @@ -141,7 +141,7 @@ Coverity: Ubuntu_GCC: extends: .Ubuntu cache: - key: Ubuntu_GCC.ubuntu_22.04.v1 + key: Ubuntu_GCC.ubuntu_24.04.v1 before_script: - CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic variables: @@ -154,7 +154,7 @@ Ubuntu_GCC: Ubuntu_GCC_asan: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_asan.ubuntu_22.04.v1 + key: Ubuntu_GCC_asan.ubuntu_24.04.v1 variables: CMAKE_BUILD_TYPE: Debug CMAKE_CXX_FLAGS_DEBUG: -g -O1 -fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak @@ -167,7 +167,7 @@ Clang_Format: extends: .Ubuntu_Image stage: checks cache: - key: Ubuntu_Clang_Format.ubuntu_22.04.v1 + key: Ubuntu_Clang_Format.ubuntu_24.04.v1 paths: - apt-cache/ variables: @@ -183,11 +183,11 @@ Lupdate: extends: .Ubuntu_Image stage: checks cache: - key: Ubuntu_lupdate.ubuntu_22.04.v1 + key: Ubuntu_lupdate.ubuntu_24.04.v1 paths: - apt-cache/ variables: - LUPDATE: lupdate + LUPDATE: /usr/lib/qt6/bin/lupdate before_script: - CI/install_debian_deps.sh openmw-qt-translations script: @@ -209,7 +209,7 @@ Teal: Ubuntu_GCC_Debug: extends: .Ubuntu cache: - key: Ubuntu_GCC_Debug.ubuntu_22.04.v2 + key: Ubuntu_GCC_Debug.ubuntu_24.04.v2 before_script: - CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic variables: @@ -225,7 +225,7 @@ Ubuntu_GCC_Debug: Ubuntu_GCC_tests: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_tests.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -239,7 +239,7 @@ Ubuntu_GCC_tests: .Ubuntu_GCC_tests_Debug: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_tests_Debug.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests_Debug.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -255,7 +255,7 @@ Ubuntu_GCC_tests: Ubuntu_GCC_tests_asan: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_tests_asan.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests_asan.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -278,7 +278,7 @@ Ubuntu_GCC_tests_asan: Ubuntu_GCC_tests_ubsan: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_tests_ubsan.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests_ubsan.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -298,7 +298,7 @@ Ubuntu_GCC_tests_ubsan: .Ubuntu_GCC_tests_tsan: extends: Ubuntu_GCC cache: - key: Ubuntu_GCC_tests_tsan.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests_tsan.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -316,11 +316,15 @@ Ubuntu_GCC_tests_ubsan: Ubuntu_GCC_tests_coverage: extends: .Ubuntu_GCC_tests_Debug cache: - key: Ubuntu_GCC_tests_coverage.ubuntu_22.04.v1 + key: Ubuntu_GCC_tests_coverage.ubuntu_24.04.v1 + paths: + - .cache/pip variables: BUILD_WITH_CODE_COVERAGE: 1 + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" before_script: - CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic openmw-coverage + - pipx install gcovr coverage: /^\s*lines:\s*\d+.\d+\%/ artifacts: paths: [] @@ -345,7 +349,7 @@ Ubuntu_GCC_tests_coverage: - "CI/**/*" - ".gitlab-ci.yml" cache: - key: Ubuntu_Static_Deps.ubuntu_22.04.v1 + key: Ubuntu_Static_Deps.ubuntu_24.04.v1 paths: - apt-cache/ - ccache/ @@ -362,7 +366,7 @@ Ubuntu_GCC_tests_coverage: .Ubuntu_Static_Deps_tests: extends: .Ubuntu_Static_Deps cache: - key: Ubuntu_Static_Deps_tests.ubuntu_22.04.v1 + key: Ubuntu_Static_Deps_tests.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -381,7 +385,7 @@ Ubuntu_Clang: before_script: - CI/install_debian_deps.sh clang openmw-deps openmw-deps-dynamic cache: - key: Ubuntu_Clang.ubuntu_22.04.v2 + key: Ubuntu_Clang.ubuntu_24.04.v2 variables: CC: clang CXX: clang++ @@ -394,7 +398,7 @@ Ubuntu_Clang: before_script: - CI/install_debian_deps.sh clang clang-tidy openmw-deps openmw-deps-dynamic cache: - key: Ubuntu_Clang_Tidy.ubuntu_22.04.v1 + key: Ubuntu_Clang_Tidy.ubuntu_24.04.v1 variables: CMAKE_BUILD_TYPE: Debug CMAKE_CXX_FLAGS_DEBUG: -O0 @@ -451,7 +455,7 @@ Ubuntu_Clang_Tidy_other: .Ubuntu_Clang_tests: extends: Ubuntu_Clang cache: - key: Ubuntu_Clang_tests.ubuntu_22.04.v1 + key: Ubuntu_Clang_tests.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -465,7 +469,7 @@ Ubuntu_Clang_Tidy_other: Ubuntu_Clang_tests_Debug: extends: Ubuntu_Clang cache: - key: Ubuntu_Clang_tests_Debug.ubuntu_22.04.v1 + key: Ubuntu_Clang_tests_Debug.ubuntu_24.04.v1 variables: CCACHE_SIZE: 1G BUILD_TESTS_ONLY: 1 @@ -489,7 +493,7 @@ Ubuntu_Clang_tests_Debug: - apt-cache/ before_script: - CI/install_debian_deps.sh $OPENMW_DEPS - - pip3 install --user numpy matplotlib termtables click + - pip3 install --user --break-system-packages numpy matplotlib termtables click script: - CI/run_integration_tests.sh after_script: @@ -500,7 +504,7 @@ Ubuntu_Clang_integration_tests: needs: - Ubuntu_Clang cache: - key: Ubuntu_Clang_integration_tests.ubuntu_22.04.v2 + key: Ubuntu_Clang_integration_tests.ubuntu_24.04.v2 variables: OPENMW_DEPS: openmw-integration-tests @@ -509,9 +513,9 @@ Ubuntu_GCC_integration_tests_asan: needs: - Ubuntu_GCC_asan cache: - key: Ubuntu_GCC_integration_tests_asan.ubuntu_22.04.v1 + key: Ubuntu_GCC_integration_tests_asan.ubuntu_24.04.v1 variables: - OPENMW_DEPS: openmw-integration-tests libasan6 + OPENMW_DEPS: openmw-integration-tests libasan ASAN_OPTIONS: halt_on_error=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=0 .MacOS: @@ -990,7 +994,7 @@ Windows_MSBuild_CacheInit: paths: - .cache/pip before_script: - - pip3 install --user requests click discord_webhook + - pip3 install --user --break-system-packages requests click discord_webhook script: - scripts/find_missing_merge_requests.py --project_id=$CI_PROJECT_ID --ignored_mrs_path=$CI_PROJECT_DIR/.resubmitted_merge_requests.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 5435835606..a2df2e025e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ------ Bug #2967: Inventory windows don't update when changing items by script + Bug #4437: Transformations for NiSkinInstance are ignored + Bug #4885: Disable in dialogue result script causes a crash Bug #5331: Pathfinding works incorrectly when actor is moved from one interior cell to another Bug #6039: Next Spell keybind fails while selected enchanted item has multiple copies Bug #6573: Editor: Selection behaves incorrectly on high-DPI displays @@ -9,9 +11,11 @@ Bug #7371: Equipping item from inventory does not play a Down sound when equipping fails Bug #7622: Player's marksman weapons don't work on close actors underwater Bug #7649: The sound and vfx of resisted enchanted items' magic still play + Bug #7693: I.ItemUsage should return an item to the selected stack if equipping/consumption is denied Bug #7740: Magic items in the HUD aren't composited correctly Bug #7799: Picking up ingredients while object paging active grid is on may cause a hiccup Bug #7871: Kwama Queen doesn't start combat with player + Bug #7979: Paralyzed NPCs battlecry Bug #8245: The console command ShowVars does not list global mwscripts Bug #8265: Topics are linked incorrectly Bug #8303: On target spells cast by non-actors should fire underwater @@ -25,30 +29,40 @@ Bug #8375: Moon phase cycle doesn't match Morrowind Bug #8383: Casting bound helm or boots on beast races doesn't cleanup properly Bug #8385: Russian encoding broken with locale parameters and calendar + Bug #8404: Prevent merchant equipping breaks on lights Bug #8408: OpenMW doesn't report all the potential resting hindrances Bug #8414: Waterwalking works when collision is disabled Bug #8431: Behaviour of removed items from a container is buggy Bug #8432: Changing to and from an interior cell doesn't update collision + Bug #8433: Wandering NPCs are not capable of avoiding easy obstacles Bug #8436: Spell selection in a pinned spellbook window doesn't update Bug #8437: Pinned inventory window's pin button doesn't look pressed Bug #8446: Travel prices are strangely inconsistent + Bug #8447: Werewolf swimming animation breaks in third person perspective Bug #8459: Changing magic effect base cost doesn't change spell price Bug #8466: Showmap "" reveals nameless cells Bug #8485: Witchwither disease and probably other common diseases don't work correctly Bug #8490: Normals on Water disappear when Water Shader is Enabled but Refraction is Disabled Bug #8500: OpenMW Alarm behaviour doesn't match morrowind.exe Bug #8519: Multiple bounty is sometimes assigned to player when detected during a pickpocketing action + Bug #8540: Magic resistance is applied to effects without a magnitude + Bug #8557: Charm's disposition changes capped on 100, uncapped below 0 + Bug #8582: addScript-attached local scripts start out inactive Bug #8585: Dialogue topic list doesn't have enough padding Bug #8587: Minor INI importer problems Bug #8593: Render targets do not generate mipmaps Bug #8598: Post processing shaders don't interact with the vfs correctly Bug #8599: Non-ASCII paths in BSA files don't work + Bug #8606: Floating point imprecision can mess with container capacity Bug #8609: The crosshair is too large Bug #8610: Terrain normal maps using NormalGL format instead of NormalDX Bug #8612: Using aiactivate on an ingredient when graphical herbalism is enabled triggers non-stop pickup sounds + Bug #8614: Lua garbage collection fails to remove unused data Bug #8615: Rest/wait time progress speed is different from vanilla Feature #2522: Support quick item transfer Feature #3769: Allow GetSpellEffects on enchantments + Feature #6976: [Lua] Weather API + Feature #8077: Save settings changes when clicking "ok"/closing the window Feature #8112: Expose landscape record data to Lua Feature #8113: Support extended selection in autodetected subdirectory dialog Feature #8139: Editor: Redesign the selection markers @@ -57,8 +71,10 @@ Feature #8320: Add access mwscript source text to lua api Feature #8334: Lua: AddTopic equivalent Feature #8355: Lua: Window visibility checking in interfaces.UI + Feature #8509: FillJournal script instruction Feature #8580: Sort characters in the save loading menu Feature #8597: Lua: Add more built-in event handlers + Feature #8629: Expose path grid data to Lua 0.49.0 ------ diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 9363211e9a..4f62ef03d9 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -708,17 +708,12 @@ printf "Qt ${QT_VER}... " DLLSUFFIX="" fi - if [ "${QT_MAJOR_VER}" -eq 6 ]; then - add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,OpenGLWidgets,Widgets,Svg}${DLLSUFFIX}.dll + add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,OpenGLWidgets,Widgets,Svg}${DLLSUFFIX}.dll - # Since Qt 6.7.0 plugin is called "qmodernwindowsstyle" - if [ "${QT_MINOR_VER}" -ge 7 ]; then - add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qmodernwindowsstyle${DLLSUFFIX}.dll" - else - add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll" - fi + # Since Qt 6.7.0 plugin is called "qmodernwindowsstyle" + if [ "${QT_MINOR_VER}" -ge 7 ]; then + add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qmodernwindowsstyle${DLLSUFFIX}.dll" else - add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_MAJOR_VER}"{Core,Gui,Network,OpenGL,Widgets,Svg}${DLLSUFFIX}.dll add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll" fi diff --git a/CI/install_debian_deps.sh b/CI/install_debian_deps.sh index 3ba66133ca..4f0e7cdb69 100755 --- a/CI/install_debian_deps.sh +++ b/CI/install_debian_deps.sh @@ -33,10 +33,10 @@ declare -rA GROUPED_DEPS=( libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev - libsdl2-dev libqt5opengl5-dev qttools5-dev qttools5-dev-tools libopenal-dev + libsdl2-dev libqt6opengl6-dev qt6-tools-dev qt6-tools-dev-tools libopenal-dev libunshield-dev libtinyxml-dev libbullet-dev liblz4-dev libpng-dev libjpeg-dev libluajit-5.1-dev librecast-dev libsqlite3-dev ca-certificates libicu-dev - libyaml-cpp-dev libqt5svg5 libqt5svg5-dev + libyaml-cpp-dev libqt6svg6 libqt6svg6-dev " # These dependencies can alternatively be built and linked statically. @@ -57,22 +57,22 @@ declare -rA GROUPED_DEPS=( libsdl2-dev libboost-system-dev libboost-filesystem-dev libgl-dev " - [openmw-coverage]="gcovr" + [openmw-coverage]="pipx" [openmw-integration-tests]=" ca-certificates gdb git git-lfs - libavcodec58 - libavformat58 - libavutil56 - libboost-iostreams1.74.0 - libboost-program-options1.74.0 - libboost-system1.74.0 + libavcodec60 + libavformat60 + libavutil58 + libboost-iostreams1.83.0 + libboost-program-options1.83.0 + libboost-system1.83.0 libbullet3.24 libcollada-dom2.5-dp0 - libicu70 + libicu74 libjpeg8 libluajit-5.1-2 liblz4-1 @@ -80,19 +80,19 @@ declare -rA GROUPED_DEPS=( libopenal1 libopenscenegraph161 libpng16-16 - libqt5opengl5 + libqt6opengl6 librecast1 libsdl2-2.0-0 libsqlite3-0 - libswresample3 - libswscale5 + libswresample4 + libswscale7 libtinyxml2.6.2v5 libyaml-cpp0.8 python3-pip xvfb " - [libasan6]="libasan6" + [libasan]="libasan8" [android]="binutils build-essential cmake ccache curl unzip git pkg-config" @@ -102,8 +102,8 @@ declare -rA GROUPED_DEPS=( " [openmw-qt-translations]=" - qttools5-dev - qttools5-dev-tools + qt6-tools-dev + qt6-tools-dev-tools git-core " ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d9aae646..db79dc2767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MINOR 50) set(OPENMW_VERSION_RELEASE 0) -set(OPENMW_LUA_API_REVISION 83) +set(OPENMW_LUA_API_REVISION 84) set(OPENMW_POSTPROCESSING_API_REVISION 3) set(OPENMW_VERSION_COMMITHASH "") @@ -249,12 +249,8 @@ endif() find_package(LZ4 REQUIRED) if (USE_QT) - find_package(QT REQUIRED COMPONENTS Core NAMES Qt6 Qt5) - if (QT_VERSION_MAJOR VERSION_EQUAL 5) - find_package(Qt5 5.15 COMPONENTS Core Widgets Network OpenGL LinguistTools Svg REQUIRED) - else() - find_package(Qt6 COMPONENTS Core Widgets Network OpenGL OpenGLWidgets LinguistTools Svg REQUIRED) - endif() + find_package(QT REQUIRED COMPONENTS Core NAMES Qt6) + find_package(Qt6 COMPONENTS Core Widgets Network OpenGL OpenGLWidgets LinguistTools Svg REQUIRED) message(STATUS "Using Qt${QT_VERSION}") endif() diff --git a/apps/components_tests/detournavigator/navigator.cpp b/apps/components_tests/detournavigator/navigator.cpp index a6e1d26c79..d2b48ce623 100644 --- a/apps/components_tests/detournavigator/navigator.cpp +++ b/apps/components_tests/detournavigator/navigator.cpp @@ -985,7 +985,7 @@ namespace 0, 0, 0, 0, 0, // row 0 0, 0, 0, 0, 0, // row 1 0, 0, 1000, 0, 0, // row 2 - 0, 0, 0, 0, 0, // row 3 + 0, 0, 1000, 0, 0, // row 3 0, 0, 0, 0, 0, // row 4 } }; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); @@ -1017,7 +1017,7 @@ namespace 0, 0, 0, 0, 0, // row 0 0, 0, 0, 0, 0, // row 1 0, 0, -1000, 0, 0, // row 2 - 0, 0, 0, 0, 0, // row 3 + 0, 0, -1000, 0, 0, // row 3 0, 0, 0, 0, 0, // row 4 } }; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); @@ -1049,7 +1049,7 @@ namespace 0, 0, 0, 0, 0, // row 0 0, 0, 0, 0, 0, // row 1 0, 0, 1000, 0, 0, // row 2 - 0, 0, 0, 0, 0, // row 3 + 0, 0, 1000, 0, 0, // row 3 0, 0, 0, 0, 0, // row 4 } }; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); @@ -1086,7 +1086,7 @@ namespace 0, 0, 0, 0, 0, // row 0 0, 0, 0, 0, 0, // row 1 0, 0, 1000, 0, 0, // row 2 - 0, 0, 0, 0, 0, // row 3 + 0, 0, 1000, 0, 0, // row 3 0, 0, 0, 0, 0, // row 4 } }; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); diff --git a/apps/launcher/importpage.cpp b/apps/launcher/importpage.cpp index 3ad6e538da..461ba4c2eb 100644 --- a/apps/launcher/importpage.cpp +++ b/apps/launcher/importpage.cpp @@ -88,11 +88,7 @@ void Launcher::ImportPage::on_importerButton_clicked() // Create the file if it doesn't already exist, else the importer will fail auto path = mCfgMgr.getUserConfigPath(); path /= "openmw.cfg"; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFile file(path); -#else - QFile file(Files::pathToQString(path)); -#endif if (!file.exists()) { diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 07face085f..2aa80d346c 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -497,11 +497,7 @@ bool Launcher::MainDialog::writeSettings() } // Game settings -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFile file(userPath / Files::openmwCfgFile); -#else - QFile file(Files::getUserConfigPathQString(mCfgMgr)); -#endif if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 0a278316e3..c9ca7838be 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -240,11 +240,7 @@ target_link_libraries(openmw-cs-lib components_qt ) -if (QT_VERSION_MAJOR VERSION_EQUAL 6) - target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::OpenGLWidgets Qt::Svg) -else() - target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::Svg) -endif() +target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL Qt::OpenGLWidgets Qt::Svg) if (WIN32) target_sources(openmw-cs PRIVATE ${CMAKE_SOURCE_DIR}/files/windows/openmw-cs.exe.manifest) diff --git a/apps/opencs/model/filter/textnode.cpp b/apps/opencs/model/filter/textnode.cpp index 7d837f9e54..e8b89c5277 100644 --- a/apps/opencs/model/filter/textnode.cpp +++ b/apps/opencs/model/filter/textnode.cpp @@ -34,11 +34,11 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons QString string; - if (data.type() == QVariant::String) + if (data.typeId() == QMetaType::QString) { string = data.toString(); } - else if ((data.type() == QVariant::Int || data.type() == QVariant::UInt) + else if ((data.typeId() == QMetaType::Int || data.typeId() == QMetaType::UInt) && CSMWorld::Columns::hasEnums(static_cast(mColumnId))) { int value = data.toInt(); @@ -49,7 +49,7 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons if (value >= 0 && value < static_cast(enums.size())) string = QString::fromUtf8(enums[value].second.c_str()); } - else if (data.type() == QVariant::Bool) + else if (data.typeId() == QMetaType::Bool) { string = data.toBool() ? "true" : "false"; } diff --git a/apps/opencs/model/filter/valuenode.cpp b/apps/opencs/model/filter/valuenode.cpp index 264967f240..abbf00aecd 100644 --- a/apps/opencs/model/filter/valuenode.cpp +++ b/apps/opencs/model/filter/valuenode.cpp @@ -29,8 +29,8 @@ bool CSMFilter::ValueNode::test(const CSMWorld::IdTableBase& table, int row, con QVariant data = table.data(index); - if (data.type() != QVariant::Double && data.type() != QVariant::Bool && data.type() != QVariant::Int - && data.type() != QVariant::UInt && data.type() != static_cast(QMetaType::Float)) + if (data.typeId() != QMetaType::Double && data.typeId() != QMetaType::Bool && data.typeId() != QMetaType::Int + && data.typeId() != QMetaType::UInt && data.typeId() != QMetaType::Float) return false; double value = data.toDouble(); diff --git a/apps/opencs/model/prefs/shortcuteventhandler.cpp b/apps/opencs/model/prefs/shortcuteventhandler.cpp index 4bbda2996f..a7e9dfbb3a 100644 --- a/apps/opencs/model/prefs/shortcuteventhandler.cpp +++ b/apps/opencs/model/prefs/shortcuteventhandler.cpp @@ -62,39 +62,31 @@ namespace CSMPrefs { QWidget* widget = static_cast(watched); QKeyEvent* keyEvent = static_cast(event); - unsigned int mod = (unsigned int)keyEvent->modifiers(); - unsigned int key = (unsigned int)keyEvent->key(); if (!keyEvent->isAutoRepeat()) - return activate(widget, mod, key); + return activate(widget, keyEvent->keyCombination()); } else if (event->type() == QEvent::KeyRelease) { QWidget* widget = static_cast(watched); QKeyEvent* keyEvent = static_cast(event); - unsigned int mod = (unsigned int)keyEvent->modifiers(); - unsigned int key = (unsigned int)keyEvent->key(); if (!keyEvent->isAutoRepeat()) - return deactivate(widget, mod, key); + return deactivate(widget, keyEvent->keyCombination()); } else if (event->type() == QEvent::MouseButtonPress) { QWidget* widget = static_cast(watched); QMouseEvent* mouseEvent = static_cast(event); - unsigned int mod = (unsigned int)mouseEvent->modifiers(); - unsigned int button = (unsigned int)mouseEvent->button(); - return activate(widget, mod, button); + return activate(widget, QKeyCombination(mouseEvent->modifiers(), Qt::Key(mouseEvent->button()))); } else if (event->type() == QEvent::MouseButtonRelease) { QWidget* widget = static_cast(watched); QMouseEvent* mouseEvent = static_cast(event); - unsigned int mod = (unsigned int)mouseEvent->modifiers(); - unsigned int button = (unsigned int)mouseEvent->button(); - return deactivate(widget, mod, button); + return deactivate(widget, QKeyCombination(mouseEvent->modifiers(), Qt::Key(mouseEvent->button()))); } else if (event->type() == QEvent::FocusOut) { @@ -149,7 +141,7 @@ namespace CSMPrefs } } - bool ShortcutEventHandler::activate(QWidget* widget, unsigned int mod, unsigned int button) + bool ShortcutEventHandler::activate(QWidget* widget, QKeyCombination keyCombination) { std::vector> potentials; bool used = false; @@ -167,7 +159,7 @@ namespace CSMPrefs if (!shortcut->isEnabled()) continue; - if (checkModifier(mod, button, shortcut, true)) + if (checkModifier(keyCombination, shortcut, true)) used = true; if (shortcut->getActivationStatus() != Shortcut::AS_Inactive) @@ -175,7 +167,8 @@ namespace CSMPrefs int pos = shortcut->getPosition(); int lastPos = shortcut->getLastPosition(); - MatchResult result = match(mod, button, shortcut->getSequence()[pos]); + MatchResult result = match(keyCombination.keyboardModifiers(), keyCombination.key(), + shortcut->getSequence()[pos].toCombined()); if (result == Matches_WithMod || result == Matches_NoMod) { @@ -220,10 +213,8 @@ namespace CSMPrefs return used; } - bool ShortcutEventHandler::deactivate(QWidget* widget, unsigned int mod, unsigned int button) + bool ShortcutEventHandler::deactivate(QWidget* widget, QKeyCombination keyCombination) { - const int KeyMask = 0x01FFFFFF; - bool used = false; while (widget) @@ -235,11 +226,11 @@ namespace CSMPrefs { Shortcut* shortcut = *it; - if (checkModifier(mod, button, shortcut, false)) + if (checkModifier(keyCombination, shortcut, false)) used = true; int pos = shortcut->getPosition(); - MatchResult result = match(0, button, shortcut->getSequence()[pos] & KeyMask); + MatchResult result = match(0, keyCombination.key(), shortcut->getSequence()[pos].key()); if (result != Matches_Not) { @@ -268,13 +259,13 @@ namespace CSMPrefs return used; } - bool ShortcutEventHandler::checkModifier(unsigned int mod, unsigned int button, Shortcut* shortcut, bool activate) + bool ShortcutEventHandler::checkModifier(QKeyCombination keyCombination, Shortcut* shortcut, bool activate) { if (!shortcut->isEnabled() || !shortcut->getModifier() || shortcut->getSecondaryMode() == Shortcut::SM_Ignore || shortcut->getModifierStatus() == activate) return false; - MatchResult result = match(mod, button, shortcut->getModifier()); + MatchResult result = match(keyCombination.keyboardModifiers(), keyCombination.key(), shortcut->getModifier()); bool used = false; if (result != Matches_Not) diff --git a/apps/opencs/model/prefs/shortcuteventhandler.hpp b/apps/opencs/model/prefs/shortcuteventhandler.hpp index 2093e259e9..cc94797450 100644 --- a/apps/opencs/model/prefs/shortcuteventhandler.hpp +++ b/apps/opencs/model/prefs/shortcuteventhandler.hpp @@ -42,11 +42,11 @@ namespace CSMPrefs void updateParent(QWidget* widget); - bool activate(QWidget* widget, unsigned int mod, unsigned int button); + bool activate(QWidget* widget, QKeyCombination keyCombination); - bool deactivate(QWidget* widget, unsigned int mod, unsigned int button); + bool deactivate(QWidget* widget, QKeyCombination keyCombination); - bool checkModifier(unsigned int mod, unsigned int button, Shortcut* shortcut, bool activate); + bool checkModifier(QKeyCombination keyCombination, Shortcut* shortcut, bool activate); MatchResult match(unsigned int mod, unsigned int button, unsigned int value); diff --git a/apps/opencs/model/prefs/shortcutmanager.cpp b/apps/opencs/model/prefs/shortcutmanager.cpp index ac032efffb..2ffa042641 100644 --- a/apps/opencs/model/prefs/shortcutmanager.cpp +++ b/apps/opencs/model/prefs/shortcutmanager.cpp @@ -115,15 +115,12 @@ namespace CSMPrefs std::string ShortcutManager::convertToString(const QKeySequence& sequence) const { - const int MouseKeyMask = 0x01FFFFFF; - const int ModMask = 0x7E000000; - std::string result; - for (int i = 0; i < (int)sequence.count(); ++i) + for (int i = 0; i < sequence.count(); ++i) { - int mods = sequence[i] & ModMask; - int key = sequence[i] & MouseKeyMask; + int mods = sequence[i].keyboardModifiers(); + int key = sequence[i].key(); if (key) { diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index b80d150448..4d191b90a4 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -59,13 +59,6 @@ void CSMPrefs::State::declare() .setTooltip("Minimum width of subviews.") .setRange(50, 10000); declareEnum(mValues->mWindows.mMainwindowScrollbar, "Main Window Horizontal Scrollbar Mode"); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - declareBool(mValues->mWindows.mGrowLimit, "Grow Limit Screen") - .setTooltip( - "When \"Grow then Scroll\" option is selected, the window size grows to" - " the width of the virtual desktop. \nIf this option is selected the the window growth" - "is limited to the current screen."); -#endif declareCategory("Records"); declareEnum(mValues->mRecords.mStatusFormat, "Modification Status Display Format"); diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index afcab50ead..ffc7400da3 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -659,11 +659,7 @@ void CSVDoc::View::addSubView(const CSMWorld::UniversalId& id, const std::string // mScrollbarOnly = windows["mainwindow-scrollbar"].toString() == "Scrollbar Only"; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - updateWidth(windows["grow-limit"].isTrue(), minWidth); -#else updateWidth(true, minWidth); -#endif mSubViewWindow.addDockWidget(Qt::TopDockWidgetArea, view); diff --git a/apps/opencs/view/filter/editwidget.hpp b/apps/opencs/view/filter/editwidget.hpp index f2ecd5f642..7efbd8e7a3 100644 --- a/apps/opencs/view/filter/editwidget.hpp +++ b/apps/opencs/view/filter/editwidget.hpp @@ -50,7 +50,7 @@ namespace CSVFilter std::pair operator()(const QVariant& variantData) { FilterType filterType = FilterType::String; - QMetaType::Type dataType = static_cast(variantData.type()); + QMetaType::Type dataType = static_cast(variantData.typeId()); if (dataType == QMetaType::QString || dataType == QMetaType::Bool || dataType == QMetaType::Int) filterType = FilterType::String; if (dataType == QMetaType::Int || dataType == QMetaType::Float) diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index 76cfd57ba6..e100a69a7c 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -1132,7 +1132,7 @@ void CSVRender::InstanceMode::dropEvent(QDropEvent* event) return; WorldspaceHitResult hit - = getWorldspaceWidget().mousePick(event->pos(), getWorldspaceWidget().getInteractionMask()); + = getWorldspaceWidget().mousePick(event->position().toPoint(), getWorldspaceWidget().getInteractionMask()); std::string cellId = getWorldspaceWidget().getCellId(hit.worldPos); diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index e84433f14c..5e8db03cf8 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -161,8 +161,6 @@ namespace CSVRender , mLighting(nullptr) , mHasDefaultAmbient(false) , mIsExterior(true) - , mPrevMouseX(0) - , mPrevMouseY(0) , mCamPositionSet(false) { mFreeCamControl = new FreeCameraController(this); @@ -423,10 +421,10 @@ namespace CSVRender void SceneWidget::mouseMoveEvent(QMouseEvent* event) { - mCurrentCamControl->handleMouseMoveEvent(event->x() - mPrevMouseX, event->y() - mPrevMouseY); + QPointF pos = event->position(); + mCurrentCamControl->handleMouseMoveEvent(pos.x() - mPrevMouse.x(), pos.y() - mPrevMouse.y()); - mPrevMouseX = event->x(); - mPrevMouseY = event->y(); + mPrevMouse = pos; } void SceneWidget::wheelEvent(QWheelEvent* event) diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index aeec5d191c..2e9526eff6 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -137,7 +137,7 @@ namespace CSVRender LightingNight mLightingNight; LightingBright mLightingBright; - int mPrevMouseX, mPrevMouseY; + QPointF mPrevMouse; /// Tells update that camera isn't set bool mCamPositionSet; diff --git a/apps/opencs/view/render/terrainshapemode.cpp b/apps/opencs/view/render/terrainshapemode.cpp index bc1c6c6365..4f8bd44f05 100644 --- a/apps/opencs/view/render/terrainshapemode.cpp +++ b/apps/opencs/view/render/terrainshapemode.cpp @@ -1661,7 +1661,7 @@ void CSVRender::TerrainShapeMode::dragMoveEvent(QDragMoveEvent* event) {} void CSVRender::TerrainShapeMode::mouseMoveEvent(QMouseEvent* event) { - WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask()); + WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->position().toPoint(), getInteractionMask()); if (hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); if (!hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index cfc7f50cf1..b3fd64705d 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -724,7 +724,7 @@ void CSVRender::TerrainTextureMode::dragMoveEvent(QDragMoveEvent* event) {} void CSVRender::TerrainTextureMode::mouseMoveEvent(QMouseEvent* event) { - WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask()); + WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->position().toPoint(), getInteractionMask()); if (hit.hit && mBrushDraw) mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); if (!hit.hit && mBrushDraw) diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 915282ab45..836f5ff0ea 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -687,11 +687,12 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent(QMouseEvent* event) if (mDragging) { - int diffX = event->x() - mDragX; - int diffY = (height() - event->y()) - mDragY; + QPoint pos = event->position().toPoint(); + int diffX = pos.x() - mDragX; + int diffY = (height() - pos.y()) - mDragY; - mDragX = event->x(); - mDragY = height() - event->y(); + mDragX = pos.x(); + mDragY = height() - pos.y(); double factor = mDragFactor; @@ -700,32 +701,32 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent(QMouseEvent* event) EditMode& editMode = dynamic_cast(*mEditMode->getCurrent()); - editMode.drag(event->pos(), diffX, diffY, factor); + editMode.drag(event->position().toPoint(), diffX, diffY, factor); } else if (mDragMode != InteractionType_None) { EditMode& editMode = dynamic_cast(*mEditMode->getCurrent()); if (mDragMode == InteractionType_PrimaryEdit) - mDragging = editMode.primaryEditStartDrag(event->pos()); + mDragging = editMode.primaryEditStartDrag(event->position().toPoint()); else if (mDragMode == InteractionType_SecondaryEdit) - mDragging = editMode.secondaryEditStartDrag(event->pos()); + mDragging = editMode.secondaryEditStartDrag(event->position().toPoint()); else if (mDragMode == InteractionType_PrimarySelect) - mDragging = editMode.primarySelectStartDrag(event->pos()); + mDragging = editMode.primarySelectStartDrag(event->position().toPoint()); else if (mDragMode == InteractionType_SecondarySelect) - mDragging = editMode.secondarySelectStartDrag(event->pos()); + mDragging = editMode.secondarySelectStartDrag(event->position().toPoint()); if (mDragging) { - mDragX = event->localPos().x(); - mDragY = height() - event->localPos().y(); + mDragX = event->position().x(); + mDragY = height() - event->position().y(); } } else { - if (event->globalPos() != mToolTipPos) + if (event->globalPosition().toPoint() != mToolTipPos) { - mToolTipPos = event->globalPos(); + mToolTipPos = event->globalPosition().toPoint(); if (mShowToolTips) { @@ -734,7 +735,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent(QMouseEvent* event) } } - const QPointF& pos = event->localPos(); + QPoint pos = event->position().toPoint(); handleMarkerHighlight(pos.x(), pos.y()); SceneWidget::mouseMoveEvent(event); } diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index a223a54388..831ed13640 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -260,8 +260,6 @@ namespace CSVRender void settingChanged(const CSMPrefs::Setting* setting) override; - bool getSpeedMode(); - void cycleNavigationMode(); private: diff --git a/apps/opencs/view/tools/reporttable.cpp b/apps/opencs/view/tools/reporttable.cpp index 7ec55b96b5..8c92d9980f 100644 --- a/apps/opencs/view/tools/reporttable.cpp +++ b/apps/opencs/view/tools/reporttable.cpp @@ -93,7 +93,7 @@ void CSVTools::ReportTable::contextMenuEvent(QContextMenuEvent* event) void CSVTools::ReportTable::mouseMoveEvent(QMouseEvent* event) { if (event->buttons() & Qt::LeftButton) - startDragFromTable(*this, indexAt(event->pos())); + startDragFromTable(*this, indexAt(event->position().toPoint())); } void CSVTools::ReportTable::mouseDoubleClickEvent(QMouseEvent* event) diff --git a/apps/opencs/view/widget/colorpickerpopup.cpp b/apps/opencs/view/widget/colorpickerpopup.cpp index 87c62e137b..0918e798a5 100644 --- a/apps/opencs/view/widget/colorpickerpopup.cpp +++ b/apps/opencs/view/widget/colorpickerpopup.cpp @@ -52,7 +52,7 @@ void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent* event) // If the mouse is pressed above the pop-up parent, // the pop-up will be hidden and the pressed signal won't be repeated for the parent - if (buttonRect.contains(event->globalPos()) || buttonRect.contains(event->pos())) + if (buttonRect.contains(event->globalPosition().toPoint()) || buttonRect.contains(event->position().toPoint())) { setAttribute(Qt::WA_NoMouseReplay); } diff --git a/apps/opencs/view/widget/completerpopup.cpp b/apps/opencs/view/widget/completerpopup.cpp index 91b0902659..25daee1f1f 100644 --- a/apps/opencs/view/widget/completerpopup.cpp +++ b/apps/opencs/view/widget/completerpopup.cpp @@ -22,12 +22,8 @@ int CSVWidget::CompleterPopup::sizeHintForRow(int row) const ensurePolished(); QModelIndex index = model()->index(row, modelColumn()); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QStyleOptionViewItem option; initViewItemOption(&option); -#else - QStyleOptionViewItem option = viewOptions(); -#endif - QAbstractItemDelegate* delegate = itemDelegate(index); + QAbstractItemDelegate* delegate = itemDelegateForIndex(index); return delegate->sizeHint(option, index).height(); } diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 168e555eae..ac69805134 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -85,7 +85,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData(QWidget* editor, const QMod CSMWorld::Columns::ColumnId columnId = static_cast(mTable->getColumnId(index.column())); - if (QVariant::String == v.type()) + if (QMetaType::QString == v.typeId()) { label->setText(v.toString()); } diff --git a/apps/opencs/view/world/dragrecordtable.cpp b/apps/opencs/view/world/dragrecordtable.cpp index a006779ba4..adff809335 100644 --- a/apps/opencs/view/world/dragrecordtable.cpp +++ b/apps/opencs/view/world/dragrecordtable.cpp @@ -55,7 +55,7 @@ void CSVWorld::DragRecordTable::dragEnterEvent(QDragEnterEvent* event) void CSVWorld::DragRecordTable::dragMoveEvent(QDragMoveEvent* event) { - QModelIndex index = indexAt(event->pos()); + QModelIndex index = indexAt(event->position().toPoint()); if (CSVWorld::DragDropUtils::canAcceptData(*event, getIndexDisplayType(index)) || CSVWorld::DragDropUtils::isInfo(*event, getIndexDisplayType(index)) || CSVWorld::DragDropUtils::isTopicOrJournal(*event, getIndexDisplayType(index))) @@ -71,7 +71,7 @@ void CSVWorld::DragRecordTable::dragMoveEvent(QDragMoveEvent* event) void CSVWorld::DragRecordTable::dropEvent(QDropEvent* event) { - QModelIndex index = indexAt(event->pos()); + QModelIndex index = indexAt(event->position().toPoint()); CSMWorld::ColumnBase::Display display = getIndexDisplayType(index); if (CSVWorld::DragDropUtils::canAcceptData(*event, display)) { diff --git a/apps/opencs/view/world/regionmap.cpp b/apps/opencs/view/world/regionmap.cpp index 17d0016afc..ae9ac94022 100644 --- a/apps/opencs/view/world/regionmap.cpp +++ b/apps/opencs/view/world/regionmap.cpp @@ -341,7 +341,7 @@ void CSVWorld::RegionMap::viewInTable() void CSVWorld::RegionMap::mouseMoveEvent(QMouseEvent* event) { - startDragFromTable(*this, indexAt(event->pos())); + startDragFromTable(*this, indexAt(event->position().toPoint())); } std::vector CSVWorld::RegionMap::getDraggedRecords() const @@ -376,7 +376,7 @@ void CSVWorld::RegionMap::dragMoveEvent(QDragMoveEvent* event) void CSVWorld::RegionMap::dropEvent(QDropEvent* event) { - QModelIndex index = indexAt(event->pos()); + QModelIndex index = indexAt(event->position().toPoint()); bool exists = QTableView::model()->data(index, Qt::BackgroundRole) != QBrush(Qt::DiagCrossPattern); if (!index.isValid() || !exists) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 00acf71235..2871e0ced1 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -136,7 +136,7 @@ void CSVWorld::ScriptEdit::dragEnterEvent(QDragEnterEvent* event) QPlainTextEdit::dragEnterEvent(event); else { - setTextCursor(cursorForPosition(event->pos())); + setTextCursor(cursorForPosition(event->position().toPoint())); event->acceptProposedAction(); } } @@ -148,7 +148,7 @@ void CSVWorld::ScriptEdit::dragMoveEvent(QDragMoveEvent* event) QPlainTextEdit::dragMoveEvent(event); else { - setTextCursor(cursorForPosition(event->pos())); + setTextCursor(cursorForPosition(event->position().toPoint())); event->accept(); } } @@ -162,7 +162,7 @@ void CSVWorld::ScriptEdit::dropEvent(QDropEvent* event) return; } - setTextCursor(cursorForPosition(event->pos())); + setTextCursor(cursorForPosition(event->position().toPoint())); if (mime->fromDocument(mDocument)) { diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 86a1e93bbd..2cadbf289a 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -592,7 +592,7 @@ void CSVWorld::Table::moveRecords(QDropEvent* event) if (mEditLock || (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_Constant)) return; - QModelIndex targedIndex = indexAt(event->pos()); + QModelIndex targedIndex = indexAt(event->position().toPoint()); QModelIndexList selectedRows = selectionModel()->selectedRows(); int targetRowRaw = targedIndex.row(); @@ -872,7 +872,7 @@ void CSVWorld::Table::mouseMoveEvent(QMouseEvent* event) { if (event->buttons() & Qt::LeftButton) { - startDragFromTable(*this, indexAt(event->pos())); + startDragFromTable(*this, indexAt(event->position().toPoint())); } } diff --git a/apps/opencs/view/world/tableheadermouseeventhandler.cpp b/apps/opencs/view/world/tableheadermouseeventhandler.cpp index dcd2e659a6..2bc6c4fe00 100644 --- a/apps/opencs/view/world/tableheadermouseeventhandler.cpp +++ b/apps/opencs/view/world/tableheadermouseeventhandler.cpp @@ -31,7 +31,7 @@ namespace CSVWorld auto& clickEvent = static_cast(*event); if ((clickEvent.button() == Qt::MiddleButton)) { - const auto& index = table.indexAt(clickEvent.pos()); + const auto& index = table.indexAt(clickEvent.position().toPoint()); table.setColumnHidden(index.column(), true); clickEvent.accept(); return true; diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index dfb587cd96..39b8ba321e 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -171,7 +171,7 @@ QWidget* CSVWorld::CommandDelegate::createEditor( // TODO: Find a better solution? if (display == CSMWorld::ColumnBase::Display_Boolean) { - return QItemEditorFactory::defaultFactory()->createEditor(QVariant::Bool, parent); + return QItemEditorFactory::defaultFactory()->createEditor(QMetaType::Bool, parent); } // For tables the pop-up of the color editor should appear immediately after the editor creation // (the third parameter of ColorEditor's constructor) @@ -362,11 +362,7 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex if (!n.isEmpty()) { if (!variant.isValid()) -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) variant = QVariant(editor->property(n).metaType(), (const void*)nullptr); -#else - variant = QVariant(editor->property(n).userType(), (const void*)nullptr); -#endif editor->setProperty(n, variant); } } diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 23d79c1a6b..551d86a041 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -8,9 +8,6 @@ #include #include -#include "../mwmechanics/greetingstate.hpp" -#include "../mwrender/animationpriority.hpp" - #include "../mwworld/ptr.hpp" namespace osg @@ -27,6 +24,11 @@ namespace ESM class ESMWriter; } +namespace MWMechanics +{ + enum class GreetingState; +} + namespace MWWorld { class Ptr; diff --git a/apps/openmw/mwlua/magicbindings.cpp b/apps/openmw/mwlua/magicbindings.cpp index 19dada74a7..d2afde9536 100644 --- a/apps/openmw/mwlua/magicbindings.cpp +++ b/apps/openmw/mwlua/magicbindings.cpp @@ -976,9 +976,6 @@ namespace MWLua bool hasDuration = !(mgef->mData.mFlags & ESM::MagicEffect::NoDuration); effect.mDuration = hasDuration ? static_cast(enam.mData.mDuration) : 1.f; - bool appliedOnce = mgef->mData.mFlags & ESM::MagicEffect::AppliedOnce; - if (!appliedOnce) - effect.mDuration = std::max(1.f, effect.mDuration); effect.mTimeLeft = effect.mDuration; params.getEffects().emplace_back(effect); diff --git a/apps/openmw/mwmechanics/actor.hpp b/apps/openmw/mwmechanics/actor.hpp index 69e370ec86..45c077f98c 100644 --- a/apps/openmw/mwmechanics/actor.hpp +++ b/apps/openmw/mwmechanics/actor.hpp @@ -73,7 +73,7 @@ namespace MWMechanics CharacterController mCharacterController; int mGreetingTimer{ 0 }; float mTargetAngleRadians{ 0.f }; - GreetingState mGreetingState{ Greet_None }; + GreetingState mGreetingState{ GreetingState::None }; Misc::DeviatingPeriodicTimer mEngageCombat{ 1.0f, 0.25f, Misc::Rng::deviate(0, 0.25f, MWBase::Environment::get().getWorld()->getPrng()) }; bool mIsTurningToPlayer{ false }; diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 69108f9aff..4766afb55a 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -50,6 +50,7 @@ #include "attacktype.hpp" #include "character.hpp" #include "creaturestats.hpp" +#include "greetingstate.hpp" #include "movement.hpp" #include "npcstats.hpp" #include "steering.hpp" @@ -487,7 +488,7 @@ namespace MWMechanics { actorState.setTurningToPlayer(false); actorState.setGreetingTimer(0); - actorState.setGreetingState(Greet_None); + actorState.setGreetingState(GreetingState::None); return; } @@ -525,7 +526,7 @@ namespace MWMechanics int greetingTimer = actorState.getGreetingTimer(); GreetingState greetingState = actorState.getGreetingState(); - if (greetingState == Greet_None) + if (greetingState == GreetingState::None) { if ((playerPos - actorPos).length2() <= helloDistance * helloDistance && !playerStats.isDead() && !actorStats.isParalyzed() && !isTargetMagicallyHidden(player) @@ -535,14 +536,14 @@ namespace MWMechanics if (greetingTimer >= GREETING_SHOULD_START) { - greetingState = Greet_InProgress; + greetingState = GreetingState::InProgress; if (!MWBase::Environment::get().getDialogueManager()->say(actor, ESM::RefId::stringRefId("hello"))) - greetingState = Greet_Done; + greetingState = GreetingState::Done; greetingTimer = 0; } } - if (greetingState == Greet_InProgress) + if (greetingState == GreetingState::InProgress) { greetingTimer++; @@ -554,16 +555,16 @@ namespace MWMechanics if (greetingTimer >= GREETING_COOLDOWN) { - greetingState = Greet_Done; + greetingState = GreetingState::Done; greetingTimer = 0; } } - if (greetingState == Greet_Done) + if (greetingState == GreetingState::Done) { float resetDist = 2 * helloDistance; if ((playerPos - actorPos).length2() >= resetDist * resetDist) - greetingState = Greet_None; + greetingState = GreetingState::None; } actorState.setGreetingTimer(greetingTimer); @@ -2381,7 +2382,7 @@ namespace MWMechanics { const auto it = mIndex.find(ptr.mRef); if (it == mIndex.end()) - return Greet_None; + return GreetingState::None; return it->second->getGreetingState(); } diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index f0781565bf..a669de8339 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -12,6 +12,7 @@ #include "character.hpp" #include "creaturestats.hpp" +#include "greetingstate.hpp" #include "movement.hpp" namespace @@ -77,7 +78,7 @@ namespace MWMechanics if (!stats.getMovementFlag(CreatureStats::Flag_ForceJump) && !stats.getMovementFlag(CreatureStats::Flag_ForceSneak) - && (mechMgr->isTurningToPlayer(actor) || mechMgr->getGreetingState(actor) == Greet_InProgress)) + && (mechMgr->isTurningToPlayer(actor) || mechMgr->getGreetingState(actor) == GreetingState::InProgress)) return false; const osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3()); diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 71cc8b5e7d..ad4fc730df 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -25,6 +25,7 @@ #include "actorutil.hpp" #include "character.hpp" #include "creaturestats.hpp" +#include "greetingstate.hpp" #include "movement.hpp" #include "pathgrid.hpp" @@ -257,7 +258,7 @@ namespace MWMechanics && !cStats.getMovementFlag(CreatureStats::Flag_ForceSneak)) { GreetingState greetingState = MWBase::Environment::get().getMechanicsManager()->getGreetingState(actor); - if (greetingState == Greet_InProgress) + if (greetingState == GreetingState::InProgress) { if (storage.mState == AiWanderStorage::Wander_Walking) { @@ -526,7 +527,7 @@ namespace MWMechanics // Check if idle animation finished GreetingState greetingState = MWBase::Environment::get().getMechanicsManager()->getGreetingState(actor); - if (!checkIdle(actor, storage.mIdleAnimation) && (greetingState == Greet_Done || greetingState == Greet_None)) + if (!checkIdle(actor, storage.mIdleAnimation) && greetingState != GreetingState::InProgress) { if (mPathFinder.isPathConstructed()) storage.setState(AiWanderStorage::Wander_Walking, !mUsePathgrid); diff --git a/apps/openmw/mwmechanics/greetingstate.hpp b/apps/openmw/mwmechanics/greetingstate.hpp index 9b37096322..4a5a4aa2f8 100644 --- a/apps/openmw/mwmechanics/greetingstate.hpp +++ b/apps/openmw/mwmechanics/greetingstate.hpp @@ -3,11 +3,11 @@ namespace MWMechanics { - enum GreetingState + enum class GreetingState { - Greet_None, - Greet_InProgress, - Greet_Done + None, + InProgress, + Done }; } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index c20061d022..a3e260a4a7 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1453,6 +1453,7 @@ namespace MWMechanics } startCombat(actor, player, &playerFollowers); + observerStats.setHitAttemptActorId(player.getClass().getCreatureStats(player).getActorId()); // Apply aggression value to the base Fight rating, so that the actor can continue fighting // after a Calm spell wears off diff --git a/apps/openmw/mwscript/aiextensions.cpp b/apps/openmw/mwscript/aiextensions.cpp index a91a585367..e5aa3b1f91 100644 --- a/apps/openmw/mwscript/aiextensions.cpp +++ b/apps/openmw/mwscript/aiextensions.cpp @@ -22,6 +22,7 @@ #include "../mwmechanics/aitravel.hpp" #include "../mwmechanics/aiwander.hpp" #include "../mwmechanics/creaturestats.hpp" +#include "../mwmechanics/greetingstate.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/mechanicsmanager.hpp" @@ -487,7 +488,7 @@ namespace MWScript else if (testedTargetId == "Player") // Currently the player ID is hardcoded { MWBase::MechanicsManager* mechMgr = MWBase::Environment::get().getMechanicsManager(); - bool greeting = mechMgr->getGreetingState(actor) == MWMechanics::Greet_InProgress; + bool greeting = mechMgr->getGreetingState(actor) == MWMechanics::GreetingState::InProgress; bool sayActive = MWBase::Environment::get().getSoundManager()->sayActive(actor); targetsAreEqual = (greeting && sayActive) || mechMgr->isTurningToPlayer(actor); } diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index d3d75aa935..7e49fad61b 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -6,7 +6,6 @@ #include #include -#include #include #include "doorstate.hpp" @@ -16,9 +15,13 @@ #include "../mwmechanics/damagesourcetype.hpp" #include -#include #include +namespace osg +{ + class Quat; +} + namespace ESM { struct ObjectState; diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index 7f022bb653..f5d9918c10 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -25,11 +25,6 @@ namespace Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg) : mCfgMgr(cfg) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // this needs calling once so Qt can see its stream operators, which it needs when dragging and dropping - // it's automatic with Qt 6 - qRegisterMetaTypeStreamOperators("Config::SettingValue"); -#endif } void Config::GameSettings::validatePaths() diff --git a/components/l10n/qttranslations.cpp b/components/l10n/qttranslations.cpp index 1051b3dd2d..fbc38dc122 100644 --- a/components/l10n/qttranslations.cpp +++ b/components/l10n/qttranslations.cpp @@ -14,11 +14,7 @@ namespace L10n // Try to load OpenMW translations from resources folder first. // If we loaded them, try to load Qt translations from both // resources folder and default translations folder as well. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) auto qtPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath); -#else - auto qtPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); -#endif auto localPath = resourcesPath + "/translations"; if (AppTranslator.load(QLocale::system(), appName, "_", localPath) diff --git a/components/misc/utf8qtextstream.hpp b/components/misc/utf8qtextstream.hpp index a1e101864f..1b8bd1d786 100644 --- a/components/misc/utf8qtextstream.hpp +++ b/components/misc/utf8qtextstream.hpp @@ -3,20 +3,13 @@ #include -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#include -#endif #include namespace Misc { inline void ensureUtf8Encoding(QTextStream& stream) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - stream.setCodec(QTextCodec::codecForName("UTF-8")); -#else stream.setEncoding(QStringConverter::Utf8); -#endif } } #endif diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 74ba957813..ef39dc20e1 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -209,6 +209,7 @@ if (BUILD_BENCHMARKS AND NOT OPENMW_USE_SYSTEM_BENCHMARK) set(BENCHMARK_ENABLE_TESTING OFF) set(BENCHMARK_ENABLE_INSTALL OFF) set(BENCHMARK_ENABLE_GTEST_TESTS OFF) + set(BENCHMARK_ENABLE_WERROR OFF) include(FetchContent) FetchContent_Declare(benchmark diff --git a/extern/osgQt/CMakeLists.txt b/extern/osgQt/CMakeLists.txt index 781305ca47..1cfb8230a3 100644 --- a/extern/osgQt/CMakeLists.txt +++ b/extern/osgQt/CMakeLists.txt @@ -17,11 +17,7 @@ set(OSGQT_SOURCE_FILES add_library(${OSGQT_LIBRARY} STATIC ${OSGQT_SOURCE_FILES}) -if (QT_VERSION_MAJOR VERSION_EQUAL 6) - target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL Qt::OpenGLWidgets) -else() - target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL) -endif() +target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL Qt::OpenGLWidgets) link_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 2481c0ae75..b8c4aebe97 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -331,6 +331,7 @@ --- -- Adds a new spell to the list of active spells (only in global scripts or on self). -- Note that this does not play any related VFX or sounds. +-- Note that this should not be used to add spells without durations (i.e. abilities, curses, and diseases) as they will expire instantly. Use @{#ActorSpells.add} instead. -- @function [parent=#ActorActiveSpells] add -- @param self -- @param #table options A table of parameters. Must contain the following required parameters: