From a9c7b30802f43fce3a57b76ab2bd4f2bddb529f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Mon, 12 Jan 2026 10:43:44 +0100 Subject: [PATCH 01/28] Set required QT-Version to 6 in CMakeLists files. It will not compile, no need to run CI --- .github/workflows/macOS.yml | 138 --------------- .github/workflows/releaseDoc.yml | 162 ------------------ .github/workflows/ubuntu22.04.yml | 133 -------------- .github/workflows/ubuntu24.04.yml | 133 -------------- deps/quazip-1.3/CMakeLists.txt | 20 +-- install_dependencies.sh | 20 +-- plugins/dot_viewer/CMakeLists.txt | 8 +- .../dot_viewer/deps/QGVCore/CMakeLists.txt | 12 +- plugins/gexf_writer/CMakeLists.txt | 18 +- plugins/gui/CMakeLists.txt | 64 +++---- plugins/logic_evaluator/CMakeLists.txt | 16 +- .../CMakeLists.txt | 18 +- .../saleae_cli/CMakeLists.txt | 2 +- .../simulator/waveform_viewer/CMakeLists.txt | 16 +- 14 files changed, 97 insertions(+), 663 deletions(-) delete mode 100644 .github/workflows/macOS.yml delete mode 100644 .github/workflows/releaseDoc.yml delete mode 100644 .github/workflows/ubuntu22.04.yml delete mode 100644 .github/workflows/ubuntu24.04.yml diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml deleted file mode 100644 index 85bc98f04b10..000000000000 --- a/.github/workflows/macOS.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: macOS - -on: - push: -# create: -# tags: -# - v* - -jobs: - build-test: - name: Build and Test macOS - - strategy: - matrix: - # runs-on: [ubuntu-latest, macOS-latest] - runs-on: [macOS-latest] - fail-fast: false - - runs-on: ${{ matrix.runs-on }} - - steps: - - name: Checkout - uses: actions/checkout@v1 - - - - name: Cache pip macOS - uses: actions/cache@v4 - if: startsWith(runner.os, 'macOS') - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache Homebrew Downloads - if: startsWith(runner.os, 'macOS') - uses: actions/cache@v4 - with: - path: ~/Library/Caches/Homebrew - # key: ${{ runner.OS }}-build-downloads-${{ hashFiles('**/package-lock.json') }} - key: ${{ runner.OS }}-build-downloads - restore-keys: | - ${{ runner.OS }}-build-downloads-${{ env.cache-name }}- - ${{ runner.OS }}-build-downloads- - -# - name: Cache Homebrew -# if: matrix.os == 'macOS-latest' -# uses: actions/cache@v4 -# with: -# path: /usr/local/Homebrew -# # key: ${{ runner.OS }}-build-localbrew-${{ hashFiles('**/package-lock.json') }} -# key: ${{ runner.OS }}-build-localbrew -# restore-keys: | -# ${{ runner.OS }}-build-localbrew-${{ env.cache-name }}- -# ${{ runner.OS }}-build-localbrew- - - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::set-output name=timestamp::${current_date}") - - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ${{runner.workspace}}/.ccache - key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ runner.OS }}-ccache- - - - name: Install Dependencies - run: ./install_dependencies.sh - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - if: startsWith(runner.os, 'macOS') - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - # brew link --force qt@5 - run: | - mkdir -p build - cd build - export PATH="$(brew --prefix qt@5)/bin:$PATH" - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" - cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON - env: - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 500M - - - name: Build - if: startsWith(runner.os, 'macOS') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - export PATH="$(brew --prefix qt@5)/bin:$PATH" - export BUILD_TYPE=Debug - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" - export SDKROOT=$(xcrun --show-sdk-path) - cmake --build . --target all --clean-first --config $BUILD_TYPE - env: - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 500M - -# - name: Setup tmate session -# uses: mxschmitt/action-tmate@v1 - - - name: Test - shell: bash - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - cd build - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" - ctest --rerun-failed --output-on-failure - # ninja -v hal_coverage - # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" - env: - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 500M diff --git a/.github/workflows/releaseDoc.yml b/.github/workflows/releaseDoc.yml deleted file mode 100644 index 8a5cc839a441..000000000000 --- a/.github/workflows/releaseDoc.yml +++ /dev/null @@ -1,162 +0,0 @@ -name: Build Documentation - -on: - push: -# create: -# tags: -# - v* - -jobs: - release-doc: - name: Build and release documentation - - strategy: - matrix: - # runs-on: [ ubuntu-20.04, macOS-latest] - runs-on: [ ubuntu-22.04 ] - fail-fast: false - - runs-on: ${{ matrix.runs-on }} - - steps: - - uses: actions/checkout@v2 - - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - run: | - git fetch --prune --unshallow - - - name: Cache pip Linux - uses: actions/cache@v4 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache pip macOS - uses: actions/cache@v4 - if: startsWith(runner.os, 'macOS') - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ${{runner.workspace}}/.ccache - key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ runner.OS }}-ccache- - - - name: Install Dependencies - run: ./install_dependencies.sh - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Cache CCache - uses: actions/cache@v4 - with: - path: ~/.ccache - # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} - key: ${{ runner.OS }}-build-ccache - restore-keys: | - ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- - ${{ runner.OS }}-build-ccache- - - - name: Configure CMake - if: startsWith(runner.os, 'Linux') - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: | - mkdir -p build/doc - cd build - echo "==> Disk usage before clean" - df -h . - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/hostedtoolcache - echo "==> Disk usage after clean" - df -h . - export BUILD_TYPE=Debug - cp -v $GITHUB_WORKSPACE/documentation/index.html doc/ - cp -v $GITHUB_WORKSPACE/documentation/hal_screenshot.* doc/ - ls -l doc - $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE - cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Build - if: startsWith(runner.os, 'Linux') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - ninja - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Build Doxygen - if: startsWith(runner.os, 'Linux') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - export BUILD_TYPE=Debug - mkdir -p doc/doc - cmake --build . --target doc --config $BUILD_TYPE - cp -R documentation/cpp-doc/html/* doc/doc/ - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Build Sphinx - if: startsWith(runner.os, 'Linux') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - export BUILD_TYPE=Debug - mkdir -p doc/pydoc - cmake --build . --target pydoc --config $BUILD_TYPE - cp -R documentation/python-doc/html/* doc/pydoc/ - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - - name: Deploy Doc - if: github.ref == 'refs/heads/master' - uses: JamesIves/github-pages-deploy-action@releases/v3 - with: - BRANCH: gh-pages - ACCESS_TOKEN: ${{ secrets.GH_PAGES_TOKEN}} - FOLDER: build/doc - GIT_CONFIG_NAME: 'github-actions[bot]' - GIT_CONFIG_EMAIL: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/ubuntu22.04.yml b/.github/workflows/ubuntu22.04.yml deleted file mode 100644 index a6fd37d51ed0..000000000000 --- a/.github/workflows/ubuntu22.04.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: Ubuntu 22.04 - -on: - push: -# create: -# tags: -# - v* - -jobs: - build_ubuntu_22_04: - name: Build and Test on Ubuntu 22.04 - - strategy: - matrix: - # runs-on: [ ubuntu-20.04, macOS-latest] - runs-on: [ ubuntu-22.04 ] - fail-fast: false - - runs-on: ${{ matrix.runs-on }} - - steps: - - uses: actions/checkout@v2 - - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - run: | - git fetch --prune --unshallow - - - name: Cache pip Linux - uses: actions/cache@v4 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache pip macOS - uses: actions/cache@v4 - if: startsWith(runner.os, 'macOS') - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ${{runner.workspace}}/.ccache - key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ runner.OS }}-ccache- - - - name: Install Dependencies - run: ./install_dependencies.sh - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Cache CCache - uses: actions/cache@v4 - with: - path: ~/.ccache - # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} - key: ${{ runner.OS }}-build-ccache - restore-keys: | - ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- - ${{ runner.OS }}-build-ccache- - - - name: Configure CMake - if: startsWith(runner.os, 'Linux') - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: | - mkdir -p build/doc - cd build - export BUILD_TYPE=Debug - cp $GITHUB_WORKSPACE/documentation/index.html doc/ - $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE - cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Build - if: startsWith(runner.os, 'Linux') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - echo "==> Disk usage before clean" - df -h . - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/hostedtoolcache - echo "==> Disk usage after clean" - df -h . - ninja - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Test - shell: bash - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - cd build - ctest --rerun-failed --output-on-failure - # ninja -v hal_coverage - # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" - env: - LDFLAGS: "-L/usr/local/opt/qt/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" - CPPFLAGS: "-I/usr/local/opt/qt/include -I/usr/local/opt/llvm/include" - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M \ No newline at end of file diff --git a/.github/workflows/ubuntu24.04.yml b/.github/workflows/ubuntu24.04.yml deleted file mode 100644 index 0fc3f5463a90..000000000000 --- a/.github/workflows/ubuntu24.04.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: Ubuntu 24.04 - -on: - push: -# create: -# tags: -# - v* - -jobs: - build_ubuntu_24_04: - name: Build and Test on Ubuntu 24.04 - - strategy: - matrix: - # runs-on: [ ubuntu-22.04, macOS-latest] - runs-on: [ ubuntu-24.04 ] - fail-fast: false - - runs-on: ${{ matrix.runs-on }} - - steps: - - uses: actions/checkout@v2 - - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - run: | - git fetch --prune --unshallow - - - name: Cache pip Linux - uses: actions/cache@v4 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache pip macOS - uses: actions/cache@v4 - if: startsWith(runner.os, 'macOS') - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ${{runner.workspace}}/.ccache - key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ runner.OS }}-ccache- - - - name: Install Dependencies - run: ./install_dependencies.sh - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Cache CCache - uses: actions/cache@v4 - with: - path: ~/.ccache - # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} - key: ${{ runner.OS }}-build-ccache - restore-keys: | - ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- - ${{ runner.OS }}-build-ccache- - - - name: Configure CMake - if: startsWith(runner.os, 'Linux') - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: | - mkdir -p build/doc - cd build - export BUILD_TYPE=Debug - cp $GITHUB_WORKSPACE/documentation/index.html doc/ - $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE - cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Build - if: startsWith(runner.os, 'Linux') - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: | - cd build - echo "==> Disk usage before clean" - df -h . - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/hostedtoolcache - echo "==> Disk usage after clean" - df -h . - ninja - env: - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - - - name: Test - shell: bash - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - cd build - ctest --rerun-failed --output-on-failure - # ninja -v hal_coverage - # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" - env: - LDFLAGS: "-L/usr/local/opt/qt/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" - CPPFLAGS: "-I/usr/local/opt/qt/include -I/usr/local/opt/llvm/include" - HAL_BASE_PATH: ${{runner.workspace}}/hal/build - CCACHE_DIR: ${{runner.workspace}}/.ccache - CCACHE_COMPRESS: true - CCACHE_COMPRESSLEVEL: 6 - CCACHE_MAXSIZE: 400M \ No newline at end of file diff --git a/deps/quazip-1.3/CMakeLists.txt b/deps/quazip-1.3/CMakeLists.txt index df5f1e1e7e85..7ba6ff4a6511 100644 --- a/deps/quazip-1.3/CMakeLists.txt +++ b/deps/quazip-1.3/CMakeLists.txt @@ -14,16 +14,16 @@ option(QUAZIP_USE_QT_ZLIB "" OFF) option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) # Set the default value of `${QUAZIP_QT_MAJOR_VERSION}`. -# We search quietly for Qt5 and Qt4 in that order. -# Qt5 provides config files for CMake. +# We search quietly for Qt6 and Qt4 in that order. +# Qt6 provides config files for CMake. # Qt4 relies on `FindQt4.cmake`. find_package( - QT NAMES Qt5 + QT NAMES Qt6 QUIET COMPONENTS Core ) -set(QT_VERSION_MAJOR 5) +set(QT_VERSION_MAJOR 6) -set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use 5, defaults to ${QT_VERSION_MAJOR}") +set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use 6, defaults to ${QT_VERSION_MAJOR}") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RELEASE) @@ -40,12 +40,12 @@ set(QUAZIP_LIB_TARGET_NAME QuaZip) set(QUAZIP_DIR_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}-${QUAZIP_LIB_VERSION}) set(QUAZIP_PACKAGE_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}) -if(QUAZIP_QT_MAJOR_VERSION EQUAL 5) - find_package(Qt5 REQUIRED COMPONENTS Core +if(QUAZIP_QT_MAJOR_VERSION EQUAL 6) + find_package(Qt6 REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Network Test) - set(QUAZIP_LIB_LIBRARIES Qt5::Core) - set(QUAZIP_TEST_QT_LIBRARIES Qt5::Core Qt5::Network Qt5::Test) - set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt5Core") + set(QUAZIP_LIB_LIBRARIES Qt6::Core) + set(QUAZIP_TEST_QT_LIBRARIES Qt6::Core Qt6::Network Qt6::Test) + set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt6Core") else() message(FATAL_ERROR "Qt version ${QUAZIP_QT_MAJOR_VERSION} is not supported") endif() diff --git a/install_dependencies.sh b/install_dependencies.sh index 8e8be3264c0e..40e6b98dda34 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -22,9 +22,9 @@ if [[ "$platform" == 'macOS' ]]; then pip3 install -r requirements.txt BREW_PREFIX=$(brew --prefix) if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then - grep -Fxq 'export PATH="$BREW_PREFIX/opt/qt@5/bin:$PATH"' ~/.zshrc + grep -Fxq 'export PATH="$BREW_PREFIX/opt/qt/bin:$PATH"' ~/.zshrc if ! [[ $? -eq 0 ]]; then - echo 'export PATH="$BREW_PREFIX/opt/qt@5/bin:$PATH"' >> ~/.zshrc + echo 'export PATH="$BREW_PREFIX/opt/qt/bin:$PATH"' >> ~/.zshrc fi grep -Fxq 'export PATH="$BREW_PREFIX/opt/llvm@14/bin:$PATH"' ~/.zshrc @@ -43,9 +43,9 @@ if [[ "$platform" == 'macOS' ]]; then fi source ~/.zshrc elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then - grep -Fxq 'export PATH="$BREW_PREFIX/opt/qt@5/bin:$PATH"' ~/.bash_profile + grep -Fxq 'export PATH="$BREW_PREFIX/opt/qt/bin:$PATH"' ~/.bash_profile if ! [[ $? -eq 0 ]]; then - echo 'export PATH="$BREW_PREFIX/opt/qt@5/bin:$PATH"' >> ~/.bash_profile + echo 'export PATH="$BREW_PREFIX/opt/qt/bin:$PATH"' >> ~/.bash_profile fi grep -Fxq 'export PATH="$BREW_PREFIX/opt/llvm@14/bin:$PATH"' ~/.bash_profile @@ -72,9 +72,9 @@ elif [[ "$platform" == 'linux' ]]; then if [ "$distribution" == 'Ubuntu' ] || [ "$distribution" == 'LinuxMint' ]; then sudo apt-get update && sudo apt-get install -y build-essential verilator \ - lsb-release git cmake pkgconf libboost-all-dev qtbase5-dev \ + lsb-release git cmake pkgconf libboost-all-dev qtbase6-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ - libqt5svg5-dev libqt5svg5* ninja-build lcov gcovr python3-sphinx \ + libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev z3 \ libreadline-dev apport python3-dateutil libgraphviz-dev \ @@ -82,7 +82,7 @@ elif [[ "$platform" == 'linux' ]]; then graphviz libomp-dev libsuitesparse-dev # For documentation elif [[ "$distribution" == "Arch" ]]; then yay -S --needed base-devel lsb-release git verilator cmake boost-libs pkgconf \ - qt5-base python ccache autoconf libsodium qt5-svg ninja lcov \ + qt6-base python ccache autoconf libsodium qt6-svg ninja lcov \ gcovr python-sphinx doxygen python-sphinx_rtd_theme python-jedi \ python-pip pybind11 rapidjson spdlog graphviz boost \ python-dateutil z3 @@ -99,7 +99,7 @@ elif [[ "$platform" == 'linux' ]]; then done sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$RHEL_VERSION.noarch.rpm sudo yum update -y - for pkg in boost-devel z3 rapidjson-devel qt5-qtbase-devel qt5-qtsvg-devel z3-devel python-devel verilator; do + for pkg in boost-devel z3 rapidjson-devel qt6-qtbase-devel qt6-qtsvg-devel z3-devel python-devel verilator; do sudo yum install -y $pkg done exit 255 @@ -110,9 +110,9 @@ elif [[ "$platform" == 'linux' ]]; then elif [[ "$platform" == 'docker' ]]; then # We can assume that we are in a ubuntu container, because of the official Dockerfile in the hal project apt-get update && apt-get install -y build-essential verilator \ - lsb-release git cmake pkgconf libboost-all-dev qtbase5-dev \ + lsb-release git cmake pkgconf libboost-all-dev qtbase6-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ - libqt5svg5-dev libqt5svg5* ninja-build lcov gcovr python3-sphinx \ + libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 python3-dateutil rapidjson-dev \ libspdlog-dev libz3-dev libreadline-dev \ diff --git a/plugins/dot_viewer/CMakeLists.txt b/plugins/dot_viewer/CMakeLists.txt index f941b6026926..de4035cd5252 100644 --- a/plugins/dot_viewer/CMakeLists.txt +++ b/plugins/dot_viewer/CMakeLists.txt @@ -4,7 +4,7 @@ if(PL_DOT_VIEWER OR BUILD_ALL_PLUGINS) # Dependencies find_package(Graphviz REQUIRED) - find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + find_package(Qt6 REQUIRED COMPONENTS Core Widgets) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/QGVCore) @@ -14,7 +14,7 @@ if(PL_DOT_VIEWER OR BUILD_ALL_PLUGINS) file(GLOB_RECURSE DOT_VIEWER_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp) - qt5_wrap_cpp(MOC_HDR ${DOT_VIEWER_INC}) + qt6_wrap_cpp(MOC_HDR ${DOT_VIEWER_INC}) # --- Plugin Target --- hal_add_plugin(dot_viewer @@ -38,8 +38,8 @@ if(PL_DOT_VIEWER OR BUILD_ALL_PLUGINS) # --- Link Libraries --- target_link_libraries(dot_viewer PRIVATE - Qt5::Core - Qt5::Widgets + Qt6::Core + Qt6::Widgets ${LIBGVC_LIBRARIES} ${LIBCGRAPH_LIBRARIES} gui diff --git a/plugins/dot_viewer/deps/QGVCore/CMakeLists.txt b/plugins/dot_viewer/deps/QGVCore/CMakeLists.txt index 1f6a97441405..fe53d6e370a7 100644 --- a/plugins/dot_viewer/deps/QGVCore/CMakeLists.txt +++ b/plugins/dot_viewer/deps/QGVCore/CMakeLists.txt @@ -16,7 +16,7 @@ SET(TARGET_VERSION_MAJOR 0 ) SET(TARGET_VERSION_MINOR 1 ) # all files which may be mocced -qt5_wrap_cpp(MOC_SCENE ${CMAKE_CURRENT_SOURCE_DIR}/QGVScene.h) +qt6_wrap_cpp(MOC_SCENE ${CMAKE_CURRENT_SOURCE_DIR}/QGVScene.h) SET(QGVLIB_CPP private/QGVCore.cpp @@ -34,7 +34,7 @@ SET(QGVLIB_CPP SET(TARGET_NAME "QGVCore") # include with QT_USE selected library parts -find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) INCLUDE_DIRECTORIES( ${GRAPHVIZ_INCLUDE_DIR} @@ -50,8 +50,8 @@ ADD_DEFINITIONS(-DQGVCORE_LIB -D_PACKAGE_ast -D_dll_import -D_BLD_cdt -D_DLL_BLD ADD_DEFINITIONS(-DQVGCORE_LIB) - QT5_WRAP_UI(QGVLIB_UI_H ${qgvlib_UI}) - QT5_ADD_RESOURCES(qgvlib_RCCS ${qgvlib_QRC}) + QT6_WRAP_UI(QGVLIB_UI_H ${qgvlib_UI}) + QT6_ADD_RESOURCES(qgvlib_RCCS ${qgvlib_QRC}) ADD_LIBRARY(qgvcore SHARED ${QGVLIB_CPP} @@ -64,8 +64,8 @@ TARGET_LINK_LIBRARIES(qgvcore ${GRAPHVIZ_GVC_LIBRARY} ${GRAPHVIZ_CGRAPH_LIBRARY} ${GRAPHVIZ_CDT_LIBRARY} - Qt5::Core - Qt5::Widgets + Qt6::Core + Qt6::Widgets ) string(TOUPPER ${CMAKE_BUILD_TYPE} CFG) diff --git a/plugins/gexf_writer/CMakeLists.txt b/plugins/gexf_writer/CMakeLists.txt index 6f981e4dfaac..37c9060b1ea0 100644 --- a/plugins/gexf_writer/CMakeLists.txt +++ b/plugins/gexf_writer/CMakeLists.txt @@ -1,13 +1,13 @@ option(PL_GEXF_WRITER "PL_GEXF_WRITER" ON) if(PL_GEXF_WRITER OR BUILD_ALL_PLUGINS) - find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) + find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) - if(Qt5Core_FOUND) - message(VERBOSE "Qt5Core_INCLUDE_DIRS: ${Qt5Core_INCLUDE_DIRS}") - elseif(NOT Qt5Core_FOUND) - message(STATUS "Qt5Core not found for gexf") - endif(Qt5Core_FOUND) + if(Qt6Core_FOUND) + message(VERBOSE "Qt6Core_INCLUDE_DIRS: ${Qt6Core_INCLUDE_DIRS}") + elseif(NOT Qt6Core_FOUND) + message(STATUS "Qt6Core not found for gexf") + endif(Qt6Core_FOUND) file(GLOB_RECURSE GEXF_WRITER_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) file(GLOB_RECURSE GEXF_WRITER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) @@ -45,9 +45,9 @@ if(PL_GEXF_WRITER OR BUILD_ALL_PLUGINS) target_link_libraries(gexf_writer PUBLIC gui - Qt5::Core - Qt5::Gui - Qt5::Widgets + Qt6::Core + Qt6::Gui + Qt6::Widgets ${ARG_LINK_LIBRARIES}) install(TARGETS gexf_writer LIBRARY DESTINATION ${PLUGIN_LIBRARY_INSTALL_DIRECTORY} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE INCLUDES DESTINATION ${PLUGIN_INCLUDE_INSTALL_DIRECTORY}) diff --git a/plugins/gui/CMakeLists.txt b/plugins/gui/CMakeLists.txt index fcb326523bcf..a96d8c2603d7 100644 --- a/plugins/gui/CMakeLists.txt +++ b/plugins/gui/CMakeLists.txt @@ -3,43 +3,43 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) cmake_minimum_required(VERSION 3.5.0) - if(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) - set (Qt5_DIR "/usr/local/opt/qt@5/lib/cmake" ) - endif(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) + if(APPLE AND CMAKE_HOST_APPLE AND NOT Qt6_DIR) + set (Qt6_DIR "/usr/local/opt/qt@5/lib/cmake" ) + endif(APPLE AND CMAKE_HOST_APPLE AND NOT Qt6_DIR) - find_package(Qt5 COMPONENTS Core REQUIRED ) + find_package(Qt6 COMPONENTS Core REQUIRED ) - find_package(Qt5 COMPONENTS Widgets REQUIRED) - if(Qt5Widgets_FOUND) - message(VERBOSE "Qt5Widgets_INCLUDE_DIRS: ${Qt5Widgets_INCLUDE_DIRS}") - message(VERBOSE "Qt5Widgets_LIBRARIES: ${Qt5Widgets_LIBRARIES}") - elseif(NOT Qt5Widgets_FOUND) + find_package(Qt6 COMPONENTS Widgets REQUIRED) + if(Qt6Widgets_FOUND) + message(VERBOSE "Qt6Widgets_INCLUDE_DIRS: ${Qt6Widgets_INCLUDE_DIRS}") + message(VERBOSE "Qt6Widgets_LIBRARIES: ${Qt6Widgets_LIBRARIES}") + elseif(NOT Qt6Widgets_FOUND) set(Missing_package "TRUE") if(APPLE AND CMAKE_HOST_APPLE) - message(STATUS "To install qt5 on MacOS using homebrew run following command:") - message(STATUS " brew install qt@5") + message(STATUS "To install qt on MacOS using homebrew run following command:") + message(STATUS " brew install qt") endif(APPLE AND CMAKE_HOST_APPLE) - endif(Qt5Widgets_FOUND) + endif(Qt6Widgets_FOUND) - find_package(Qt5 COMPONENTS Concurrent REQUIRED) - if(Qt5Concurrent_FOUND) - message(VERBOSE "Qt5Concurrent_INCLUDE_DIRS: ${Qt5Concurrent_INCLUDE_DIRS}") - message(VERBOSE "Qt5Concurrent_LIBRARIES: ${Qt5Concurrent_LIBRARIES}") - elseif(NOT Qt5Concurrent_FOUND) + find_package(Qt6 COMPONENTS Concurrent REQUIRED) + if(Qt6Concurrent_FOUND) + message(VERBOSE "Qt6Concurrent_INCLUDE_DIRS: ${Qt6Concurrent_INCLUDE_DIRS}") + message(VERBOSE "Qt6Concurrent_LIBRARIES: ${Qt6Concurrent_LIBRARIES}") + elseif(NOT Qt6Concurrent_FOUND) set(Missing_package "TRUE") if(APPLE AND CMAKE_HOST_APPLE) - message(STATUS "To install qt5 on MacOS using homebrew run following command:") - message(STATUS " brew install qt@5") + message(STATUS "To install qt on MacOS using homebrew run following command:") + message(STATUS " brew install qt") endif(APPLE AND CMAKE_HOST_APPLE) - endif(Qt5Concurrent_FOUND) + endif(Qt6Concurrent_FOUND) - find_package(Qt5 COMPONENTS Svg REQUIRED) - if(Qt5Svg_FOUND) - message(VERBOSE "Qt5Svg_INCLUDE_DIRS: ${Qt5Svg_INCLUDE_DIRS}") - message(VERBOSE "Qt5Svg_LIBRARIES: ${Qt5Svg_LIBRARIES}") - elseif(NOT Qt5Svg_FOUND) + find_package(Qt6 COMPONENTS Svg REQUIRED) + if(Qt6Svg_FOUND) + message(VERBOSE "Qt6Svg_INCLUDE_DIRS: ${Qt6Svg_INCLUDE_DIRS}") + message(VERBOSE "Qt6Svg_LIBRARIES: ${Qt6Svg_LIBRARIES}") + elseif(NOT Qt6Svg_FOUND) set(Missing_package "TRUE") - endif(Qt5Svg_FOUND) + endif(Qt6Svg_FOUND) set(INCROOT ${CMAKE_CURRENT_SOURCE_DIR}/include) set(SRCROOT ${CMAKE_CURRENT_SOURCE_DIR}/src) @@ -58,7 +58,7 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) aux_source_directory(${SRCROOT} SRC) file(GLOB_RECURSE RSRC ${RSRCROOT}/*.qrc) - qt5_wrap_cpp(MOC_source ${SRC}) + qt6_wrap_cpp(MOC_source ${SRC}) foreach(i IN ITEMS "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO") foreach(j IN ITEMS "RUNTIME" "ARCHIVE" "LIBRARY") @@ -71,7 +71,7 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) add_subdirectory(${QUAZIP_SUBDIR} ${CMAKE_BINARY_DIR}/quazip) message(STATUS "Using quazip from ${QUAZIP_SUBDIR}") else() - find_package(QuaZip-Qt5 REQUIRED) + find_package(QuaZip-Qt6 REQUIRED) get_target_property(QUAZIP_LIBRARIES QuaZip::QuaZip IMPORTED_LOCATION_RELEASE) message(STATUS "Using system's quazip from ${QUAZIP_LIBRARIES}") endif() @@ -82,9 +82,9 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) endforeach() endforeach() - qt5_wrap_cpp(MOC_HDR ${HDR}) - qt5_wrap_ui(MOC_UI ${UI}) - qt5_add_resources(MOC_RSRC ${RSRC}) + qt6_wrap_cpp(MOC_HDR ${HDR}) + qt6_wrap_ui(MOC_UI ${UI}) + qt6_add_resources(MOC_RSRC ${RSRC}) add_library(gui SHARED ${HDR} @@ -114,7 +114,7 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) PRIVATE ${COMPILE_OPTIONS_PRIVATE} INTERFACE ${COMPILE_OPTIONS_INTERFACE}) target_compile_definitions(gui PUBLIC QT_NO_KEYWORDS) - target_link_libraries(gui PUBLIC hal::core hal::netlist PRIVATE ${Python3_LIBRARIES} pybind11::embed Qt5::Widgets Qt5::Concurrent Qt5::Svg QuaZip::QuaZip) + target_link_libraries(gui PUBLIC hal::core hal::netlist PRIVATE ${Python3_LIBRARIES} pybind11::embed Qt6::Widgets Qt6::Concurrent Qt6::Svg QuaZip::QuaZip) add_dependencies(gui update_internal_gate_library_definitions) get_property(GLDIR GLOBAL PROPERTY GATE_LIBS_DEFINITIONS) file(WRITE "${RSRCROOT}/path/gate_library_definitions.txt" "${GLDIR}") diff --git a/plugins/logic_evaluator/CMakeLists.txt b/plugins/logic_evaluator/CMakeLists.txt index c5e7f661fd15..7ddc2c60f1f7 100644 --- a/plugins/logic_evaluator/CMakeLists.txt +++ b/plugins/logic_evaluator/CMakeLists.txt @@ -1,24 +1,24 @@ option(PL_LOGIC_EVALUATOR "PL_LOGIC_EVALUATOR" OFF) if(PL_LOGIC_EVALUATOR OR BUILD_ALL_PLUGINS) - find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) + find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) - if(Qt5Core_FOUND) - message(VERBOSE "Qt5Core_INCLUDE_DIRS: ${Qt5Core_INCLUDE_DIRS}") - elseif(NOT Qt5Core_FOUND) - message(STATUS "Qt5Core not found for logic_evaluator") - endif(Qt5Core_FOUND) + if(Qt6Core_FOUND) + message(VERBOSE "Qt6Core_INCLUDE_DIRS: ${Qt6Core_INCLUDE_DIRS}") + elseif(NOT Qt6Core_FOUND) + message(STATUS "Qt6Core not found for logic_evaluator") + endif(Qt6Core_FOUND) file(GLOB_RECURSE LOGIC_EVALUATOR_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) file(GLOB_RECURSE LOGIC_EVALUATOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE LOGIC_EVALUATOR_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp) - qt5_wrap_cpp(MOC_HDR ${LOGIC_EVALUATOR_INC}) + qt6_wrap_cpp(MOC_HDR ${LOGIC_EVALUATOR_INC}) hal_add_plugin(logic_evaluator SHARED HEADER ${LOGIC_EVALUATOR_INC} SOURCES ${LOGIC_EVALUATOR_SRC} ${LOGIC_EVALUATOR_PYTHON_SRC} ${MOC_HDR} - LINK_LIBRARIES PUBLIC gui netlist_simulator_controller Qt5::Core Qt5::Gui Qt5::Widgets) + LINK_LIBRARIES PUBLIC gui netlist_simulator_controller Qt6::Core Qt6::Gui Qt6::Widgets) endif() diff --git a/plugins/simulator/netlist_simulator_controller/CMakeLists.txt b/plugins/simulator/netlist_simulator_controller/CMakeLists.txt index 7bd330ba8b8f..77da7443a149 100644 --- a/plugins/simulator/netlist_simulator_controller/CMakeLists.txt +++ b/plugins/simulator/netlist_simulator_controller/CMakeLists.txt @@ -2,13 +2,13 @@ option(PL_NETLIST_SIMULATOR_CONTROLLER "PL_NETLIST_SIMULATOR_CONTROLLER" OFF) if(PL_NETLIST_SIMULATOR_CONTROLLER OR PL_SIMULATOR OR PL_LOGIC_EVALUATOR OR BUILD_ALL_PLUGINS) - find_package(Qt5 COMPONENTS Core REQUIRED) + find_package(Qt6 COMPONENTS Core REQUIRED) - if(Qt5Core_FOUND) - message(VERBOSE "Qt5Core_INCLUDE_DIRS: ${Qt5Core_INCLUDE_DIRS}") - elseif(NOT Qt5Core_FOUND) - message(STATUS "Qt5Core not found for netlist_simulator_controller") - endif(Qt5Core_FOUND) + if(Qt6Core_FOUND) + message(VERBOSE "Qt6Core_INCLUDE_DIRS: ${Qt6Core_INCLUDE_DIRS}") + elseif(NOT Qt6Core_FOUND) + message(STATUS "Qt6Core not found for netlist_simulator_controller") + endif(Qt6Core_FOUND) enable_cxx_compile_option_if_supported("-O1" "Perf" "PUBLIC") enable_cxx_compile_option_if_supported("-g" "Perf" "PUBLIC") @@ -22,8 +22,8 @@ if(PL_NETLIST_SIMULATOR_CONTROLLER OR PL_SIMULATOR OR PL_LOGIC_EVALUATOR OR BUIL file(GLOB_RECURSE NETLIST_SIMULATOR_CONTROLLER_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp) file(GLOB_RECURSE NETLIST_SIMULATOR_CONTROLLER_QRC ${CMAKE_CURRENT_SOURCE_DIR}/resources/*.qrc) - qt5_wrap_cpp(MOC_HDR ${NETLIST_SIMULATOR_CONTROLLER_INC}) - qt5_add_resources(MOC_QRC ${NETLIST_SIMULATOR_CONTROLLER_QRC}) + qt6_wrap_cpp(MOC_HDR ${NETLIST_SIMULATOR_CONTROLLER_INC}) + qt6_add_resources(MOC_QRC ${NETLIST_SIMULATOR_CONTROLLER_QRC}) hal_add_plugin(netlist_simulator_controller SHARED @@ -31,7 +31,7 @@ if(PL_NETLIST_SIMULATOR_CONTROLLER OR PL_SIMULATOR OR PL_LOGIC_EVALUATOR OR BUIL HEADER ${NETLIST_SIMULATOR_CONTROLLER_INC} SOURCES ${NETLIST_SIMULATOR_CONTROLLER_SRC} ${NETLIST_SIMULATOR_CONTROLLER_PYTHON_SRC} ${MOC_HDR} ${MOC_QRC} PYDOC SPHINX_DOC_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/documentation/netlist_simulator_controller.rst - LINK_LIBRARIES PUBLIC Qt5::Core) + LINK_LIBRARIES PUBLIC Qt6::Core) add_subdirectory(test) add_subdirectory(saleae_cli) diff --git a/plugins/simulator/netlist_simulator_controller/saleae_cli/CMakeLists.txt b/plugins/simulator/netlist_simulator_controller/saleae_cli/CMakeLists.txt index 5b81e50f69a7..b52a335d36fa 100644 --- a/plugins/simulator/netlist_simulator_controller/saleae_cli/CMakeLists.txt +++ b/plugins/simulator/netlist_simulator_controller/saleae_cli/CMakeLists.txt @@ -8,7 +8,7 @@ project( include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/plugins/simulator/netlist_simulator_controller/include) -find_package(Qt5 COMPONENTS Core REQUIRED ) +find_package(Qt6 COMPONENTS Core REQUIRED ) include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/plugins/simulator/netlist-simulator-controller/include) diff --git a/plugins/simulator/waveform_viewer/CMakeLists.txt b/plugins/simulator/waveform_viewer/CMakeLists.txt index 3d30ca5ebd97..abbaad8eaab9 100644 --- a/plugins/simulator/waveform_viewer/CMakeLists.txt +++ b/plugins/simulator/waveform_viewer/CMakeLists.txt @@ -1,25 +1,25 @@ option(PL_WAVEFORM_VIEWER "PL_WAVEFORM_VIEWER" ON) if(PL_WAVEFORM_VIEWER OR BUILD_ALL_PLUGINS) - find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) + find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) - if(Qt5Core_FOUND) - message(VERBOSE "Qt5Core_INCLUDE_DIRS: ${Qt5Core_INCLUDE_DIRS}") - elseif(NOT Qt5Core_FOUND) - message(STATUS "Qt5Core not found for waveform_viewer") - endif(Qt5Core_FOUND) + if(Qt6Core_FOUND) + message(VERBOSE "Qt6Core_INCLUDE_DIRS: ${Qt6Core_INCLUDE_DIRS}") + elseif(NOT Qt6Core_FOUND) + message(STATUS "Qt6Core not found for waveform_viewer") + endif(Qt6Core_FOUND) file(GLOB_RECURSE WAVEFORM_VIEWER_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) file(GLOB_RECURSE WAVEFORM_VIEWER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE WAVEFORM_VIEWER_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp) - qt5_wrap_cpp(MOC_HDR ${WAVEFORM_VIEWER_INC}) + qt6_wrap_cpp(MOC_HDR ${WAVEFORM_VIEWER_INC}) hal_add_plugin(waveform_viewer SHARED #PYDOC SPHINX_DOC_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/documentation/graph_algorithm.rst HEADER ${WAVEFORM_VIEWER_INC} SOURCES ${WAVEFORM_VIEWER_SRC} ${WAVEFORM_VIEWER_PYTHON_SRC} ${MOC_HDR} - LINK_LIBRARIES PUBLIC gui netlist_simulator netlist_simulator_controller Qt5::Core Qt5::Gui Qt5::Widgets) + LINK_LIBRARIES PUBLIC gui netlist_simulator netlist_simulator_controller Qt6::Core Qt6::Gui Qt6::Widgets) endif() From 54fa637700561ff1302a375a508f31ccd31fb498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 14 Jan 2026 16:55:54 +0100 Subject: [PATCH 02/28] Upgraded QuaZip to version 1.5 which compiles preferebly against Qt6 --- deps/quazip-1.3/CMakeLists.txt | 74 ---- deps/quazip-1.3/README.md | 22 -- deps/quazip-1.3/quazip/quachecksum32.cpp | 5 - deps/quazip-1.5/.editorconfig | 12 + deps/quazip-1.5/.gitattributes | 23 ++ deps/quazip-1.5/.github/docker/README.md | 5 + .../qt-5.15.12-ubuntu-static/Dockerfile | 67 ++++ .../docker/qt-6.4.3-ubuntu-static/Dockerfile | 72 ++++ .../docker/qt-6.8.2-ubuntu-static/Dockerfile | 72 ++++ deps/quazip-1.5/.github/workflows/ci.yml | 177 ++++++++++ deps/quazip-1.5/.github/workflows/qt-zlib.yml | 321 ++++++++++++++++++ .../.github/workflows/reusable-win.yml | 136 ++++++++ .../quazip-1.5/.github/workflows/reusable.yml | 112 ++++++ .../.github/workflows/scorecard.yml | 73 ++++ deps/quazip-1.5/.gitignore | 13 + deps/quazip-1.5/CMakeLists.txt | 213 ++++++++++++ deps/quazip-1.5/CMakePresets.json | 44 +++ .../CONTRIBUTING.md | 0 deps/{quazip-1.3 => quazip-1.5}/COPYING | 0 deps/{quazip-1.3 => quazip-1.5}/NEWS.txt | 4 + .../QuaZip-1.x-migration.md | 0 deps/quazip-1.5/README.md | 114 +++++++ deps/quazip-1.5/SECURITY.md | 14 + deps/quazip-1.5/cmake/clone-repo.cmake | 35 ++ deps/quazip-1.5/cmake/windeployqt.cmake | 22 ++ deps/quazip-1.5/conanfile.py | 16 + .../quazip/CMakeLists.txt | 14 +- .../quazip/JlCompress.cpp | 252 +++++++------- .../quazip/JlCompress.h | 133 +++++++- .../quazip/QuaZipConfig.cmake.in | 13 +- .../quazip/doc/faq.dox | 0 .../quazip/doc/index.dox | 2 +- .../quazip/doc/usage.dox | 0 .../{quazip-1.3 => quazip-1.5}/quazip/ioapi.h | 0 .../quazip/minizip_crypt.h | 0 .../quazip/qioapi.cpp | 155 +++++---- .../quazip/quaadler32.cpp | 4 +- .../quazip/quaadler32.h | 8 +- deps/quazip-1.5/quazip/quachecksum32.cpp | 3 + .../quazip/quachecksum32.h | 0 .../quazip/quacrc32.cpp | 4 +- .../quazip/quacrc32.h | 8 +- .../quazip/quagzipfile.cpp | 10 +- .../quazip/quagzipfile.h | 12 +- .../quazip/quaziodevice.cpp | 58 ++-- .../quazip/quaziodevice.h | 16 +- .../quazip/quazip.cpp | 106 +++--- .../quazip/quazip.h | 14 +- .../quazip/quazip.pc.cmakein | 0 .../quazip/quazip_global.h | 0 .../quazip/quazip_qt_compat.h | 29 +- .../quazip/quazipdir.cpp | 161 ++++----- .../quazip/quazipdir.h | 0 .../quazip/quazipfile.cpp | 74 ++-- .../quazip/quazipfile.h | 29 +- .../quazip/quazipfileinfo.cpp | 6 +- .../quazip/quazipfileinfo.h | 0 .../quazip/quazipnewinfo.cpp | 15 +- .../quazip/quazipnewinfo.h | 10 +- .../{quazip-1.3 => quazip-1.5}/quazip/unzip.c | 28 +- .../{quazip-1.3 => quazip-1.5}/quazip/unzip.h | 0 deps/{quazip-1.3 => quazip-1.5}/quazip/zip.c | 77 ++--- deps/{quazip-1.3 => quazip-1.5}/quazip/zip.h | 0 .../qztest/CMakeLists.txt | 25 +- .../qztest/qztest.cpp | 46 ++- .../qztest/qztest.h | 0 .../qztest/qztest.qrc | 0 .../test_files/issue43_cant_get_dates.zip | Bin .../qztest/testjlcompress.cpp | 236 ++++++++++++- .../qztest/testjlcompress.h | 4 + deps/quazip-1.5/qztest/testjlcp_compress.cpp | 85 +++++ deps/quazip-1.5/qztest/testjlcp_compress.h | 46 +++ deps/quazip-1.5/qztest/testjlcp_extract.cpp | 120 +++++++ deps/quazip-1.5/qztest/testjlcp_extract.h | 36 ++ .../qztest/testquachecksum32.cpp | 0 .../qztest/testquachecksum32.h | 0 .../qztest/testquagzipfile.cpp | 0 .../qztest/testquagzipfile.h | 0 .../qztest/testquaziodevice.cpp | 0 .../qztest/testquaziodevice.h | 0 .../qztest/testquazip.cpp | 14 +- .../qztest/testquazip.h | 0 .../qztest/testquazipdir.cpp | 0 .../qztest/testquazipdir.h | 0 .../qztest/testquazipfile.cpp | 38 ++- .../qztest/testquazipfile.h | 0 .../qztest/testquazipfileinfo.cpp | 45 ++- .../qztest/testquazipfileinfo.h | 3 +- .../qztest/testquazipnewinfo.cpp | 7 +- .../qztest/testquazipnewinfo.h | 3 +- deps/quazip-1.5/vcpkg.json | 22 ++ plugins/dot_viewer/src/dot_graphics_view.cpp | 2 +- plugins/gui/CMakeLists.txt | 2 +- .../gui/src/channel_manager/channel_model.cpp | 2 +- plugins/gui/src/code_editor/code_editor.cpp | 2 +- .../gui/src/comment_system/comment_entry.cpp | 1 + .../gui/src/export/export_project_dialog.cpp | 2 +- 97 files changed, 2917 insertions(+), 711 deletions(-) delete mode 100644 deps/quazip-1.3/CMakeLists.txt delete mode 100644 deps/quazip-1.3/README.md delete mode 100644 deps/quazip-1.3/quazip/quachecksum32.cpp create mode 100644 deps/quazip-1.5/.editorconfig create mode 100644 deps/quazip-1.5/.gitattributes create mode 100644 deps/quazip-1.5/.github/docker/README.md create mode 100644 deps/quazip-1.5/.github/docker/qt-5.15.12-ubuntu-static/Dockerfile create mode 100644 deps/quazip-1.5/.github/docker/qt-6.4.3-ubuntu-static/Dockerfile create mode 100644 deps/quazip-1.5/.github/docker/qt-6.8.2-ubuntu-static/Dockerfile create mode 100644 deps/quazip-1.5/.github/workflows/ci.yml create mode 100644 deps/quazip-1.5/.github/workflows/qt-zlib.yml create mode 100644 deps/quazip-1.5/.github/workflows/reusable-win.yml create mode 100644 deps/quazip-1.5/.github/workflows/reusable.yml create mode 100644 deps/quazip-1.5/.github/workflows/scorecard.yml create mode 100644 deps/quazip-1.5/.gitignore create mode 100644 deps/quazip-1.5/CMakeLists.txt create mode 100644 deps/quazip-1.5/CMakePresets.json rename deps/{quazip-1.3 => quazip-1.5}/CONTRIBUTING.md (100%) rename deps/{quazip-1.3 => quazip-1.5}/COPYING (100%) rename deps/{quazip-1.3 => quazip-1.5}/NEWS.txt (99%) rename deps/{quazip-1.3 => quazip-1.5}/QuaZip-1.x-migration.md (100%) create mode 100644 deps/quazip-1.5/README.md create mode 100644 deps/quazip-1.5/SECURITY.md create mode 100644 deps/quazip-1.5/cmake/clone-repo.cmake create mode 100644 deps/quazip-1.5/cmake/windeployqt.cmake create mode 100644 deps/quazip-1.5/conanfile.py rename deps/{quazip-1.3 => quazip-1.5}/quazip/CMakeLists.txt (89%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/JlCompress.cpp (68%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/JlCompress.h (60%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/QuaZipConfig.cmake.in (72%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/doc/faq.dox (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/doc/index.dox (99%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/doc/usage.dox (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/ioapi.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/minizip_crypt.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/qioapi.cpp (71%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quaadler32.cpp (86%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quaadler32.h (90%) create mode 100644 deps/quazip-1.5/quazip/quachecksum32.cpp rename deps/{quazip-1.3 => quazip-1.5}/quazip/quachecksum32.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quacrc32.cpp (86%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quacrc32.h (89%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quagzipfile.cpp (94%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quagzipfile.h (93%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quaziodevice.cpp (87%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quaziodevice.h (90%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazip.cpp (91%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazip.h (99%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazip.pc.cmakein (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazip_global.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazip_qt_compat.h (85%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipdir.cpp (80%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipdir.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipfile.cpp (93%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipfile.h (96%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipfileinfo.cpp (97%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipfileinfo.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipnewinfo.cpp (96%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/quazipnewinfo.h (94%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/unzip.c (99%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/unzip.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/zip.c (96%) rename deps/{quazip-1.3 => quazip-1.5}/quazip/zip.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/CMakeLists.txt (53%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/qztest.cpp (81%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/qztest.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/qztest.qrc (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/test_files/issue43_cant_get_dates.zip (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testjlcompress.cpp (58%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testjlcompress.h (92%) create mode 100644 deps/quazip-1.5/qztest/testjlcp_compress.cpp create mode 100644 deps/quazip-1.5/qztest/testjlcp_compress.h create mode 100644 deps/quazip-1.5/qztest/testjlcp_extract.cpp create mode 100644 deps/quazip-1.5/qztest/testjlcp_extract.h rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquachecksum32.cpp (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquachecksum32.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquagzipfile.cpp (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquagzipfile.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquaziodevice.cpp (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquaziodevice.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazip.cpp (97%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazip.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipdir.cpp (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipdir.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipfile.cpp (93%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipfile.h (100%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipfileinfo.cpp (92%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipfileinfo.h (86%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipnewinfo.cpp (97%) rename deps/{quazip-1.3 => quazip-1.5}/qztest/testquazipnewinfo.h (78%) create mode 100644 deps/quazip-1.5/vcpkg.json diff --git a/deps/quazip-1.3/CMakeLists.txt b/deps/quazip-1.3/CMakeLists.txt deleted file mode 100644 index 7ba6ff4a6511..000000000000 --- a/deps/quazip-1.3/CMakeLists.txt +++ /dev/null @@ -1,74 +0,0 @@ -# require 3.15 for GNUInstallDirs -cmake_minimum_required(VERSION 3.15...3.18) - -project(QuaZip VERSION 1.3) - -set(CMAKE_CXX_STANDARD 14) - -set(QUAZIP_LIB_VERSION ${QuaZip_VERSION}) -set(QUAZIP_LIB_SOVERSION 1.3.0) - -option(BUILD_SHARED_LIBS "" ON) -option(QUAZIP_INSTALL "" ON) -option(QUAZIP_USE_QT_ZLIB "" OFF) -option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) - -# Set the default value of `${QUAZIP_QT_MAJOR_VERSION}`. -# We search quietly for Qt6 and Qt4 in that order. -# Qt6 provides config files for CMake. -# Qt4 relies on `FindQt4.cmake`. -find_package( - QT NAMES Qt6 - QUIET COMPONENTS Core -) -set(QT_VERSION_MAJOR 6) - -set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use 6, defaults to ${QT_VERSION_MAJOR}") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RELEASE) -endif() - -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_DEBUG_POSTFIX d) - -set(QUAZIP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(QUAZIP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(QUAZIP_LIB_FILE_NAME quazip${QuaZip_VERSION_MAJOR}-qt${QUAZIP_QT_MAJOR_VERSION}) -set(QUAZIP_LIB_TARGET_NAME QuaZip) -set(QUAZIP_DIR_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}-${QUAZIP_LIB_VERSION}) -set(QUAZIP_PACKAGE_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}) - -if(QUAZIP_QT_MAJOR_VERSION EQUAL 6) - find_package(Qt6 REQUIRED COMPONENTS Core - OPTIONAL_COMPONENTS Network Test) - set(QUAZIP_LIB_LIBRARIES Qt6::Core) - set(QUAZIP_TEST_QT_LIBRARIES Qt6::Core Qt6::Network Qt6::Test) - set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt6Core") -else() - message(FATAL_ERROR "Qt version ${QUAZIP_QT_MAJOR_VERSION} is not supported") -endif() - -message(STATUS "Using Qt version ${QUAZIP_QT_MAJOR_VERSION}") - -set(QUAZIP_QT_ZLIB_USED OFF) -if(QUAZIP_USE_QT_ZLIB) - find_package(Qt${QUAZIP_QT_MAJOR_VERSION} OPTIONAL_COMPONENTS Zlib) - if (Qt${QUAZIP_QT_MAJOR_VERSION}Zlib_FOUND) - set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} Qt${QUAZIP_QT_MAJOR_VERSION}::Zlib) - set(QUAZIP_QT_ZLIB_USED ON) - endif() -endif() -if(NOT QUAZIP_QT_ZLIB_USED) - find_package(ZLIB REQUIRED) - set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ZLIB::ZLIB) -endif() - -add_subdirectory(quazip) - -if(QUAZIP_ENABLE_TESTS) - message(STATUS "Building QuaZip tests") - enable_testing() - add_subdirectory(qztest) -endif() diff --git a/deps/quazip-1.3/README.md b/deps/quazip-1.3/README.md deleted file mode 100644 index e215d8eccb94..000000000000 --- a/deps/quazip-1.3/README.md +++ /dev/null @@ -1,22 +0,0 @@ -QuaZip is the C++ wrapper for Gilles Vollant's ZIP/UNZIP package -(AKA Minizip) using Trolltech's Qt library. - -If you need to write files to a ZIP archive or read files from one -using QIODevice API, QuaZip is exactly the kind of tool you need. - -See [the documentation](https://stachenov.github.io/quazip/) for details. - -Want to report a bug or ask for a feature? Open an [issue](https://github.com/stachenov/quazip/issues). - -Want to fix a bug or implement a new feature? See [CONTRIBUTING.md](CONTRIBUTING.md). - -You're a package maintainer and want to update to QuaZip 1.0? Read [the migration guide](https://github.com/stachenov/quazip/blob/master/QuaZip-1.x-migration.md). - -Copyright notice: - -Copyright (C) 2005-2020 Sergey A. Tachenov and contributors - -Distributed under LGPL, full details in the COPYING file. - -Original ZIP package is copyrighted by Gilles Vollant, see -quazip/(un)zip.h files for details, but basically it's the zlib license. diff --git a/deps/quazip-1.3/quazip/quachecksum32.cpp b/deps/quazip-1.3/quazip/quachecksum32.cpp deleted file mode 100644 index 3625cf1b13aa..000000000000 --- a/deps/quazip-1.3/quazip/quachecksum32.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "quachecksum32.h" - -QuaChecksum32::~QuaChecksum32() -{ -} diff --git a/deps/quazip-1.5/.editorconfig b/deps/quazip-1.5/.editorconfig new file mode 100644 index 000000000000..7c82e9bc2dab --- /dev/null +++ b/deps/quazip-1.5/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +indent_size = 4 + +[*.yml] +indent_size = 2 + +[*.yaml] +indent_size = 2 \ No newline at end of file diff --git a/deps/quazip-1.5/.gitattributes b/deps/quazip-1.5/.gitattributes new file mode 100644 index 000000000000..77d343387af0 --- /dev/null +++ b/deps/quazip-1.5/.gitattributes @@ -0,0 +1,23 @@ +# old Git versions +*.h -crlf +*.cpp -crlf +*.c -crlf +*.dox -crlf +# NOT *.txt because NEWS.txt is in CRLF format for historic reasons +CMakeLists.txt -crlf +*.in -crlf +*.cmakein -crlf +*.symbols -crlf +.editorconfig -crlf + +# new Git versions +*.h text eol=lf +*.cpp text eol=lf +*.c text eol=lf +*.dox text eol=lf +# NOT *.txt because NEWS.txt is in CRLF format for historic reasons +CMakeLists.txt text eol=lf +*.in text eol=lf +*.cmakein text eol=lf +*.symbols text eol=lf +.editorconfig eol=lf diff --git a/deps/quazip-1.5/.github/docker/README.md b/deps/quazip-1.5/.github/docker/README.md new file mode 100644 index 000000000000..aa0ad873c2cf --- /dev/null +++ b/deps/quazip-1.5/.github/docker/README.md @@ -0,0 +1,5 @@ +# Minimal Qt build images for CI + +These include minimal Qt built from source with `-qt-zlib` option to test `-DQUAZIP_USE_QT_ZLIB=ON` builds. + +`jurplel/install-qt-action` is essentially a binary downloader from Qt and does not have all options available. \ No newline at end of file diff --git a/deps/quazip-1.5/.github/docker/qt-5.15.12-ubuntu-static/Dockerfile b/deps/quazip-1.5/.github/docker/qt-5.15.12-ubuntu-static/Dockerfile new file mode 100644 index 000000000000..609ad828b2b2 --- /dev/null +++ b/deps/quazip-1.5/.github/docker/qt-5.15.12-ubuntu-static/Dockerfile @@ -0,0 +1,67 @@ +FROM ubuntu:22.04 as builder + +WORKDIR /build + +RUN apt-get -y update && apt-get -y install build-essential cmake tar wget python3 + +RUN wget -qO- https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.12/single/qt-everywhere-opensource-src-5.15.12.tar.xz | tar xJ + +RUN qt-everywhere-src-5.15.12/configure -qt-zlib \ +-static \ +-opensource \ +-confirm-license \ +-optimize-size \ +-nomake examples \ +-nomake tests \ +-no-dbus \ +-no-fontconfig \ +-no-opengl \ +-no-openssl \ +-no-gui \ +-skip qtconnectivity \ +-skip qtdatavis3d \ +-skip qtdeclarative \ +-skip qtdoc \ +-skip qtactiveqt \ +-skip qt3d \ +-skip qtimageformats \ +-skip qtlocation \ +-skip qtmultimedia \ +-skip qtopcua \ +-skip qtremoteobjects \ +-skip qtscxml \ +-skip qtsensors \ +-skip qtserialbus \ +-skip qtserialport \ +-skip qtspeech \ +-skip qtsvg \ +-skip qttools \ +-skip qttranslations \ +-skip qtwebchannel \ +-skip qtwebengine \ +-skip qtwebsockets \ +-skip qtwebview \ +-skip qtcharts \ +-skip qtcoap \ +-skip qtlottie \ +-skip qtmqtt \ +-skip qtnetworkauth \ +-skip qtquick3d \ +-skip qtquicktimeline \ +-skip qtvirtualkeyboard \ +-skip qtwayland \ +-skip qtcanvas3d \ +-skip qtgamepad \ +-skip qtpurchasing \ +-skip qtscript + +RUN make -j$(nproc) && make install + +FROM ubuntu:22.04 + +RUN apt-get -y update && apt-get -y install git build-essential cmake + +COPY --from=builder /usr/local/Qt-5.15.12 /usr/local/Qt-5.15.12 + +# Temporary workaround for https://github.com/stachenov/quazip/issues/127 +ENV LC_ALL=C.UTF-8 \ No newline at end of file diff --git a/deps/quazip-1.5/.github/docker/qt-6.4.3-ubuntu-static/Dockerfile b/deps/quazip-1.5/.github/docker/qt-6.4.3-ubuntu-static/Dockerfile new file mode 100644 index 000000000000..a861d2f5f3f9 --- /dev/null +++ b/deps/quazip-1.5/.github/docker/qt-6.4.3-ubuntu-static/Dockerfile @@ -0,0 +1,72 @@ +FROM ubuntu:22.04 AS builder + +WORKDIR /build + +RUN apt-get -y update && apt-get -y install build-essential cmake tar wget python3 + +RUN wget -qO- https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.3/single/qt-everywhere-src-6.4.3.tar.xz | tar xJ + +RUN qt-everywhere-src-6.4.3/configure -qt-zlib \ +-static \ +-opensource \ +-confirm-license \ +-optimize-size \ +-nomake examples \ +-nomake tests \ +-no-dbus \ +-no-fontconfig \ +-no-opengl \ +-no-openssl \ +-no-gui \ +-skip qtconnectivity \ +-skip qtdatavis3d \ +-skip qtdeclarative \ +-skip qtdoc \ +-skip qtactiveqt \ +-skip qt3d \ +-skip qtgraphs \ +-skip qtgrpc \ +-skip qtimageformats \ +-skip qtlanguageserver \ +-skip qtlocation \ +-skip qthttpserver \ +-skip qtmultimedia \ +-skip qtopcua \ +-skip qtpositioning \ +-skip qtremoteobjects \ +-skip qtscxml \ +-skip qtsensors \ +-skip qtserialbus \ +-skip qtserialport \ +-skip qtshadertools \ +-skip qtspeech \ +-skip qtsvg \ +-skip qttools \ +-skip qttranslations \ +-skip qtwebchannel \ +-skip qtwebengine \ +-skip qtwebsockets \ +-skip qtwebview \ +-skip qtcharts \ +-skip qtcoap \ +-skip qtlottie \ +-skip qtmqtt \ +-skip qtnetworkauth \ +-skip qtquick3d \ +-skip qtquick3dphysics \ +-skip qtquickeffectmaker \ +-skip qtquicktimeline \ +-skip qtvirtualkeyboard \ +-skip qtwayland \ +-skip qtcanvas3d \ +-skip qtgamepad \ +-skip qtpurchasing \ +-skip qtscript + +RUN cmake --build . --parallel --target install + +FROM ubuntu:22.04 + +RUN apt-get -y update && apt-get -y install build-essential cmake + +COPY --from=builder /usr/local/Qt-6.4.3 /usr/local/Qt-6.4.3 diff --git a/deps/quazip-1.5/.github/docker/qt-6.8.2-ubuntu-static/Dockerfile b/deps/quazip-1.5/.github/docker/qt-6.8.2-ubuntu-static/Dockerfile new file mode 100644 index 000000000000..2367fabbb9fe --- /dev/null +++ b/deps/quazip-1.5/.github/docker/qt-6.8.2-ubuntu-static/Dockerfile @@ -0,0 +1,72 @@ +FROM ubuntu:22.04 as builder + +WORKDIR /build + +RUN apt-get -y update && apt-get -y install build-essential cmake tar wget python3 + +RUN wget -qO- https://ftp.fau.de/qtproject/archive/qt/6.8/6.8.2/single/qt-everywhere-src-6.8.2.tar.xz | tar xJ + +RUN qt-everywhere-src-6.8.2/configure -qt-zlib \ +-static \ +-opensource \ +-confirm-license \ +-optimize-size \ +-nomake examples \ +-nomake tests \ +-no-dbus \ +-no-fontconfig \ +-no-opengl \ +-no-openssl \ +-no-gui \ +-skip qtconnectivity \ +-skip qtdatavis3d \ +-skip qtdeclarative \ +-skip qtdoc \ +-skip qtactiveqt \ +-skip qt3d \ +-skip qtgraphs \ +-skip qtgrpc \ +-skip qtimageformats \ +-skip qtlanguageserver \ +-skip qtlocation \ +-skip qthttpserver \ +-skip qtmultimedia \ +-skip qtopcua \ +-skip qtpositioning \ +-skip qtremoteobjects \ +-skip qtscxml \ +-skip qtsensors \ +-skip qtserialbus \ +-skip qtserialport \ +-skip qtshadertools \ +-skip qtspeech \ +-skip qtsvg \ +-skip qttools \ +-skip qttranslations \ +-skip qtwebchannel \ +-skip qtwebengine \ +-skip qtwebsockets \ +-skip qtwebview \ +-skip qtcharts \ +-skip qtcoap \ +-skip qtlottie \ +-skip qtmqtt \ +-skip qtnetworkauth \ +-skip qtquick3d \ +-skip qtquick3dphysics \ +-skip qtquickeffectmaker \ +-skip qtquicktimeline \ +-skip qtvirtualkeyboard \ +-skip qtwayland \ +-skip qtcanvas3d \ +-skip qtgamepad \ +-skip qtpurchasing \ +-skip qtscript + +RUN cmake --build . --parallel --target install + +FROM ubuntu:22.04 + +RUN apt-get -y update && apt-get -y install build-essential cmake + +COPY --from=builder /usr/local/Qt-6.8.2 /usr/local/Qt-6.8.2 \ No newline at end of file diff --git a/deps/quazip-1.5/.github/workflows/ci.yml b/deps/quazip-1.5/.github/workflows/ci.yml new file mode 100644 index 000000000000..13c41f4db0a1 --- /dev/null +++ b/deps/quazip-1.5/.github/workflows/ci.yml @@ -0,0 +1,177 @@ +on: + push: + branches: + - master + - feature/* + pull_request: + +name: CI +permissions: read-all + +jobs: + ubuntu: + if: true + name: Ubuntu-${{ matrix.os_version }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} + strategy: + fail-fast: false + matrix: + os_version: [22.04, 24.04] + qt_version: [5.15.2, 6.8.2] + shared: [ON, OFF] + uses: ./.github/workflows/reusable.yml + with: + runs_on: ubuntu-${{ matrix.os_version }} + os_version: ${{ matrix.os_version }} + qt_version: ${{ matrix.qt_version }} + shared: ${{ matrix.shared }} + + ubuntu-zlibconst: + if: true + name: Ubuntu-${{ matrix.os_version }}-Qt-${{ matrix.qt_version }}-shared-zlibconst + strategy: + fail-fast: false + matrix: + os_version: [ 24.04 ] + qt_version: [ 6.8.2 ] + uses: ./.github/workflows/reusable.yml + with: + runs_on: ubuntu-${{ matrix.os_version }} + os_version: ${{ matrix.os_version }} + qt_version: ${{ matrix.qt_version }} + shared: "ON" + zlib_const: "ON" + + macos: + if: true + name: macos-${{ matrix.os_version }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} + strategy: + fail-fast: false + matrix: + os_version: [14, 13] + qt_version: [5.15.2, 6.8.2] + shared: [ON, OFF] + exclude: + - os_version: 14 + qt_version: 5.15.2 #Not available on macos-14 due to ARM arch + uses: ./.github/workflows/reusable.yml + with: + runs_on: macos-${{ matrix.os_version }} + os_version: ${{ matrix.os_version }} + qt_version: ${{ matrix.qt_version }} + shared: ${{ matrix.shared }} + + alpine: + if: true + name: "cmake on ${{ matrix.runner }}" + runs-on: "ubuntu-22.04" + container: + image: "${{ matrix.runner }}" + strategy: + matrix: + runner: + - "alpine:3.13" # cmake 3.15, qt 5.15 + env: + DEBIAN_FRONTEND: noninteractive + steps: + - name: Show OS info + run: cat /etc/os-release + - uses: actions/checkout@v4 + - name: Install qt and build tools + run: apk add --update g++ make cmake qt5-qtbase-dev + - name: Show cmake version + run: cmake --version + - name: Run cmake + run: cmake -S . -B build -DQUAZIP_ENABLE_TESTS=ON + - name: Build quazip + run: cd build && VERBOSE=1 make -j8 + - name: Build tests + run: cd build/qztest && VERBOSE=1 make -j8 + - name: Run tests + run: build/qztest/qztest + + windows-x64: + if: true + name: Win-Qt-${{ matrix.qt_version }}-preset-${{ matrix.preset }} + strategy: + fail-fast: false + matrix: + preset: [ conan, vcpkg ] + qt_version: [ 5.15.2, 6.8.2 ] + uses: ./.github/workflows/reusable-win.yml + with: + runs_on: "win-x64" + arch: x64 + qt_version: ${{ matrix.qt_version }} + preset: ${{ matrix.preset }} + pe_str: "x86-64" + + windows-x86: + if: true + name: Win-Qt-${{ matrix.qt_version }}-preset-${{ matrix.preset }} + strategy: + fail-fast: false + matrix: + preset: [ conan_x86, vcpkg_x86 ] + qt_version: [ 5.15.2 ] + uses: ./.github/workflows/reusable-win.yml + with: + runs_on: "win-x86" + arch: x86 + qt_version: ${{ matrix.qt_version }} + preset: ${{ matrix.preset }} + pe_str: "i386" + + # Cross platform extraction jobs + ubuntu-ci-extract: + if: true + name: extract-Ubuntu-${{ matrix.os_version }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} + strategy: + fail-fast: false + matrix: + os_version: [ 24.04 ] + qt_version: [ 6.8.2 ] + shared: [ ON ] + uses: ./.github/workflows/reusable.yml + needs: [ ubuntu, macos, windows-x64, windows-x86 ] + with: + runs_on: ubuntu-${{ matrix.os_version }} + os_version: ${{ matrix.os_version }} + qt_version: ${{ matrix.qt_version }} + shared: ${{ matrix.shared }} + cross_extract: true + + macos-ci-extract: + if: true + name: extract-macos-${{ matrix.os_version }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }} + strategy: + fail-fast: false + matrix: + os_version: [ 14 ] + qt_version: [ 6.8.2 ] + shared: [ ON ] + uses: ./.github/workflows/reusable.yml + needs: [ ubuntu, macos, windows-x64, windows-x86 ] + with: + runs_on: macos-${{ matrix.os_version }} + os_version: ${{ matrix.os_version }} + qt_version: ${{ matrix.qt_version }} + shared: ${{ matrix.shared }} + cross_extract: true + + windows-x64-ci-extract: + if: true + name: extract-Win-Qt-${{ matrix.qt_version }}-preset-${{ matrix.preset }} + strategy: + fail-fast: false + matrix: + preset: [ vcpkg ] + qt_version: [ 6.8.2 ] + uses: ./.github/workflows/reusable-win.yml + needs: [ ubuntu, macos, windows-x64, windows-x86 ] + with: + runs_on: "win-x64" + arch: x64 + qt_version: ${{ matrix.qt_version }} + preset: ${{ matrix.preset }} + pe_str: "x86-64" + cross_extract: true \ No newline at end of file diff --git a/deps/quazip-1.5/.github/workflows/qt-zlib.yml b/deps/quazip-1.5/.github/workflows/qt-zlib.yml new file mode 100644 index 000000000000..db903e95158d --- /dev/null +++ b/deps/quazip-1.5/.github/workflows/qt-zlib.yml @@ -0,0 +1,321 @@ +on: + push: + branches: + - master + - feature/* + pull_request: + +name: qt-zlib + +permissions: read-all + +env: + BUILD_TYPE: Release + +jobs: + + use-qt-zlib-ubuntu: + if: true + runs-on: ubuntu-22.04 + name: use-qt-zlib-ubuntu-${{ matrix.qt_version }} + container: ghcr.io/cen1/qt:${{ matrix.qt_version }} + strategy: + fail-fast: false + matrix: + qt_version: [ 5.15.12, 6.4.3, 6.8.2 ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure CMake + run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_SHARED_LIBS=OFF -DQUAZIP_ENABLE_TESTS=ON -DQUAZIP_USE_QT_ZLIB=ON -DCMAKE_PREFIX_PATH="/usr/local/Qt-${{ matrix.qt_version }}" -B build + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} + + - name: Run tests + working-directory: build + run: ctest --verbose -C Release + + use-qt6-zlib-windows: + if: true + runs-on: windows-latest + name: use-qt6-zlib-windows-${{ matrix.qt_version }} + strategy: + fail-fast: false + matrix: + qt_version: [ 6.8.2 ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: Restore Qt build cache + id: cache-qt-restore + uses: actions/cache@v4 + with: + key: windows-qt-${{ matrix.qt_version }} + path: qt-everywhere-src-${{ matrix.qt_version }} + + - name: Restore Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + id: cache-qt-zip-restore + uses: actions/cache@v4 + with: + key: windows-qt-${{ matrix.qt_version }}-zip + path: qt-everywhere-src-${{ matrix.qt_version }}.zip + + - name: Download Qt 6 + if: steps.cache-qt-restore.outputs.cache-hit != 'true' && steps.cache-qt-zip-restore.outputs.cache-hit != 'true' + shell: bash + run: | + curl https://ftp.fau.de/qtproject/archive/qt/6.8/${{ matrix.qt_version }}/single/qt-everywhere-src-${{ matrix.qt_version }}.zip --output qt-everywhere-src-${{ matrix.qt_version }}.zip + + - name: Save Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' && steps.cache-qt-zip-restore.outputs.cache-hit != 'true' + id: cache-qt-zip-save + uses: actions/cache/save@v4 + with: + path: qt-everywhere-src-${{ matrix.qt_version }}.zip + key: windows-qt-${{ matrix.qt_version }}-zip + + - name: Extract Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: bash + run: | + unzip -q qt-everywhere-src-${{ matrix.qt_version }}.zip + ls -la + + - name: Configure Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: ./configure.bat -prefix "${{github.workspace}}/Qt" -qt-zlib \ + -static \ + -opensource \ + -confirm-license \ + -optimize-size \ + -nomake examples \ + -nomake tests \ + -no-dbus \ + -no-icu \ + -no-fontconfig \ + -no-opengl \ + -no-openssl \ + -no-gui \ + -skip qtconnectivity \ + -skip qtdatavis3d \ + -skip qtdeclarative \ + -skip qtdoc \ + -skip qtactiveqt \ + -skip qt3d \ + -skip qtgraphs \ + -skip qtgrpc \ + -skip qtimageformats \ + -skip qtlanguageserver \ + -skip qtlocation \ + -skip qthttpserver \ + -skip qtmultimedia \ + -skip qtopcua \ + -skip qtpositioning \ + -skip qtremoteobjects \ + -skip qtscxml \ + -skip qtsensors \ + -skip qtserialbus \ + -skip qtserialport \ + -skip qtshadertools \ + -skip qtspeech \ + -skip qtsvg \ + -skip qttools \ + -skip qttranslations \ + -skip qtwebchannel \ + -skip qtwebengine \ + -skip qtwebsockets \ + -skip qtwebview \ + -skip qtcharts \ + -skip qtcoap \ + -skip qtlottie \ + -skip qtmqtt \ + -skip qtnetworkauth \ + -skip qtquick3d \ + -skip qtquick3dphysics \ + -skip qtquickeffectmaker \ + -skip qtquicktimeline \ + -skip qtvirtualkeyboard \ + -skip qtwayland \ + -skip qtcanvas3d \ + -skip qtgamepad \ + -skip qtpurchasing \ + -skip qtscript + + - name: Build Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: cmake --build . --parallel + + - name: Cache Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + id: cache-qt + uses: actions/cache/save@v4 + with: + path: qt-everywhere-src-${{ matrix.qt_version }} + key: windows-qt-${{ matrix.qt_version }} + + - name: Install Qt + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: cmake --install . + + - name: Configure CMake + run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DQUAZIP_QT_MAJOR_VERSION=6 -DBUILD_SHARED_LIBS=OFF -DQUAZIP_ENABLE_TESTS=ON -DQUAZIP_USE_QT_ZLIB=ON -B "${{github.workspace}}/build" -DCMAKE_PREFIX_PATH="${{github.workspace}}\Qt" + + - name: Build + shell: cmd + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Run tests + shell: cmd + working-directory: ${{github.workspace}}/build + run: ctest --verbose --output-on-failure -C Release + + use-qt5-zlib-windows: + if: true + runs-on: windows-latest + name: use-qt5-zlib-windows-${{ matrix.qt_version }} + strategy: + fail-fast: false + matrix: + qt_version: [ 5.15.12 ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: Restore Qt build cache + id: cache-qt-restore + uses: actions/cache@v4 + with: + key: windows-qt-${{ matrix.qt_version }} + path: qt-everywhere-src-${{ matrix.qt_version }} + + - name: Restore Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + id: cache-qt-zip-restore + uses: actions/cache@v4 + with: + key: windows-qt-${{ matrix.qt_version }}-zip + path: qt-everywhere-src-${{ matrix.qt_version }}.zip + + - name: Download Qt 5 + if: steps.cache-qt-restore.outputs.cache-hit != 'true' && steps.cache-qt-zip-restore.outputs.cache-hit != 'true' + shell: bash + run: | + curl https://ftp.fau.de/qtproject/archive/qt/5.15/${{ matrix.qt_version }}/single/qt-everywhere-opensource-src-${{ matrix.qt_version }}.zip --output qt-everywhere-src-${{ matrix.qt_version }}.zip + + - name: Save Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' && steps.cache-qt-zip-restore.outputs.cache-hit != 'true' + id: cache-qt-zip-save + uses: actions/cache/save@v4 + with: + path: qt-everywhere-src-${{ matrix.qt_version }}.zip + key: windows-qt-${{ matrix.qt_version }}-zip + + - name: Extract Qt zip + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: bash + run: | + unzip -q qt-everywhere-src-${{ matrix.qt_version }}.zip + ls -la + + - name: Configure Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: ./configure.bat -prefix "${{github.workspace}}/Qt" -qt-zlib ^ + -static ^ + -opensource ^ + -confirm-license ^ + -optimize-size ^ + -nomake examples ^ + -nomake tests ^ + -no-dbus ^ + -no-fontconfig ^ + -no-opengl ^ + -no-openssl ^ + -no-gui ^ + -skip qtconnectivity ^ + -skip qtdatavis3d ^ + -skip qtdeclarative ^ + -skip qtdoc ^ + -skip qtactiveqt ^ + -skip qt3d ^ + -skip qtimageformats ^ + -skip qtlocation ^ + -skip qtmultimedia ^ + -skip qtopcua ^ + -skip qtremoteobjects ^ + -skip qtscxml ^ + -skip qtsensors ^ + -skip qtserialbus ^ + -skip qtserialport ^ + -skip qtspeech ^ + -skip qtsvg ^ + -skip qttools ^ + -skip qttranslations ^ + -skip qtwebchannel ^ + -skip qtwebengine ^ + -skip qtwebsockets ^ + -skip qtwebview ^ + -skip qtcharts ^ + -skip qtcoap ^ + -skip qtlottie ^ + -skip qtmqtt ^ + -skip qtnetworkauth ^ + -skip qtquick3d ^ + -skip qtquicktimeline ^ + -skip qtvirtualkeyboard ^ + -skip qtwayland ^ + -skip qtcanvas3d ^ + -skip qtgamepad ^ + -skip qtpurchasing ^ + -skip qtscript + + - name: Build Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: nmake + + - name: Cache Qt + if: steps.cache-qt-restore.outputs.cache-hit != 'true' + id: cache-qt + uses: actions/cache/save@v4 + with: + path: qt-everywhere-src-${{ matrix.qt_version }} + key: windows-qt-${{ matrix.qt_version }} + + - name: Install Qt + shell: cmd + working-directory: qt-everywhere-src-${{ matrix.qt_version }} + run: nmake install + + - name: Configure CMake + run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DQUAZIP_QT_MAJOR_VERSION=5 -DBUILD_SHARED_LIBS=OFF -DQUAZIP_ENABLE_TESTS=ON -DQUAZIP_USE_QT_ZLIB=ON -B build -DCMAKE_PREFIX_PATH="${{github.workspace}}\Qt" + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} + + - name: Run tests + shell: cmd + working-directory: build + run: ctest --extra-verbose -C Release \ No newline at end of file diff --git a/deps/quazip-1.5/.github/workflows/reusable-win.yml b/deps/quazip-1.5/.github/workflows/reusable-win.yml new file mode 100644 index 000000000000..f6ff678934d4 --- /dev/null +++ b/deps/quazip-1.5/.github/workflows/reusable-win.yml @@ -0,0 +1,136 @@ +name: Reusable Windows Build Workflow + +permissions: read-all + +on: + workflow_call: + inputs: + arch: + required: true + type: string + qt_version: + required: true + type: string + runs_on: + required: true + type: string + preset: + required: true + type: string + pe_str: + required: true + type: string + run_tests: + required: false + default: true + type: boolean + cross_extract: + required: false + default: false + type: boolean + secrets: + GH_TOKEN: + required: false + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + # All aqt options: https://ddalcino.github.io/aqt-list-server/ + BUILD_TYPE: Release + +jobs: + build: + runs-on: windows-latest + name: Windows-${{ inputs.arch }}-Qt-${{ inputs.qt_version }}-Preset-${{ inputs.preset }} + steps: + - uses: actions/checkout@v4 + + - name: Install Qt6 + if: "startsWith(inputs.qt_version, '6.')" + uses: jurplel/install-qt-action@v3 + with: + version: ${{ inputs.qt_version }} + cache: 'true' + cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ inputs.qt_version }} + dir: ${{ github.workspace }}/Qt + modules: 'qt5compat' + arch: 'win64_msvc2022_64' + + - name: Install Qt5 + if: "startsWith(inputs.qt_version, '5.')" + uses: jurplel/install-qt-action@v3 + with: + version: ${{ inputs.qt_version }} + cache: 'true' + cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ inputs.qt_version }} + dir: ${{ github.workspace }}/Qt + arch: ${{ inputs.arch == 'x86' && 'win32_msvc2019' || 'win64_msvc2019_64' }} + + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: ${{ inputs.arch }} + + - name: Install Conan + if: contains(inputs.preset, 'conan') + uses: turtlebrowser/get-conan@main + + - name: Init Conan + if: contains(inputs.preset, 'conan') + run: conan profile detect + + - name: Install dependencies with Conan + if: contains(inputs.preset, 'conan') + shell: cmd + run: conan install . -of build -s build_type=Release -o *:shared=False --build=missing ${{ inputs.arch == 'x86' && '-s:h arch=x86' || '' }} + + - name: Configure + shell: cmd + run: cmake --preset ${{ inputs.preset }} -DQUAZIP_ENABLE_TESTS=ON + + - name: Build + shell: cmd + run: cmake --build ${{github.workspace}}/build --config Release + + # This second build is here temporarily until we figure out why qztest dep .dlls are not copied after first build + - name: Build 2 + shell: cmd + run: cmake --build ${{github.workspace}}/build --config Release + + - name: Check PE + shell: bash + working-directory: ./build/quazip/Release + run: | + DLL_NAME="quazip1-qt${{ startsWith(inputs.qt_version, '6') && '6' || '5' }}.dll" + file "$DLL_NAME" + file "$DLL_NAME" |grep "${{ inputs.pe_str }}" + + - name: Run tests + if: inputs.run_tests && !inputs.cross_extract + env: + TEST_CR_COMPRESS: "true" + QT_ASSUME_STDERR_HAS_CONSOLE: 1 # !! qDebug() is not visible if this is not set on Win runners + working-directory: ./build + run: ctest --verbose -C Release + + - name: Upload cp.zip to GitHub Actions Storage + if: inputs.run_tests && !inputs.cross_extract + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + overwrite: true + name: "${{ inputs.runs_on }}_${{ inputs.preset }}_qt${{ inputs.qt_version }}_shared${{ inputs.shared }}_cp" + path: build/quazip/cp.zip + + - name: Download bundle containing cp.zip + if: inputs.cross_extract + uses: actions/download-artifact@v4 + with: + path: build/quazip + merge-multiple: false + + - name: Run extract tests + if: inputs.cross_extract + working-directory: ${{github.workspace}}/build + env: + TEST_CR_DECOMPRESS: "true" + QT_ASSUME_STDERR_HAS_CONSOLE: 1 + run: ctest --verbose -C Release \ No newline at end of file diff --git a/deps/quazip-1.5/.github/workflows/reusable.yml b/deps/quazip-1.5/.github/workflows/reusable.yml new file mode 100644 index 000000000000..b074f9e7ebea --- /dev/null +++ b/deps/quazip-1.5/.github/workflows/reusable.yml @@ -0,0 +1,112 @@ +name: Reusable build workflow + +permissions: read-all + +on: + workflow_call: + inputs: + os_version: + required: true + type: string + qt_version: + required: true + type: string + shared: + required: false + default: "ON" + type: string + zlib_const: + required: false + default: "OFF" + type: string + runs_on: + required: true + type: string + run_tests: + required: false + default: true + type: boolean + cross_extract: + required: false + default: false + type: boolean + secrets: + GH_TOKEN: + required: false + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + # All aqt options: https://ddalcino.github.io/aqt-list-server/ + BUILD_TYPE: Release + +jobs: + build: + runs-on: ${{ inputs.runs_on }} + name: Build-${{ inputs.runs_on }}-Qt-${{ inputs.qt_version }}-shared-${{ inputs.shared }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Qt6 + if: "startsWith(inputs.qt_version, '6.')" + uses: jurplel/install-qt-action@v3 + with: + version: ${{ inputs.qt_version }} + cache: 'true' + cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ inputs.qt_version }} + dir: ${{ github.workspace }}/Qt + modules: 'qt5compat' + + - name: Install Qt5 + if: "startsWith(inputs.qt_version, '5.')" + uses: jurplel/install-qt-action@v3 + with: + version: ${{ inputs.qt_version }} + cache: 'true' + cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ inputs.qt_version }} + dir: ${{ github.workspace }}/Qt + + - name: Install libraries (Linux Only) + if: contains(inputs.runs_on, 'ubuntu') + run: | + sudo apt-get update && + sudo apt-get install -y --no-install-recommends \ + zlib1g-dev libbz2-dev + + - name: Configure CMake + run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_SHARED_LIBS=${{ inputs.shared }} -DQUAZIP_ENABLE_TESTS=ON -DZLIB_CONST=${{ inputs.zlib_const }} -B "${{github.workspace}}/build" + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Run tests + if: inputs.run_tests && !inputs.cross_extract + working-directory: ${{github.workspace}}/build + env: + TEST_CR_COMPRESS: "true" + run: ctest --verbose + + - name: Upload cp.zip to GitHub Actions Storage + if: inputs.run_tests && !inputs.cross_extract + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + overwrite: true + name: "${{ inputs.runs_on }}_qt${{ inputs.qt_version }}_shared${{ inputs.shared }}_cp" + path: build/quazip/cp.zip + + - name: Download bundle containing cp.zip + if: inputs.cross_extract + uses: actions/download-artifact@v4 + with: + path: build/quazip + merge-multiple: false + + - name: Run extract tests + if: inputs.cross_extract + working-directory: ${{github.workspace}}/build + env: + TEST_CR_DECOMPRESS: "true" + run: ctest --verbose + + diff --git a/deps/quazip-1.5/.github/workflows/scorecard.yml b/deps/quazip-1.5/.github/workflows/scorecard.yml new file mode 100644 index 000000000000..9cbc532d4a3f --- /dev/null +++ b/deps/quazip-1.5/.github/workflows/scorecard.yml @@ -0,0 +1,73 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '40 5 * * 2' + push: + branches: [ "master" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@v4 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + with: + sarif_file: results.sarif diff --git a/deps/quazip-1.5/.gitignore b/deps/quazip-1.5/.gitignore new file mode 100644 index 000000000000..461946c21209 --- /dev/null +++ b/deps/quazip-1.5/.gitignore @@ -0,0 +1,13 @@ +/doc +/build +/build_release +/build_debug +/lib +*.tags +*.user +*.swp +.idea/ +cmake-* +CMakeUserPresets.json +vcpkg_installed/ +Testing/ \ No newline at end of file diff --git a/deps/quazip-1.5/CMakeLists.txt b/deps/quazip-1.5/CMakeLists.txt new file mode 100644 index 000000000000..404b6ff7757b --- /dev/null +++ b/deps/quazip-1.5/CMakeLists.txt @@ -0,0 +1,213 @@ +# require 3.15 for GNUInstallDirs +cmake_minimum_required(VERSION 3.15...3.18) + +project(QuaZip VERSION 1.5) + +include(cmake/clone-repo.cmake) + +set(QUAZIP_LIB_VERSION ${QuaZip_VERSION}) +set(QUAZIP_LIB_SOVERSION 1.5.0) + +if(EMSCRIPTEN) + #option(ZLIB_INCLUDE "Path to include dir" "") + #option(ZLIB_LIBRARY "Path to library dir" "") + option(BUILD_SHARED_LIBS "" OFF) + option(QUAZIP_INSTALL "" OFF) + option(QUAZIP_USE_QT_ZLIB "" OFF) + option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) +else() + option(BUILD_SHARED_LIBS "" ON) + option(QUAZIP_INSTALL "" ON) + option(QUAZIP_USE_QT_ZLIB "" OFF) + option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) +endif() + +OPTION(ZLIB_CONST "Sets ZLIB_CONST preprocessor definition" OFF) + +# Make BZIP2 optional +option(QUAZIP_BZIP2 "Enables BZIP2 compression" ON) +option(QUAZIP_BZIP2_STDIO "Output BZIP2 errors to stdio" ON) + +option(QUAZIP_FETCH_LIBS "Enables fetching third-party libraries if not found" ${WIN32}) +option(QUAZIP_FORCE_FETCH_LIBS "Enables fetching third-party libraries always" OFF) + +if (QUAZIP_USE_QT_ZLIB AND BUILD_SHARED_LIBS) + message(FATAL_ERROR "Using BUILD_SHARED_LIBS=ON together with QUAZIP_USE_QT_ZLIB=ON is not supported." ) +endif() + +# Set the default value of `${QUAZIP_QT_MAJOR_VERSION}` +# Qt6 provides config files for CMake. +# Qt4 relies on `FindQt4.cmake`. +find_package( + QT NAMES Qt6 + QUIET COMPONENTS Core +) + +set(QT_VERSION_MAJOR 6) + +set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use (4, 5 or 6), defaults to ${QT_VERSION_MAJOR}") + +if (QUAZIP_QT_MAJOR_VERSION EQUAL 6) + set(CMAKE_CXX_STANDARD 17) +else() + set(CMAKE_CXX_STANDARD 14) +endif() + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RELEASE) +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_DEBUG_POSTFIX d) + +set(QUAZIP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(QUAZIP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(QUAZIP_LIB_FILE_NAME quazip${QuaZip_VERSION_MAJOR}-qt${QUAZIP_QT_MAJOR_VERSION}) +set(QUAZIP_LIB_TARGET_NAME QuaZip) +set(QUAZIP_DIR_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}-${QUAZIP_LIB_VERSION}) +set(QUAZIP_PACKAGE_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}) + +message(STATUS "QUAZIP_QT_MAJOR_VERSION set to ${QUAZIP_QT_MAJOR_VERSION}") +message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") + +if(QUAZIP_QT_MAJOR_VERSION EQUAL 6) + find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat + OPTIONAL_COMPONENTS Network Test) + message(STATUS "Found Qt version ${Qt6_VERSION} at ${Qt6_DIR}") + set(QUAZIP_QT_ZLIB_COMPONENT BundledZLIB) + set(QUAZIP_QT_ZLIB_HEADER_COMPONENT ZlibPrivate) + set(QUAZIP_LIB_LIBRARIES Qt6::Core Qt6::Core5Compat) + set(QUAZIP_TEST_QT_LIBRARIES Qt6::Core Qt6::Core5Compat Qt6::Network Qt6::Test) + set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt6Core") +else() + message(FATAL_ERROR "Qt version ${QUAZIP_QT_MAJOR_VERSION} is not supported") +endif() + +message(STATUS "Using Qt version ${QUAZIP_QT_MAJOR_VERSION}") + +set(QUAZIP_QT_ZLIB_USED OFF) +if(QUAZIP_USE_QT_ZLIB) + find_package(Qt${QUAZIP_QT_MAJOR_VERSION} OPTIONAL_COMPONENTS ${QUAZIP_QT_ZLIB_COMPONENT}) + set(QUAZIP_QT_ZLIB_COMPONENT_FOUND Qt${QUAZIP_QT_MAJOR_VERSION}${QUAZIP_QT_ZLIB_COMPONENT}_FOUND) + if (DEFINED QUAZIP_QT_ZLIB_HEADER_COMPONENT) + find_package(Qt${QUAZIP_QT_MAJOR_VERSION} OPTIONAL_COMPONENTS ${QUAZIP_QT_ZLIB_HEADER_COMPONENT}) + set(QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND Qt${QUAZIP_QT_MAJOR_VERSION}${QUAZIP_QT_ZLIB_HEADER_COMPONENT}_FOUND) + else() + set(QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND ON) + endif() + if(QUAZIP_QT_ZLIB_COMPONENT_FOUND AND QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND) + message(STATUS "Qt component ${QUAZIP_QT_ZLIB_COMPONENT} found") + set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} Qt${QUAZIP_QT_MAJOR_VERSION}::${QUAZIP_QT_ZLIB_COMPONENT}) + if(DEFINED QUAZIP_QT_ZLIB_HEADER_COMPONENT) + message(STATUS "Qt component ${QUAZIP_QT_ZLIB_HEADER_COMPONENT} found") + set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} Qt${QUAZIP_QT_MAJOR_VERSION}::${QUAZIP_QT_ZLIB_HEADER_COMPONENT}) + endif() + set(QUAZIP_QT_ZLIB_USED ON) + else() + message(FATAL_ERROR "QUAZIP_USE_QT_ZLIB was set but bundled zlib was not found. Terminating to prevent accidental linking to system libraries.") + endif() +endif() + +if(QUAZIP_QT_ZLIB_USED AND QUAZIP_QT_ZLIB_COMPONENT STREQUAL BundledZLIB) + # Qt's new BundledZLIB uses z-prefix in zlib + add_compile_definitions(Z_PREFIX) +endif() + +if(NOT QUAZIP_QT_ZLIB_USED) + + if(EMSCRIPTEN) + if(NOT DEFINED ZLIB_LIBRARY) + message(WARNING "ZLIB_LIBRARY is not set") + endif() + + if(NOT DEFINED ZLIB_INCLUDE) + message(WARNING "ZLIB_INCLUDE is not set") + else() + include_directories(${ZLIB_INCLUDE}) + endif() + + if(NOT DEFINED ZCONF_INCLUDE) + message(WARNING "ZCONF_INCLUDE is not set") + else() + include_directories(${ZCONF_INCLUDE}) + endif() + + set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ${ZLIB_LIBRARY}) + else() + find_package(ZLIB REQUIRED) + set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ZLIB::ZLIB) + endif() +endif() + +if (ZLIB_CONST) + add_compile_definitions(ZLIB_CONST) +endif() + +set(QUAZIP_DEP) +set(QUAZIP_INC) +set(QUAZIP_LIB) +set(QUAZIP_LBD) + +if(QUAZIP_BZIP2) + # Check if bzip2 is present + set(QUAZIP_BZIP2 ON) + + if(NOT QUAZIP_FORCE_FETCH_LIBS) + find_package(BZip2 QUIET) + endif() + + if(BZIP2_FOUND AND NOT QUAZIP_FORCE_FETCH_LIBS) + message(STATUS "Using BZIP2 ${BZIP2_VERSION_STRING}") + + list(APPEND QUAZIP_INC ${BZIP2_INCLUDE_DIRS}) + list(APPEND QUAZIP_LIB ${BZIP2_LIBRARIES}) + list(APPEND QUAZIP_LBD ${BZIP2_LIBRARY_DIRS}) + + set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lbzip2") + elseif(QUAZIP_FETCH_LIBS) + clone_repo(bzip2 https://sourceware.org/git/bzip2.git) + + # BZip2 repository does not support cmake so we have to create + # the bzip2 library ourselves + set(BZIP2_SRC + ${BZIP2_SOURCE_DIR}/blocksort.c + ${BZIP2_SOURCE_DIR}/bzlib.c + ${BZIP2_SOURCE_DIR}/compress.c + ${BZIP2_SOURCE_DIR}/crctable.c + ${BZIP2_SOURCE_DIR}/decompress.c + ${BZIP2_SOURCE_DIR}/huffman.c + ${BZIP2_SOURCE_DIR}/randtable.c) + + set(BZIP2_HDR + ${BZIP2_SOURCE_DIR}/bzlib.h + ${BZIP2_SOURCE_DIR}/bzlib_private.h) + + add_library(bzip2 STATIC ${BZIP2_SRC} ${BZIP2_HDR}) + + if(NOT QUAZIP_BZIP2_STDIO) + target_compile_definitions(bzip2 PRIVATE -DBZ_NO_STDIO) + endif() + + list(APPEND QUAZIP_DEP bzip2) + list(APPEND QUAZIP_LIB bzip2) + list(APPEND QUAZIP_INC ${BZIP2_SOURCE_DIR}) + else() + message(STATUS "BZip2 library not found") + + set(QUAZIP_BZIP2 OFF) + endif() + + if(QUAZIP_BZIP2) + find_package(BZip2) + add_compile_definitions(HAVE_BZIP2) + endif() +endif() + +add_subdirectory(quazip) + +if(QUAZIP_ENABLE_TESTS) + message(STATUS "Building QuaZip tests") + enable_testing() + add_subdirectory(qztest) +endif() diff --git a/deps/quazip-1.5/CMakePresets.json b/deps/quazip-1.5/CMakePresets.json new file mode 100644 index 000000000000..08ad6005f73f --- /dev/null +++ b/deps/quazip-1.5/CMakePresets.json @@ -0,0 +1,44 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "vcpkg", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_TARGET_TRIPLET": "x64-windows", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "vcpkg_x86", + "binaryDir": "${sourceDir}/build", + "architecture": "WIN32", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET ": "x86-windows", + "VCPKG_HOST_TRIPLET": "x86-windows", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "conan", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build/conan_toolchain.cmake", + "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "conan_x86", + "binaryDir": "${sourceDir}/build", + "architecture": "WIN32", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build/conan_toolchain.cmake", + "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} \ No newline at end of file diff --git a/deps/quazip-1.3/CONTRIBUTING.md b/deps/quazip-1.5/CONTRIBUTING.md similarity index 100% rename from deps/quazip-1.3/CONTRIBUTING.md rename to deps/quazip-1.5/CONTRIBUTING.md diff --git a/deps/quazip-1.3/COPYING b/deps/quazip-1.5/COPYING similarity index 100% rename from deps/quazip-1.3/COPYING rename to deps/quazip-1.5/COPYING diff --git a/deps/quazip-1.3/NEWS.txt b/deps/quazip-1.5/NEWS.txt similarity index 99% rename from deps/quazip-1.3/NEWS.txt rename to deps/quazip-1.5/NEWS.txt index 882c4d249d6f..0a9c0176e16d 100644 --- a/deps/quazip-1.3/NEWS.txt +++ b/deps/quazip-1.5/NEWS.txt @@ -1,3 +1,7 @@ +* 2023-01-22 1.4 + * Bzip2 compression support + * Minor fixes + * 2022-04-16 1.3 * All JlCompress methods are now public * Default Qt major version is now detected automatically diff --git a/deps/quazip-1.3/QuaZip-1.x-migration.md b/deps/quazip-1.5/QuaZip-1.x-migration.md similarity index 100% rename from deps/quazip-1.3/QuaZip-1.x-migration.md rename to deps/quazip-1.5/QuaZip-1.x-migration.md diff --git a/deps/quazip-1.5/README.md b/deps/quazip-1.5/README.md new file mode 100644 index 000000000000..c28eb3c965d8 --- /dev/null +++ b/deps/quazip-1.5/README.md @@ -0,0 +1,114 @@ +# Quazip + +[![CI](https://github.com/stachenov/quazip/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stachenov/quazip/actions/workflows/ci.yml) +[![Conan Center](https://shields.io/conan/v/quazip)](https://conan.io/center/recipes/quazip) + +QuaZip is the C++ wrapper for Gilles Vollant's ZIP/UNZIP package +(AKA Minizip) using Qt library. + +If you need to write files to a ZIP archive or read files from one +using QIODevice API, QuaZip is exactly the kind of tool you need. + +See [the documentation](https://stachenov.github.io/quazip/) for details. + +Want to report a bug or ask for a feature? Open an [issue](https://github.com/stachenov/quazip/issues). + +Want to fix a bug or implement a new feature? See [CONTRIBUTING.md](CONTRIBUTING.md). + +You're a package maintainer and want to update to QuaZip 1.0? Read [the migration guide](https://github.com/stachenov/quazip/blob/master/QuaZip-1.x-migration.md). + +Copyright notice: + +Copyright (C) 2005-2020 Sergey A. Tachenov and contributors + +Distributed under LGPL, full details in the COPYING file. + +Original ZIP package is copyrighted by Gilles Vollant, see +quazip/(un)zip.h files for details, but basically it's the zlib license. + +> [!IMPORTANT] +> This project is looking for additional maintainers and code reviewers. While the library is mostly feature complete, there are a couple of big ticket issues that need work. +> Code review is welcome for all pull requests. If you are well versed in Qt and C/C++ please start helping around and check [#185](https://github.com/stachenov/quazip/issues/185). + +# Build + +## Dependencies +You need at least the following dependencies: +- zlib +- Qt6, Qt5 or Qt4 (searched in that order) + +## Linux +``` +sudo apt-get install zlib1g-dev libbz2-dev +cmake -B build +cmake --build build +``` + +## Windows + +When using Qt online installer on Windows with MSVC, make sure to select the box for `MSVC 20XY 64-bit` and under additional libraries, select `Qt 5 Compatibility Module`. +Finally, add `C:\Qt\6.8.2\msvc20XY_64` to your PATH. + +If you don't use a package manager you will have to add library and include directories to your PATH or specify them with `CMAKE_PREFIX_PATH`. +Qt is not installed as a dependency of either vcpkg or conan. + +### x64 +Using vcpkg +``` +cmake --preset vcpkg +cmake --build build --config Release +``` + +Using conan v2 +``` +conan install . -of build -s build_type=Release -o *:shared=False --build=missing +cmake --preset conan +cmake --build build --config Release +``` + +### x86 +Only Qt5 is tested on x86. + +Using vcpkg +``` +cmake --preset vcpkg_x86 +cmake --build build --config Release +``` + +Using conan v2 +``` +conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing +cmake --preset conan_x86 +cmake --build build --config Release +``` + +## Additional build options +If you built Qt from source and installed it, you might need to tell CMake where to find it, for example: `-DCMAKE_PREFIX_PATH="/usr/local/Qt-6.8.2"`. +Alternatively, if you did not install the source build it might look something like: `-DCMAKE_PREFIX_PATH="/home/you/qt-everywhere-src-6.8.2/qtbase/lib/cmake"`. +Replace `qtbase` if you used a custom prefix at `configure` step. + +Qt installed through Linux distribution packages or official Qt online installer should be detected automatically. + +CMake is used to configure and build the project. A typical configure, build, install and clean is shown below. + +``` +cmake -B build -DQUAZIP_QT_MAJOR_VERSION=6 -DBUILD_SHARED_LIBS=ON -DQUAZIP_ENABLE_TESTS=ON +cmake --build build --config Release +sudo cmake --install build +cd build +ctest --verbose -C Release +cmake --build . --target clean +``` + +CMake options + +| Option | Description | Default | +|--------------------------|---------------------------------------------------------------------------------------------------------------------|---------| +| `QUAZIP_QT_MAJOR_VERSION`| Specifies which major Qt version should be searched for (6, 5 or 4). By default it tries to find the most recent. | | +| `BUILD_SHARED_LIBS` | Build QuaZip as a shared library | `ON` | +| `QUAZIP_INSTALL` | Enable installation | `ON` | +| `QUAZIP_USE_QT_ZLIB` | Use Qt's bundled zlib instead of system zlib (**not recommended**). Qt must be built with `-qt-zlib` and `-static`. Incompatible with `BUILD_SHARED_LIBS=ON`. | `OFF` | +| `QUAZIP_ENABLE_TESTS` | Build QuaZip tests | `OFF` | +| `QUAZIP_BZIP2` | Enable BZIP2 compression | `ON` | +| `QUAZIP_BZIP2_STDIO` | Output BZIP2 errors to stdio when BZIP2 compression is enabled | `ON` | + diff --git a/deps/quazip-1.5/SECURITY.md b/deps/quazip-1.5/SECURITY.md new file mode 100644 index 000000000000..7f2c6f58604d --- /dev/null +++ b/deps/quazip-1.5/SECURITY.md @@ -0,0 +1,14 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| master | :white_check_mark: | +| v1.4+ | :white_check_mark: | + +## Reporting a Vulnerability + +Report a vulnerability to cen.is.imba (AT) gmail dot com. +Please follow coordinated vulnerability disclosure process and allow up to 90 days for a fix. +Even better if you also provide a patch. diff --git a/deps/quazip-1.5/cmake/clone-repo.cmake b/deps/quazip-1.5/cmake/clone-repo.cmake new file mode 100644 index 000000000000..2ffb4b2bbb90 --- /dev/null +++ b/deps/quazip-1.5/cmake/clone-repo.cmake @@ -0,0 +1,35 @@ +# Checkout remote repository +macro(clone_repo name url) + string(TOLOWER ${name} name_lower) + string(TOUPPER ${name} name_upper) + + if(NOT ${name_upper}_REPOSITORY) + set(${name_upper}_REPOSITORY ${url}) + endif() + if(NOT ${name_upper}_TAG) + set(${name_upper}_TAG master) + endif() + + message(STATUS "Fetching ${name} ${${name_upper}_REPOSITORY} ${${name_upper}_TAG}") + + # Check for FetchContent cmake support + if(${CMAKE_VERSION} VERSION_LESS "3.11") + message(FATAL_ERROR "CMake 3.11 required to fetch ${name}") + else() + include(FetchContent) + + FetchContent_Declare(${name} + GIT_REPOSITORY ${${name_upper}_REPOSITORY} + GIT_TAG ${${name_upper}_TAG} + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/${name_lower}) + + FetchContent_GetProperties(${name} POPULATED ${name_lower}_POPULATED) + + if(NOT ${name_lower}_POPULATED) + FetchContent_Populate(${name}) + endif() + + set(${name_upper}_SOURCE_DIR ${${name_lower}_SOURCE_DIR}) + set(${name_upper}_BINARY_DIR ${${name_lower}_BINARY_DIR}) + endif() +endmacro() diff --git a/deps/quazip-1.5/cmake/windeployqt.cmake b/deps/quazip-1.5/cmake/windeployqt.cmake new file mode 100644 index 000000000000..67d219cde2a2 --- /dev/null +++ b/deps/quazip-1.5/cmake/windeployqt.cmake @@ -0,0 +1,22 @@ +get_target_property(_qmake_executable Qt${QUAZIP_QT_MAJOR_VERSION}::qmake IMPORTED_LOCATION) +get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + +function(windeployqt target) + + # --verbose 1 + + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${_qt_bin_dir}/windeployqt.exe" + --verbose 1 + $<$:--debug> + $<$:--release> + --no-plugins + --no-translations + --no-system-d3d-compiler + --no-opengl-sw + --no-compiler-runtime + \"$\" + COMMENT "Deploying Qt libraries using windeployqt for compilation target '${target}' ..." + ) + +endfunction() \ No newline at end of file diff --git a/deps/quazip-1.5/conanfile.py b/deps/quazip-1.5/conanfile.py new file mode 100644 index 000000000000..260ee3f67504 --- /dev/null +++ b/deps/quazip-1.5/conanfile.py @@ -0,0 +1,16 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain + +class Quazip(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + + requires = ( + "zlib/1.3.1", + "bzip2/1.0.8" + ) + + def generate(self): + tc = CMakeToolchain(self) + tc.user_presets_path = False + tc.generate() \ No newline at end of file diff --git a/deps/quazip-1.3/quazip/CMakeLists.txt b/deps/quazip-1.5/quazip/CMakeLists.txt similarity index 89% rename from deps/quazip-1.3/quazip/CMakeLists.txt rename to deps/quazip-1.5/quazip/CMakeLists.txt index 030f7dd3466d..6cfdf4e1fecf 100644 --- a/deps/quazip-1.3/quazip/CMakeLists.txt +++ b/deps/quazip-1.5/quazip/CMakeLists.txt @@ -2,6 +2,8 @@ project(QuaZip_Library VERSION ${QUAZIP_LIB_VERSION}) include(GNUInstallDirs) # configurable CMAKE_INSTALL_*DIR +cmake_minimum_required(VERSION 3.13) + set(QUAZIP_HEADERS JlCompress.h ioapi.h @@ -44,6 +46,10 @@ set(QUAZIP_INCLUDE_PATH ${QUAZIP_DIR_NAME}/quazip) set(QUAZIP_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake) set(QUAZIP_PKGCONFIG_NAME quazip${QuaZip_VERSION_MAJOR}-qt${QUAZIP_QT_MAJOR_VERSION}) +if(EMSCRIPTEN) + set(BUILD_SHARED_LIBS OFF) +endif() + add_library(${QUAZIP_LIB_TARGET_NAME} ${QUAZIP_SOURCES}) add_library(QuaZip::QuaZip ALIAS ${QUAZIP_LIB_TARGET_NAME}) @@ -53,18 +59,20 @@ set_target_properties(${QUAZIP_LIB_TARGET_NAME} PROPERTIES OUTPUT_NAME ${QUAZIP_LIB_FILE_NAME} PUBLIC_HEADER "${QUAZIP_HEADERS}" ) -target_include_directories(${QUAZIP_LIB_TARGET_NAME} PUBLIC +target_include_directories(${QUAZIP_LIB_TARGET_NAME} PRIVATE ${QUAZIP_INC}) +target_include_directories(${QUAZIP_LIB_TARGET_NAME} PUBLIC $ $ $ $ ) -target_link_libraries(${QUAZIP_LIB_TARGET_NAME} ${QUAZIP_LIB_LIBRARIES}) +target_link_libraries(${QUAZIP_LIB_TARGET_NAME} ${QUAZIP_LIB_LIBRARIES} ${QUAZIP_LIB}) if(BUILD_SHARED_LIBS) target_compile_definitions(${QUAZIP_LIB_TARGET_NAME} PRIVATE QUAZIP_BUILD) # dllexport else() target_compile_definitions(${QUAZIP_LIB_TARGET_NAME} PUBLIC QUAZIP_STATIC) # suppress dllimport endif() +target_link_directories(${QUAZIP_LIB_TARGET_NAME} PUBLIC ${QUAZIP_LBD}) include(CMakePackageConfigHelpers) @@ -81,7 +89,7 @@ if(QUAZIP_INSTALL) configure_package_config_file(QuaZipConfig.cmake.in ${QUAZIP_PACKAGE_NAME}Config.cmake INSTALL_DESTINATION ${QUAZIP_INSTALL_CONFIGDIR}/${QUAZIP_DIR_NAME} ) - install(TARGETS ${QUAZIP_LIB_TARGET_NAME} + install(TARGETS ${QUAZIP_LIB_TARGET_NAME} ${QUAZIP_DEP} EXPORT ${QUAZIP_EXPORT_SET} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${QUAZIP_INCLUDE_PATH} ) diff --git a/deps/quazip-1.3/quazip/JlCompress.cpp b/deps/quazip-1.5/quazip/JlCompress.cpp similarity index 68% rename from deps/quazip-1.3/quazip/JlCompress.cpp rename to deps/quazip-1.5/quazip/JlCompress.cpp index 9a44612c653e..d5ba418b1933 100644 --- a/deps/quazip-1.3/quazip/JlCompress.cpp +++ b/deps/quazip-1.5/quazip/JlCompress.cpp @@ -24,6 +24,7 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. */ #include "JlCompress.h" +#include bool JlCompress::copyData(QIODevice &inFile, QIODevice &outFile) { @@ -39,19 +40,26 @@ bool JlCompress::copyData(QIODevice &inFile, QIODevice &outFile) } bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest) { - // zip: oggetto dove aggiungere il file - // fileName: nome del file reale - // fileDest: nome del file all'interno del file compresso + return compressFile(zip, fileName, fileDest, Options()); +} + +bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest, const Options& options) { + // zip: object where to add the file + // fileName: real file name + // fileDest: file name inside the zip object - // Controllo l'apertura dello zip if (!zip) return false; if (zip->getMode()!=QuaZip::mdCreate && zip->getMode()!=QuaZip::mdAppend && zip->getMode()!=QuaZip::mdAdd) return false; - // Apro il file risulato QuaZipFile outFile(zip); - if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName))) return false; + if (options.getDateTime().isNull()) { + if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName), nullptr, 0, options.getCompressionMethod(), options.getCompressionLevel())) return false; + } + else { + if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName, options.getDateTime()), nullptr, 0, options.getCompressionMethod(), options.getCompressionLevel())) return false; + } QFileInfo input(fileName); if (quazip_is_symlink(input)) { @@ -71,86 +79,86 @@ bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest) { inFile.close(); } - // Chiudo i file outFile.close(); - if (outFile.getZipError()!=UNZ_OK) return false; - - return true; + return outFile.getZipError() == UNZ_OK; } bool JlCompress::compressSubDir(QuaZip* zip, QString dir, QString origDir, bool recursive, QDir::Filters filters) { - // zip: oggetto dove aggiungere il file - // dir: cartella reale corrente - // origDir: cartella reale originale - // (path(dir)-path(origDir)) = path interno all'oggetto zip + return compressSubDir(zip, dir, origDir, recursive, filters, Options()); +} + +bool JlCompress::compressSubDir(QuaZip* zip, QString dir, QString origDir, bool recursive, QDir::Filters filters, const Options& options) { + // zip: object where to add the file + // dir: current real directory + // origDir: original real directory + // (path(dir)-path(origDir)) = path inside the zip object - // Controllo l'apertura dello zip if (!zip) return false; if (zip->getMode()!=QuaZip::mdCreate && zip->getMode()!=QuaZip::mdAppend && zip->getMode()!=QuaZip::mdAdd) return false; - // Controllo la cartella QDir directory(dir); if (!directory.exists()) return false; QDir origDirectory(origDir); - if (dir != origDir) { - QuaZipFile dirZipFile(zip); - if (!dirZipFile.open(QIODevice::WriteOnly, - QuaZipNewInfo(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir), nullptr, 0, 0)) { - return false; - } - dirZipFile.close(); - } - + if (dir != origDir) { + QuaZipFile dirZipFile(zip); + std::unique_ptr qzni; + if (options.getDateTime().isNull()) { + qzni = std::make_unique(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir); + } + else { + qzni = std::make_unique(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir, options.getDateTime()); + } + if (!dirZipFile.open(QIODevice::WriteOnly, *qzni, nullptr, 0, 0)) { + return false; + } + dirZipFile.close(); + } - // Se comprimo anche le sotto cartelle + // Whether to compress the subfolders, recursion if (recursive) { - // Per ogni sotto cartella + // For each subfolder QFileInfoList files = directory.entryInfoList(QDir::AllDirs|QDir::NoDotAndDotDot|filters); - for (int index = 0; index < files.size(); ++index ) { - const QFileInfo & file( files.at( index ) ); + for (const auto& file : files) { if (!file.isDir()) // needed for Qt < 4.7 because it doesn't understand AllDirs continue; - // Comprimo la sotto cartella - if(!compressSubDir(zip,file.absoluteFilePath(),origDir,recursive,filters)) return false; + // Compress subdirectory + if(!compressSubDir(zip,file.absoluteFilePath(),origDir,recursive,filters, options)) return false; } } - // Per ogni file nella cartella + // For each file in directory QFileInfoList files = directory.entryInfoList(QDir::Files|filters); - for (int index = 0; index < files.size(); ++index ) { - const QFileInfo & file( files.at( index ) ); - // Se non e un file o e il file compresso che sto creando + for (const auto& file : files) { + // If it's not a file or it's the compressed file being created if(!file.isFile()||file.absoluteFilePath()==zip->getZipName()) continue; - // Creo il nome relativo da usare all'interno del file compresso + // Create relative name for the compressed file QString filename = origDirectory.relativeFilePath(file.absoluteFilePath()); - // Comprimo il file - if (!compressFile(zip,file.absoluteFilePath(),filename)) return false; + // Compress the file + if (!compressFile(zip,file.absoluteFilePath(),filename, options)) return false; } return true; } bool JlCompress::extractFile(QuaZip* zip, QString fileName, QString fileDest) { - // zip: oggetto dove aggiungere il file - // filename: nome del file reale - // fileincompress: nome del file all'interno del file compresso + // zip: object where to add the file + // filename: real file name + // fileincompress: file name of the compressed file - // Controllo l'apertura dello zip if (!zip) return false; if (zip->getMode()!=QuaZip::mdUnzip) return false; - // Apro il file compresso if (!fileName.isEmpty()) zip->setCurrentFile(fileName); QuaZipFile inFile(zip); if(!inFile.open(QIODevice::ReadOnly) || inFile.getZipError()!=UNZ_OK) return false; - // Controllo esistenza cartella file risultato + // Check existence of resulting file QDir curDir; if (fileDest.endsWith(QLatin1String("/"))) { if (!curDir.mkpath(fileDest)) { @@ -176,17 +184,15 @@ bool JlCompress::extractFile(QuaZip* zip, QString fileName, QString fileDest) { if (info.isSymbolicLink()) { QString target = QFile::decodeName(inFile.readAll()); - if (!QFile::link(target, fileDest)) - return false; - return true; + return QFile::link(target, fileDest); } - // Apro il file risultato + // Open resulting file QFile outFile; outFile.setFileName(fileDest); if(!outFile.open(QIODevice::WriteOnly)) return false; - // Copio i dati + // Copy data if (!copyData(inFile, outFile) || inFile.getZipError()!=UNZ_OK) { outFile.close(); removeFile(QStringList(fileDest)); @@ -194,7 +200,7 @@ bool JlCompress::extractFile(QuaZip* zip, QString fileName, QString fileDest) { } outFile.close(); - // Chiudo i file + // Close file inFile.close(); if (inFile.getZipError()!=UNZ_OK) { removeFile(QStringList(fileDest)); @@ -209,16 +215,20 @@ bool JlCompress::extractFile(QuaZip* zip, QString fileName, QString fileDest) { bool JlCompress::removeFile(QStringList listFile) { bool ret = true; - // Per ogni file + // For each file for (int i=0; igoToFirstFile(); more; more=zip->goToNextFile()) { @@ -438,7 +458,7 @@ QStringList JlCompress::getFileList(QuaZip *zip) //info.name.toLocal8Bit().constData() } - // Chiudo il file zip + // Close zip zip->close(); if(zip->getZipError()!=0) { delete zip; diff --git a/deps/quazip-1.3/quazip/JlCompress.h b/deps/quazip-1.5/quazip/JlCompress.h similarity index 60% rename from deps/quazip-1.3/quazip/JlCompress.h rename to deps/quazip-1.5/quazip/JlCompress.h index fcb767b85564..8e0126fb449f 100644 --- a/deps/quazip-1.3/quazip/JlCompress.h +++ b/deps/quazip-1.5/quazip/JlCompress.h @@ -42,6 +42,78 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. */ class QUAZIP_EXPORT JlCompress { public: + class Options { + public: + /** + * The enum values refer to the comments in the open function of the quazipfile.h file. + * + * The value is represented by two hexadecimal characters, + * the left character indicating the compression method, + * and the right character indicating the compression level. + * + * method == 0 indicates that the file is not compressed but rather stored as is. + * method == 8(Z_DEFLATED) indicates that zlib compression is used. + * + * A higher value of level indicates a smaller size of the compressed file, + * although it also implies more time consumed during the compression process. + */ + enum CompressionStrategy + { + /// Storage without compression + Storage = 0x00, // Z_NO_COMPRESSION 0 + /// The fastest compression speed + Fastest = 0x81, // Z_BEST_SPEED 1 + /// Relatively fast compression speed + Faster = 0x83, + /// Standard compression speed and ratio + Standard = 0x86, + /// Better compression ratio + Better = 0x87, + /// The best compression ratio + Best = 0x89, // Z_BEST_COMPRESSION 9 + /// The default compression strategy, according to the open function of quazipfile.h, + /// the value of method is Z_DEFLATED, and the value of level is Z_DEFAULT_COMPRESSION -1 (equals lvl 6) + Default = 0xff + }; + + public: + explicit Options(const CompressionStrategy& strategy) + : m_compressionStrategy(strategy) {} + + explicit Options(const QDateTime& dateTime = QDateTime(), const CompressionStrategy& strategy = Default) + : m_dateTime(dateTime), m_compressionStrategy(strategy) {} + + QDateTime getDateTime() const { + return m_dateTime; + } + + void setDateTime(const QDateTime &dateTime) { + m_dateTime = dateTime; + } + + CompressionStrategy getCompressionStrategy() const { + return m_compressionStrategy; + } + + int getCompressionMethod() const { + return m_compressionStrategy != Default ? m_compressionStrategy >> 4 : Z_DEFLATED; + } + + int getCompressionLevel() const { + return m_compressionStrategy != Default ? m_compressionStrategy & 0x0f : Z_DEFAULT_COMPRESSION; + } + + void setCompressionStrategy(const CompressionStrategy &strategy) { + m_compressionStrategy = strategy; + } + + private: + // If set, used as last modified on file inside the archive. + // If compressing a directory, used for all files. + QDateTime m_dateTime; + CompressionStrategy m_compressionStrategy; + }; + static bool copyData(QIODevice &inFile, QIODevice &outFile); static QStringList extractDir(QuaZip &zip, const QString &dir); static QStringList getFileList(QuaZip *zip); @@ -55,6 +127,15 @@ class QUAZIP_EXPORT JlCompress { \return true if success, false otherwise. */ static bool compressFile(QuaZip* zip, QString fileName, QString fileDest); + /// Compress a single file. + /** + \param zip Opened zip to compress the file to. + \param fileName The full path to the source file. + \param fileDest The full name of the file inside the archive. + \param options Options for fixed file timestamp, compression level, encryption.. + \return true if success, false otherwise. + */ + static bool compressFile(QuaZip* zip, QString fileName, QString fileDest, const Options& options); /// Compress a subdirectory. /** \param parentZip Opened zip containing the parent directory. @@ -67,6 +148,21 @@ class QUAZIP_EXPORT JlCompress { */ static bool compressSubDir(QuaZip* parentZip, QString dir, QString parentDir, bool recursive, QDir::Filters filters); + /// Compress a subdirectory. + /** + \param parentZip Opened zip containing the parent directory. + \param dir The full path to the directory to pack. + \param parentDir The full path to the directory corresponding to + the root of the ZIP. + \param recursive Whether to pack sub-directories as well or only + \param filters what to pack, filters are applied both when searching +* for subdirs (if packing recursively) and when looking for files to pack + \param options Options for fixed file timestamp, compression level, encryption.. + files. + \return true if success, false otherwise. + */ + static bool compressSubDir(QuaZip* parentZip, QString dir, QString parentDir, bool recursive, + QDir::Filters filters, const Options& options); /// Extract a single file. /** \param zip The opened zip archive to extract from. @@ -89,6 +185,14 @@ class QUAZIP_EXPORT JlCompress { \return true if success, false otherwise. */ static bool compressFile(QString fileCompressed, QString file); + /// Compress a single file with advanced options. + /** + \param fileCompressed The name of the archive. + \param file The file to compress. + \param options Options for fixed file timestamp, compression level, encryption.. + \return true if success, false otherwise. + */ + static bool compressFile(QString fileCompressed, QString file, const Options& options); /// Compress a list of files. /** \param fileCompressed The name of the archive. @@ -96,6 +200,14 @@ class QUAZIP_EXPORT JlCompress { \return true if success, false otherwise. */ static bool compressFiles(QString fileCompressed, QStringList files); + /// Compress a list of files. + /** + \param fileCompressed The name of the archive. + \param files The file list to compress. + \param options Options for fixed file timestamp, compression level, encryption.. + \return true if success, false otherwise. + */ + static bool compressFiles(QString fileCompressed, QStringList files, const Options& options); /// Compress a whole directory. /** Does not compress hidden files. See compressDir(QString, QString, bool, QDir::Filters). @@ -125,6 +237,25 @@ class QUAZIP_EXPORT JlCompress { */ static bool compressDir(QString fileCompressed, QString dir, bool recursive, QDir::Filters filters); + /** + * @brief Compress a whole directory. + * + * Unless filters are specified explicitly, packs + * only regular non-hidden files (and subdirs, if @c recursive is true). + * If filters are specified, they are OR-combined with + * %QDir::AllDirs|%QDir::NoDotAndDotDot when searching for dirs + * and with QDir::Files when searching for files. + * + * @param fileCompressed path to the resulting archive + * @param dir path to the directory being compressed + * @param recursive if true, then the subdirectories are packed as well + * @param filters what to pack, filters are applied both when searching + * for subdirs (if packing recursively) and when looking for files to pack + * @param options Options for fixed file timestamp, compression level, encryption.. + * @return true on success, false otherwise + */ + static bool compressDir(QString fileCompressed, QString dir, + bool recursive, QDir::Filters filters, const Options& options); /// Extract a single file. /** @@ -209,7 +340,7 @@ class QUAZIP_EXPORT JlCompress { list of the entries, including both files and directories if they are present separately. */ - static QStringList getFileList(QIODevice *ioDevice); + static QStringList getFileList(QIODevice *ioDevice); }; #endif /* JLCOMPRESSFOLDER_H_ */ diff --git a/deps/quazip-1.3/quazip/QuaZipConfig.cmake.in b/deps/quazip-1.5/quazip/QuaZipConfig.cmake.in similarity index 72% rename from deps/quazip-1.3/quazip/QuaZipConfig.cmake.in rename to deps/quazip-1.5/quazip/QuaZipConfig.cmake.in index 1988b4d9e70e..4179c76a2988 100644 --- a/deps/quazip-1.3/quazip/QuaZipConfig.cmake.in +++ b/deps/quazip-1.5/quazip/QuaZipConfig.cmake.in @@ -2,8 +2,6 @@ include(CMakeFindDependencyMacro) -find_dependency(ZLIB REQUIRED) - include("${CMAKE_CURRENT_LIST_DIR}/@QUAZIP_EXPORT_SET@.cmake") if(@QUAZIP_QT_MAJOR_VERSION@ EQUAL 6) @@ -15,6 +13,17 @@ elseif(@QUAZIP_QT_MAJOR_VERSION@ EQUAL 4) else() message(FATAL_ERROR "Qt version QUAZIP_QT_MAJOR_VERSION=@QUAZIP_QT_MAJOR_VERSION@ is unsupported") endif() + +if(@QUAZIP_BZIP2@) + find_dependency(BZip2 REQUIRED) +endif() + +if(@QUAZIP_USE_QT_ZLIB@) + find_dependency(Qt@QUAZIP_QT_MAJOR_VERSION@ REQUIRED COMPONENTS @QUAZIP_QT_ZLIB_COMPONENT@) +else() + find_dependency(ZLIB REQUIRED) +endif() + set_target_properties(QuaZip::QuaZip PROPERTIES IMPORTED_GLOBAL TRUE) check_required_components(@QUAZIP_PACKAGE_NAME@) diff --git a/deps/quazip-1.3/quazip/doc/faq.dox b/deps/quazip-1.5/quazip/doc/faq.dox similarity index 100% rename from deps/quazip-1.3/quazip/doc/faq.dox rename to deps/quazip-1.5/quazip/doc/faq.dox diff --git a/deps/quazip-1.3/quazip/doc/index.dox b/deps/quazip-1.5/quazip/doc/index.dox similarity index 99% rename from deps/quazip-1.3/quazip/doc/index.dox rename to deps/quazip-1.5/quazip/doc/index.dox index 621b84f9e800..0cba1cc759cd 100644 --- a/deps/quazip-1.3/quazip/doc/index.dox +++ b/deps/quazip-1.5/quazip/doc/index.dox @@ -123,7 +123,7 @@ This option defaults to OFF, and even when enabled, if it fails to find zlib tha To install, run \verbatim -$ cmake --build wherever/you/want/your/build/to/be --target install -D CMAKE_INSTALL_PREFIX=/wherever/you/want/to/install +$ cmake --build wherever/you/want/your/build/to/be --target install \endverbatim %QuaZip installs as CMake package QuaZip-QtX, where X is the major diff --git a/deps/quazip-1.3/quazip/doc/usage.dox b/deps/quazip-1.5/quazip/doc/usage.dox similarity index 100% rename from deps/quazip-1.3/quazip/doc/usage.dox rename to deps/quazip-1.5/quazip/doc/usage.dox diff --git a/deps/quazip-1.3/quazip/ioapi.h b/deps/quazip-1.5/quazip/ioapi.h similarity index 100% rename from deps/quazip-1.3/quazip/ioapi.h rename to deps/quazip-1.5/quazip/ioapi.h diff --git a/deps/quazip-1.3/quazip/minizip_crypt.h b/deps/quazip-1.5/quazip/minizip_crypt.h similarity index 100% rename from deps/quazip-1.3/quazip/minizip_crypt.h rename to deps/quazip-1.5/quazip/minizip_crypt.h diff --git a/deps/quazip-1.3/quazip/qioapi.cpp b/deps/quazip-1.5/quazip/qioapi.cpp similarity index 71% rename from deps/quazip-1.3/quazip/qioapi.cpp rename to deps/quazip-1.5/quazip/qioapi.cpp index 60f101d7e96e..85aebbedc97c 100644 --- a/deps/quazip-1.3/quazip/qioapi.cpp +++ b/deps/quazip-1.5/quazip/qioapi.cpp @@ -32,51 +32,67 @@ #define SEEK_SET 0 #endif -voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,voidpf file,int mode) +voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc, voidpf file, int mode) { - if (pfilefunc->zfile_func64.zopen64_file != nullptr) - return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,file,mode); - else - { - return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,file,mode); - } + auto func = pfilefunc->zfile_func64.zopen64_file != nullptr + ? pfilefunc->zfile_func64.zopen64_file + : pfilefunc->zopen32_file; + return (*func)(pfilefunc->zfile_func64.opaque, file, mode); } -int call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) +namespace { + +int zseek64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream, ZPOS64_T offset, int origin) { - if (pfilefunc->zfile_func64.zseek64_file != nullptr) - return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); - else - { - uLong offsetTruncated = (uLong)offset; - if (offsetTruncated != offset) - return -1; - else - return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); - } + return (*pfilefunc->zfile_func64.zseek64_file)(pfilefunc->zfile_func64.opaque, filestream, offset, origin); } -ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) + +int zseek32(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream, ZPOS64_T offset, int origin) { - if (pfilefunc->zfile_func64.zseek64_file != nullptr) - return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); - else - { - uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); - if ((tell_uLong) == ((uLong)-1)) - return (ZPOS64_T)-1; - else - return tell_uLong; - } + uLong offsetTruncated = static_cast(offset); + if (offsetTruncated != offset) + return -1; + return (*pfilefunc->zseek32_file)(pfilefunc->zfile_func64.opaque, filestream, offsetTruncated, origin); +} + +} + +int call_zseek64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream, ZPOS64_T offset, int origin) +{ + auto func = pfilefunc->zfile_func64.zseek64_file != nullptr ? zseek64 : zseek32; + return (*func)(pfilefunc, filestream, offset, origin); + +} + +namespace { + +ZPOS64_T ztell64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) +{ + return (*pfilefunc->zfile_func64.ztell64_file) (pfilefunc->zfile_func64.opaque, filestream); +} + +ZPOS64_T ztell32(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) +{ + uLong tell_uLong = (*pfilefunc->ztell32_file)(pfilefunc->zfile_func64.opaque, filestream); + if (tell_uLong == static_cast(-1)) + return static_cast(-1); + return tell_uLong; +} + +} + +ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) +{ + auto *func = pfilefunc->zfile_func64.zseek64_file != nullptr ? ztell64 : ztell32; + return (*func)(pfilefunc, filestream); + } /// @cond internal struct QIODevice_descriptor { // Position only used for writing to sequential devices. - qint64 pos; - inline QIODevice_descriptor(): - pos(0) - {} + qint64 pos{0}; }; /// @endcond @@ -94,28 +110,27 @@ voidpf ZCALLBACK qiodevice_open_file_func ( desiredMode = QIODevice::ReadWrite; else if (mode & ZLIB_FILEFUNC_MODE_CREATE) desiredMode = QIODevice::WriteOnly; + else + return nullptr; if (iodevice->isOpen()) { - if ((iodevice->openMode() & desiredMode) == desiredMode) { - if (desiredMode != QIODevice::WriteOnly - && iodevice->isSequential()) { - // We can use sequential devices only for writing. - delete d; - return nullptr; - } else { - if ((desiredMode & QIODevice::WriteOnly) != 0) { - // open for writing, need to seek existing device - if (!iodevice->isSequential()) { - iodevice->seek(0); - } else { - d->pos = iodevice->pos(); - } - } - } - return iodevice; - } else { + if ((iodevice->openMode() & desiredMode) != desiredMode) { delete d; return nullptr; } + if (desiredMode != QIODevice::WriteOnly && iodevice->isSequential()) { + // We can use sequential devices only for writing. + delete d; + return nullptr; + } + if ((desiredMode & QIODevice::WriteOnly) != 0) { + // open for writing, need to seek existing device + if (!iodevice->isSequential()) { + iodevice->seek(0); + } else { + d->pos = iodevice->pos(); + } + } + return iodevice; } iodevice->open(desiredMode); if (iodevice->isOpen()) { @@ -124,13 +139,11 @@ voidpf ZCALLBACK qiodevice_open_file_func ( iodevice->close(); delete d; return nullptr; - } else { - return iodevice; } - } else { - delete d; - return nullptr; + return iodevice; } + delete d; + return nullptr; } @@ -142,9 +155,9 @@ uLong ZCALLBACK qiodevice_read_file_func ( { QIODevice_descriptor *d = reinterpret_cast(opaque); QIODevice *iodevice = reinterpret_cast(stream); - qint64 ret64 = iodevice->read((char*)buf,size); + qint64 ret64 = iodevice->read(static_cast(buf),size); uLong ret; - ret = (uLong) ret64; + ret = static_cast(ret64); if (ret64 != -1) { d->pos += ret64; } @@ -165,7 +178,7 @@ uLong ZCALLBACK qiodevice_write_file_func ( if (ret64 != -1) { d->pos += ret64; } - ret = (uLong) ret64; + ret = static_cast(ret64); return ret; } @@ -209,24 +222,22 @@ int ZCALLBACK qiodevice_seek_file_func ( { QIODevice *iodevice = reinterpret_cast(stream); if (iodevice->isSequential()) { - if (origin == ZLIB_FILEFUNC_SEEK_END - && offset == 0) { + if (origin == ZLIB_FILEFUNC_SEEK_END && offset == 0) { // sequential devices are always at end (needed in mdAppend) return 0; - } else { - qWarning("qiodevice_seek_file_func() called for sequential device"); - return -1; } + qWarning("qiodevice_seek_file_func() called for sequential device"); + return -1; } uLong qiodevice_seek_result=0; int ret; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR : - qiodevice_seek_result = ((QIODevice*)stream)->pos() + offset; + qiodevice_seek_result = (static_cast(stream))->pos() + offset; break; case ZLIB_FILEFUNC_SEEK_END : - qiodevice_seek_result = ((QIODevice*)stream)->size() - offset; + qiodevice_seek_result = (static_cast(stream))->size() - offset; break; case ZLIB_FILEFUNC_SEEK_SET : qiodevice_seek_result = offset; @@ -246,24 +257,22 @@ int ZCALLBACK qiodevice64_seek_file_func ( { QIODevice *iodevice = reinterpret_cast(stream); if (iodevice->isSequential()) { - if (origin == ZLIB_FILEFUNC_SEEK_END - && offset == 0) { + if (origin == ZLIB_FILEFUNC_SEEK_END && offset == 0) { // sequential devices are always at end (needed in mdAppend) return 0; - } else { - qWarning("qiodevice_seek_file_func() called for sequential device"); - return -1; } + qWarning("qiodevice_seek_file_func() called for sequential device"); + return -1; } qint64 qiodevice_seek_result=0; int ret; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR : - qiodevice_seek_result = ((QIODevice*)stream)->pos() + offset; + qiodevice_seek_result = (static_cast(stream))->pos() + offset; break; case ZLIB_FILEFUNC_SEEK_END : - qiodevice_seek_result = ((QIODevice*)stream)->size() - offset; + qiodevice_seek_result = (static_cast(stream))->size() - offset; break; case ZLIB_FILEFUNC_SEEK_SET : qiodevice_seek_result = offset; diff --git a/deps/quazip-1.3/quazip/quaadler32.cpp b/deps/quazip-1.5/quazip/quaadler32.cpp similarity index 86% rename from deps/quazip-1.3/quazip/quaadler32.cpp rename to deps/quazip-1.5/quazip/quaadler32.cpp index 4e0118be6dd4..6ab86202a99b 100644 --- a/deps/quazip-1.3/quazip/quaadler32.cpp +++ b/deps/quazip-1.5/quazip/quaadler32.cpp @@ -34,7 +34,7 @@ QuaAdler32::QuaAdler32() quint32 QuaAdler32::calculate(const QByteArray &data) { - return adler32( adler32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() ); + return adler32( adler32(0L, Z_NULL, 0), reinterpret_cast(data.data()), data.size() ); } void QuaAdler32::reset() @@ -44,7 +44,7 @@ void QuaAdler32::reset() void QuaAdler32::update(const QByteArray &buf) { - checksum = adler32( checksum, (const Bytef*)buf.data(), buf.size() ); + checksum = adler32( checksum, reinterpret_cast(buf.data()), buf.size() ); } quint32 QuaAdler32::value() diff --git a/deps/quazip-1.3/quazip/quaadler32.h b/deps/quazip-1.5/quazip/quaadler32.h similarity index 90% rename from deps/quazip-1.3/quazip/quaadler32.h rename to deps/quazip-1.5/quazip/quaadler32.h index 633b175a2c10..00d8ae45f328 100644 --- a/deps/quazip-1.3/quazip/quaadler32.h +++ b/deps/quazip-1.5/quazip/quaadler32.h @@ -41,11 +41,11 @@ class QUAZIP_EXPORT QuaAdler32 : public QuaChecksum32 public: QuaAdler32(); - quint32 calculate(const QByteArray &data); + quint32 calculate(const QByteArray &data) override; - void reset(); - void update(const QByteArray &buf); - quint32 value(); + void reset() override; + void update(const QByteArray &buf) override; + quint32 value() override; private: quint32 checksum; diff --git a/deps/quazip-1.5/quazip/quachecksum32.cpp b/deps/quazip-1.5/quazip/quachecksum32.cpp new file mode 100644 index 000000000000..190b4371b05c --- /dev/null +++ b/deps/quazip-1.5/quazip/quachecksum32.cpp @@ -0,0 +1,3 @@ +#include "quachecksum32.h" + +QuaChecksum32::~QuaChecksum32() = default; diff --git a/deps/quazip-1.3/quazip/quachecksum32.h b/deps/quazip-1.5/quazip/quachecksum32.h similarity index 100% rename from deps/quazip-1.3/quazip/quachecksum32.h rename to deps/quazip-1.5/quazip/quachecksum32.h diff --git a/deps/quazip-1.3/quazip/quacrc32.cpp b/deps/quazip-1.5/quazip/quacrc32.cpp similarity index 86% rename from deps/quazip-1.3/quazip/quacrc32.cpp rename to deps/quazip-1.5/quazip/quacrc32.cpp index b491dc07c14c..3c9f2867588b 100644 --- a/deps/quazip-1.3/quazip/quacrc32.cpp +++ b/deps/quazip-1.5/quazip/quacrc32.cpp @@ -33,7 +33,7 @@ QuaCrc32::QuaCrc32() quint32 QuaCrc32::calculate(const QByteArray &data) { - return crc32( crc32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() ); + return crc32( crc32(0L, Z_NULL, 0), reinterpret_cast(data.data()), data.size() ); } void QuaCrc32::reset() @@ -43,7 +43,7 @@ void QuaCrc32::reset() void QuaCrc32::update(const QByteArray &buf) { - checksum = crc32( checksum, (const Bytef*)buf.data(), buf.size() ); + checksum = crc32( checksum, reinterpret_cast(buf.data()), buf.size() ); } quint32 QuaCrc32::value() diff --git a/deps/quazip-1.3/quazip/quacrc32.h b/deps/quazip-1.5/quazip/quacrc32.h similarity index 89% rename from deps/quazip-1.3/quazip/quacrc32.h rename to deps/quazip-1.5/quazip/quacrc32.h index 49808af1672a..ad04dbf16dc9 100644 --- a/deps/quazip-1.3/quazip/quacrc32.h +++ b/deps/quazip-1.5/quazip/quacrc32.h @@ -37,11 +37,11 @@ class QUAZIP_EXPORT QuaCrc32 : public QuaChecksum32 { public: QuaCrc32(); - quint32 calculate(const QByteArray &data); + quint32 calculate(const QByteArray &data) override; - void reset(); - void update(const QByteArray &buf); - quint32 value(); + void reset() override; + void update(const QByteArray &buf) override; + quint32 value() override; private: quint32 checksum; diff --git a/deps/quazip-1.3/quazip/quagzipfile.cpp b/deps/quazip-1.5/quazip/quagzipfile.cpp similarity index 94% rename from deps/quazip-1.3/quazip/quagzipfile.cpp rename to deps/quazip-1.5/quazip/quagzipfile.cpp index c637aaa5afe4..f9be0e788cfc 100644 --- a/deps/quazip-1.3/quazip/quagzipfile.cpp +++ b/deps/quazip-1.5/quazip/quagzipfile.cpp @@ -66,7 +66,8 @@ bool QuaGzipFilePrivate::open(FileId id, QIODevice::OpenMode mode, error = QuaGzipFile::tr("Opening gzip for both reading" " and writing is not supported"); return false; - } else if ((mode & QIODevice::ReadOnly) != 0) { + } + if ((mode & QIODevice::ReadOnly) != 0) { modeString[0] = 'r'; } else if ((mode & QIODevice::WriteOnly) != 0) { modeString[0] = 'w'; @@ -157,16 +158,15 @@ void QuaGzipFile::close() qint64 QuaGzipFile::readData(char *data, qint64 maxSize) { - return gzread(d->gzd, (voidp)data, (unsigned)maxSize); + return gzread(d->gzd, (voidp)data, static_cast(maxSize)); } qint64 QuaGzipFile::writeData(const char *data, qint64 maxSize) { if (maxSize == 0) return 0; - int written = gzwrite(d->gzd, (voidp)data, (unsigned)maxSize); + int written = gzwrite(d->gzd, (voidp)data, static_cast(maxSize)); if (written == 0) return -1; - else - return written; + return written; } diff --git a/deps/quazip-1.3/quazip/quagzipfile.h b/deps/quazip-1.5/quazip/quagzipfile.h similarity index 93% rename from deps/quazip-1.3/quazip/quagzipfile.h rename to deps/quazip-1.5/quazip/quagzipfile.h index 77d2459c1ef0..c874514e7221 100644 --- a/deps/quazip-1.3/quazip/quagzipfile.h +++ b/deps/quazip-1.5/quazip/quagzipfile.h @@ -57,7 +57,7 @@ class QUAZIP_EXPORT QuaGzipFile: public QIODevice { */ QuaGzipFile(const QString &fileName, QObject *parent = nullptr); /// Destructor. - virtual ~QuaGzipFile(); + ~QuaGzipFile() override; /// Sets the name of the GZIP file to be opened. void setFileName(const QString& fileName); /// Returns the name of the GZIP file. @@ -70,13 +70,13 @@ class QUAZIP_EXPORT QuaGzipFile: public QIODevice { writing, it is downright impossible. Therefore, QuaGzipFile does not support seeking at all. */ - virtual bool isSequential() const; + bool isSequential() const override; /// Opens the file. /** \param mode Can be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported. */ - virtual bool open(QIODevice::OpenMode mode); + bool open(QIODevice::OpenMode mode) override; /// Opens the file. /** \overload @@ -92,12 +92,12 @@ class QUAZIP_EXPORT QuaGzipFile: public QIODevice { */ virtual bool flush(); /// Closes the file. - virtual void close(); + void close() override; protected: /// Implementation of QIODevice::readData(). - virtual qint64 readData(char *data, qint64 maxSize); + qint64 readData(char *data, qint64 maxSize) override; /// Implementation of QIODevice::writeData(). - virtual qint64 writeData(const char *data, qint64 maxSize); + qint64 writeData(const char *data, qint64 maxSize) override; private: // not implemented by design to disable copy QuaGzipFile(const QuaGzipFile &that); diff --git a/deps/quazip-1.3/quazip/quaziodevice.cpp b/deps/quazip-1.5/quazip/quaziodevice.cpp similarity index 87% rename from deps/quazip-1.3/quazip/quaziodevice.cpp rename to deps/quazip-1.5/quazip/quaziodevice.cpp index d3af4f91895e..8582d0fdb470 100644 --- a/deps/quazip-1.3/quazip/quaziodevice.cpp +++ b/deps/quazip-1.5/quazip/quaziodevice.cpp @@ -36,29 +36,21 @@ class QuaZIODevicePrivate { QuaZIODevice *q; z_stream zins; z_stream zouts; - char *inBuf; - int inBufPos; - int inBufSize; - char *outBuf; - int outBufPos; - int outBufSize; - bool zBufError; - bool atEnd; + char *inBuf{nullptr}; + int inBufPos{0}; + int inBufSize{0}; + char *outBuf{nullptr}; + int outBufPos{0}; + int outBufSize{0}; + bool zBufError{false}; + bool atEnd{false}; bool flush(int sync); int doFlush(QString &error); }; QuaZIODevicePrivate::QuaZIODevicePrivate(QIODevice *io, QuaZIODevice *q): io(io), - q(q), - inBuf(nullptr), - inBufPos(0), - inBufSize(0), - outBuf(nullptr), - outBufPos(0), - outBufSize(0), - zBufError(false), - atEnd(false) + q(q) { zins.zalloc = (alloc_func) nullptr; zins.zfree = (free_func) nullptr; @@ -86,10 +78,8 @@ QuaZIODevicePrivate::~QuaZIODevicePrivate() #ifdef QUAZIP_ZIODEVICE_DEBUG_INPUT indebug.close(); #endif - if (inBuf != nullptr) - delete[] inBuf; - if (outBuf != nullptr) - delete[] outBuf; + delete[] inBuf; + delete[] outBuf; } bool QuaZIODevicePrivate::flush(int sync) @@ -106,13 +96,13 @@ bool QuaZIODevicePrivate::flush(int sync) zouts.next_in = &c; // fake input buffer zouts.avail_in = 0; // of zero size do { - zouts.next_out = (Bytef *) outBuf; + zouts.next_out = reinterpret_cast(outBuf); zouts.avail_out = QUAZIO_OUTBUFSIZE; int result = deflate(&zouts, sync); switch (result) { case Z_OK: case Z_STREAM_END: - outBufSize = (char *) zouts.next_out - outBuf; + outBufSize = reinterpret_cast(zouts.next_out) - outBuf; if (doFlush(error) < 0) { q->setErrorString(error); return false; @@ -241,19 +231,19 @@ qint64 QuaZIODevice::readData(char *data, qint64 maxSize) break; } while (read < maxSize && d->inBufPos < d->inBufSize) { - d->zins.next_in = (Bytef *) (d->inBuf + d->inBufPos); + d->zins.next_in = reinterpret_cast(d->inBuf + d->inBufPos); d->zins.avail_in = d->inBufSize - d->inBufPos; - d->zins.next_out = (Bytef *) (data + read); - d->zins.avail_out = (uInt) (maxSize - read); // hope it's less than 2GB + d->zins.next_out = reinterpret_cast(data + read); + d->zins.avail_out = static_cast(maxSize - read); // hope it's less than 2GB int more = 0; switch (inflate(&d->zins, Z_SYNC_FLUSH)) { case Z_OK: - read = (char *) d->zins.next_out - data; - d->inBufPos = (char *) d->zins.next_in - d->inBuf; + read = reinterpret_cast(d->zins.next_out) - data; + d->inBufPos = reinterpret_cast(d->zins.next_in) - d->inBuf; break; case Z_STREAM_END: - read = (char *) d->zins.next_out - data; - d->inBufPos = (char *) d->zins.next_in - d->inBuf; + read = reinterpret_cast(d->zins.next_out) - data; + d->inBufPos = reinterpret_cast(d->zins.next_in) - d->inBuf; d->atEnd = true; return read; case Z_BUF_ERROR: // this should never happen, but just in case @@ -299,13 +289,13 @@ qint64 QuaZIODevice::writeData(const char *data, qint64 maxSize) if (d->outBufPos < d->outBufSize) return written; d->zouts.next_in = (Bytef *) (data + written); - d->zouts.avail_in = (uInt) (maxSize - written); // hope it's less than 2GB - d->zouts.next_out = (Bytef *) d->outBuf; + d->zouts.avail_in = static_cast(maxSize - written); // hope it's less than 2GB + d->zouts.next_out = reinterpret_cast(d->outBuf); d->zouts.avail_out = QUAZIO_OUTBUFSIZE; switch (deflate(&d->zouts, Z_NO_FLUSH)) { case Z_OK: - written = (char *) d->zouts.next_in - data; - d->outBufSize = (char *) d->zouts.next_out - d->outBuf; + written = reinterpret_cast(d->zouts.next_in) - data; + d->outBufSize = reinterpret_cast(d->zouts.next_out) - d->outBuf; break; default: setErrorString(QString::fromLocal8Bit(d->zouts.msg)); diff --git a/deps/quazip-1.3/quazip/quaziodevice.h b/deps/quazip-1.5/quazip/quaziodevice.h similarity index 90% rename from deps/quazip-1.3/quazip/quaziodevice.h rename to deps/quazip-1.5/quazip/quaziodevice.h index 3adb8b92f213..7f65035bfe06 100644 --- a/deps/quazip-1.3/quazip/quaziodevice.h +++ b/deps/quazip-1.5/quazip/quaziodevice.h @@ -49,7 +49,7 @@ class QUAZIP_EXPORT QuaZIODevice: public QIODevice { */ QuaZIODevice(QIODevice *io, QObject *parent = nullptr); /// Destructor. - ~QuaZIODevice(); + ~QuaZIODevice() override; /// Flushes data waiting to be written. /** Unfortunately, as QIODevice doesn't support flush() by itself, the @@ -77,26 +77,26 @@ class QUAZIP_EXPORT QuaZIODevice: public QIODevice { \param mode Neither QIODevice::ReadWrite nor QIODevice::Append are not supported. */ - virtual bool open(QIODevice::OpenMode mode); + bool open(QIODevice::OpenMode mode) override; /// Closes this device, but not the underlying one. /** The underlying QIODevice is not closed in case you want to write something else to it. */ - virtual void close(); + void close() override; /// Returns the underlying device. QIODevice *getIoDevice() const; /// Returns true. - virtual bool isSequential() const; + bool isSequential() const override; /// Returns true iff the end of the compressed stream is reached. - virtual bool atEnd() const; + bool atEnd() const override; /// Returns the number of the bytes buffered. - virtual qint64 bytesAvailable() const; + qint64 bytesAvailable() const override; protected: /// Implementation of QIODevice::readData(). - virtual qint64 readData(char *data, qint64 maxSize); + qint64 readData(char *data, qint64 maxSize) override; /// Implementation of QIODevice::writeData(). - virtual qint64 writeData(const char *data, qint64 maxSize); + qint64 writeData(const char *data, qint64 maxSize) override; private: QuaZIODevicePrivate *d; }; diff --git a/deps/quazip-1.3/quazip/quazip.cpp b/deps/quazip-1.5/quazip/quazip.cpp similarity index 91% rename from deps/quazip-1.3/quazip/quazip.cpp rename to deps/quazip-1.5/quazip/quazip.cpp index 1f1f39770cb0..1b3056662e1f 100644 --- a/deps/quazip-1.3/quazip/quazip.cpp +++ b/deps/quazip-1.5/quazip/quazip.cpp @@ -79,10 +79,9 @@ class QuaZipPrivate { inline QTextCodec *getDefaultFileNameCodec() { if (defaultFileNameCodec == nullptr) { - return QTextCodec::codecForLocale(); - } else { - return defaultFileNameCodec; + return QTextCodec::codecForLocale(); } + return defaultFileNameCodec; } /// The constructor for the corresponding QuaZip constructor. inline QuaZipPrivate(QuaZip *q): @@ -245,9 +244,8 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) if (p->zipName.isEmpty()) { qWarning("QuaZip::open(): set either ZIP file name or IO device first"); return false; - } else { - ioDevice = new QFile(p->zipName); } + ioDevice = new QFile(p->zipName); } unsigned flags = 0; switch(mode) { @@ -267,25 +265,23 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) } } } - if(p->unzFile_f!=nullptr) { - if (ioDevice->isSequential()) { - unzClose(p->unzFile_f); - if (!p->zipName.isEmpty()) - delete ioDevice; - qWarning("QuaZip::open(): " - "only mdCreate can be used with " - "sequential devices"); - return false; - } - p->mode=mode; - p->ioDevice = ioDevice; - return true; - } else { - p->zipError=UNZ_OPENERROR; + if (p->unzFile_f == nullptr) { + p->zipError = UNZ_OPENERROR; if (!p->zipName.isEmpty()) delete ioDevice; return false; } + if (ioDevice->isSequential()) { + unzClose(p->unzFile_f); + if (!p->zipName.isEmpty()) + delete ioDevice; + qWarning("QuaZip::open(): only mdCreate can be used with sequential devices"); + return false; + } + p->mode = mode; + p->ioDevice = ioDevice; + return true; + case mdCreate: case mdAppend: case mdAdd: @@ -313,30 +309,28 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) zipSetFlags(p->zipFile_f, flags); } } - if(p->zipFile_f!=nullptr) { - if (ioDevice->isSequential()) { - if (mode != mdCreate) { - zipClose(p->zipFile_f, nullptr); - qWarning("QuaZip::open(): " - "only mdCreate can be used with " - "sequential devices"); - if (!p->zipName.isEmpty()) - delete ioDevice; - return false; - } - zipSetFlags(p->zipFile_f, ZIP_SEQUENTIAL); - } - p->mode=mode; - p->ioDevice = ioDevice; - return true; - } else { - p->zipError=UNZ_OPENERROR; + if(p->zipFile_f == nullptr) { + p->zipError = UNZ_OPENERROR; if (!p->zipName.isEmpty()) delete ioDevice; return false; } + if (ioDevice->isSequential()) { + if (mode != mdCreate) { + zipClose(p->zipFile_f, nullptr); + qWarning("QuaZip::open(): only mdCreate can be used with sequential devices"); + if (!p->zipName.isEmpty()) + delete ioDevice; + return false; + } + zipSetFlags(p->zipFile_f, ZIP_SEQUENTIAL); + } + p->mode=mode; + p->ioDevice = ioDevice; + return true; + default: - qWarning("QuaZip::open(): unknown mode: %d", (int)mode); + qWarning("QuaZip::open(): unknown mode: %d", static_cast(mode)); if (!p->zipName.isEmpty()) delete ioDevice; return false; @@ -361,7 +355,7 @@ void QuaZip::close() : p->commentCodec->fromUnicode(p->comment).constData()); break; default: - qWarning("QuaZip::close(): unknown mode: %d", (int)p->mode); + qWarning("QuaZip::close(): unknown mode: %d", static_cast(p->mode)); return; } // opened by name, need to delete the internal IO device @@ -395,7 +389,7 @@ void QuaZip::setIoDevice(QIODevice *ioDevice) int QuaZip::getEntriesCount()const { - QuaZip *fakeThis=(QuaZip*)this; // non-const + QuaZip *fakeThis=const_cast(this); // non-const fakeThis->p->zipError=UNZ_OK; if(p->mode!=mdUnzip) { qWarning("QuaZip::getEntriesCount(): ZIP is not open in mdUnzip mode"); @@ -404,12 +398,12 @@ int QuaZip::getEntriesCount()const unz_global_info64 globalInfo; if((fakeThis->p->zipError=unzGetGlobalInfo64(p->unzFile_f, &globalInfo))!=UNZ_OK) return p->zipError; - return (int)globalInfo.number_entry; + return static_cast(globalInfo.number_entry); } QString QuaZip::getComment()const { - QuaZip *fakeThis=(QuaZip*)this; // non-const + QuaZip *fakeThis=const_cast(this); // non-const fakeThis->p->zipError=UNZ_OK; if(p->mode!=mdUnzip) { qWarning("QuaZip::getComment(): ZIP is not open in mdUnzip mode"); @@ -518,17 +512,16 @@ bool QuaZip::getCurrentFileInfo(QuaZipFileInfo *info)const if (info == nullptr) { // Very unlikely because of the overloads return false; } - if (getCurrentFileInfo(&info64)) { - info64.toQuaZipFileInfo(*info); - return true; - } else { + if (!getCurrentFileInfo(&info64)) { return false; } + info64.toQuaZipFileInfo(*info); + return true; } bool QuaZip::getCurrentFileInfo(QuaZipFileInfo64 *info)const { - QuaZip *fakeThis=(QuaZip*)this; // non-const + QuaZip *fakeThis=const_cast(this); // non-const fakeThis->p->zipError=UNZ_OK; if(p->mode!=mdUnzip) { qWarning("QuaZip::getCurrentFileInfo(): ZIP is not open in mdUnzip mode"); @@ -573,7 +566,7 @@ bool QuaZip::getCurrentFileInfo(QuaZipFileInfo64 *info)const QString QuaZip::getCurrentFileName()const { - QuaZip *fakeThis=(QuaZip*)this; // non-const + QuaZip *fakeThis=const_cast(this); // non-const fakeThis->p->zipError=UNZ_OK; if(p->mode!=mdUnzip) { qWarning("QuaZip::getCurrentFileName(): ZIP is not open in mdUnzip mode"); @@ -756,28 +749,25 @@ bool QuaZipPrivate::getFileInfoList(QList *result) const QStringList QuaZip::getFileNameList() const { QStringList list; - if (p->getFileInfoList(&list)) - return list; - else + if (!p->getFileInfoList(&list)) return QStringList(); + return list; } QList QuaZip::getFileInfoList() const { QList list; - if (p->getFileInfoList(&list)) - return list; - else + if (!p->getFileInfoList(&list)) return QList(); + return list; } QList QuaZip::getFileInfoList64() const { QList list; - if (p->getFileInfoList(&list)) - return list; - else + if (!p->getFileInfoList(&list)) return QList(); + return list; } Qt::CaseSensitivity QuaZip::convertCaseSensitivity(QuaZip::CaseSensitivity cs) diff --git a/deps/quazip-1.3/quazip/quazip.h b/deps/quazip-1.5/quazip/quazip.h similarity index 99% rename from deps/quazip-1.3/quazip/quazip.h rename to deps/quazip-1.5/quazip/quazip.h index 488c3a981bce..5f5107d32d00 100644 --- a/deps/quazip-1.3/quazip/quazip.h +++ b/deps/quazip-1.5/quazip/quazip.h @@ -127,10 +127,6 @@ class QUAZIP_EXPORT QuaZip { CaseSensitivity cs); private: QuaZipPrivate *p; - // not (and will not be) implemented - QuaZip(const QuaZip& that); - // not (and will not be) implemented - QuaZip& operator=(const QuaZip& that); public: /// Constructs QuaZip object. /** Call setName() before opening constructed object. */ @@ -140,6 +136,10 @@ class QUAZIP_EXPORT QuaZip { /// Constructs QuaZip object associated with ZIP file represented by \a ioDevice. /** The IO device must be seekable, otherwise an error will occur when opening. */ QuaZip(QIODevice *ioDevice); + // not (and will not be) implemented + QuaZip(const QuaZip& that) = delete; + // not (and will not be) implemented + QuaZip& operator=(const QuaZip& that) = delete; /// Destroys QuaZip object. /** Calls close() if necessary. */ ~QuaZip(); @@ -303,9 +303,9 @@ class QUAZIP_EXPORT QuaZip { QString getComment() const; /// Sets the global comment in the ZIP file. /** The comment will be written to the archive on close operation. - * QuaZip makes a distinction between a null QByteArray() comment - * and an empty "" comment in the QuaZip::mdAdd mode. - * A null comment is the default and it means "don't change + * QuaZip makes a distinction between a null QByteArray() comment + * and an empty "" comment in the QuaZip::mdAdd mode. + * A null comment is the default and it means "don't change * the comment". An empty comment removes the original comment. * * \sa open() diff --git a/deps/quazip-1.3/quazip/quazip.pc.cmakein b/deps/quazip-1.5/quazip/quazip.pc.cmakein similarity index 100% rename from deps/quazip-1.3/quazip/quazip.pc.cmakein rename to deps/quazip-1.5/quazip/quazip.pc.cmakein diff --git a/deps/quazip-1.3/quazip/quazip_global.h b/deps/quazip-1.5/quazip/quazip_global.h similarity index 100% rename from deps/quazip-1.3/quazip/quazip_global.h rename to deps/quazip-1.5/quazip/quazip_global.h diff --git a/deps/quazip-1.3/quazip/quazip_qt_compat.h b/deps/quazip-1.5/quazip/quazip_qt_compat.h similarity index 85% rename from deps/quazip-1.3/quazip/quazip_qt_compat.h rename to deps/quazip-1.5/quazip/quazip_qt_compat.h index 48024be5682d..0dde011f1d2e 100644 --- a/deps/quazip-1.3/quazip/quazip_qt_compat.h +++ b/deps/quazip-1.5/quazip/quazip_qt_compat.h @@ -30,10 +30,9 @@ inline bool quazip_close(QIODevice *device) { if (file != nullptr) { // We have to call the ugly commit() instead: return file->commit(); - } else { - device->close(); - return true; } + device->close(); + return true; } #else inline bool quazip_close(QIODevice *device) { @@ -104,16 +103,36 @@ inline QString quazip_symlink_target(const QFileInfo &fi) { } #endif +// deprecation +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +#include +inline QDateTime quazip_since_epoch() { + return QDateTime(QDate(1970, 1, 1), QTime(0, 0), QTimeZone::utc()); +} + +inline QDateTime quazip_since_epoch_ntfs() { + return QDateTime(QDate(1601, 1, 1), QTime(0, 0), QTimeZone::utc()); +} +#else +inline QDateTime quazip_since_epoch() { + return QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC); +} + +inline QDateTime quazip_since_epoch_ntfs() { + return QDateTime(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); +} +#endif + // this is not a deprecation but an improvement, for a change #include #if (QT_VERSION >= 0x040700) inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) { - QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base = quazip_since_epoch_ntfs(); return base.msecsTo(time) * 10000 + fineTicks; } #else inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) { - QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base = quazip_since_epoch_ntfs(); QDateTime utc = time.toUTC(); return (static_cast(base.date().daysTo(utc.date())) * Q_INT64_C(86400000) diff --git a/deps/quazip-1.3/quazip/quazipdir.cpp b/deps/quazip-1.5/quazip/quazipdir.cpp similarity index 80% rename from deps/quazip-1.3/quazip/quazipdir.cpp rename to deps/quazip-1.5/quazip/quazipdir.cpp index ac819fe47fbc..d43f1c1edc91 100644 --- a/deps/quazip-1.3/quazip/quazipdir.cpp +++ b/deps/quazip-1.5/quazip/quazipdir.cpp @@ -33,14 +33,13 @@ class QuaZipDirPrivate: public QSharedData { friend class QuaZipDir; private: QuaZipDirPrivate(QuaZip *zip, const QString &dir = QString()): - zip(zip), dir(dir), caseSensitivity(QuaZip::csDefault), - filter(QDir::NoFilter), sorting(QDir::NoSort) {} + zip(zip), dir(dir) {} QuaZip *zip; QString dir; - QuaZip::CaseSensitivity caseSensitivity; - QDir::Filters filter; + QuaZip::CaseSensitivity caseSensitivity{QuaZip::csDefault}; + QDir::Filters filter{QDir::NoFilter}; QStringList nameFilters; - QDir::SortFlags sorting; + QDir::SortFlags sorting{QDir::NoSort}; template bool entryInfoList(QStringList nameFilters, QDir::Filters filter, QDir::SortFlags sort, TFileInfoList &result) const; @@ -48,11 +47,6 @@ class QuaZipDirPrivate: public QSharedData { }; /// \endcond -QuaZipDir::QuaZipDir(const QuaZipDir &that): - d(that.d) -{ -} - QuaZipDir::QuaZipDir(QuaZip *zip, const QString &dir): d(new QuaZipDirPrivate(zip, dir)) { @@ -60,21 +54,15 @@ QuaZipDir::QuaZipDir(QuaZip *zip, const QString &dir): d->dir = d->dir.mid(1); } -QuaZipDir::~QuaZipDir() -{ -} +QuaZipDir::QuaZipDir(const QuaZipDir &that) = default; +QuaZipDir::~QuaZipDir() = default; +QuaZipDir& QuaZipDir::operator=(const QuaZipDir &that) = default; bool QuaZipDir::operator==(const QuaZipDir &that) { return d->zip == that.d->zip && d->dir == that.d->dir; } -QuaZipDir& QuaZipDir::operator=(const QuaZipDir &that) -{ - this->d = that.d; - return *this; -} - QString QuaZipDir::operator[](int pos) const { return entryList().at(pos); @@ -92,8 +80,9 @@ bool QuaZipDir::cd(const QString &directoryName) return true; } QString dirName = directoryName; - if (dirName.endsWith(QLatin1String("/"))) + if (dirName.endsWith(QLatin1String("/"))) { dirName.chop(1); + } if (dirName.contains(QLatin1String("/"))) { QuaZipDir dir(*this); if (dirName.startsWith(QLatin1String("/"))) { @@ -105,10 +94,7 @@ bool QuaZipDir::cd(const QString &directoryName) return false; } QStringList path = dirName.split(QLatin1String("/"), SkipEmptyParts); - for (QStringList::const_iterator i = path.constBegin(); - i != path.constEnd(); - ++i) { - const QString &step = *i; + for (const auto& step : path) { #ifdef QUAZIP_QUAZIPDIR_DEBUG qDebug("QuaZipDir::cd(%s): going to %s", dirName.toUtf8().constData(), @@ -119,33 +105,28 @@ bool QuaZipDir::cd(const QString &directoryName) } d->dir = dir.path(); return true; - } else { // no '/' - if (dirName == QLatin1String(".")) { - return true; - } else if (dirName == QLatin1String("..")) { - if (isRoot()) { - return false; - } else { - int slashPos = d->dir.lastIndexOf(QLatin1String("/")); - if (slashPos == -1) { - d->dir = QLatin1String(""); - } else { - d->dir = d->dir.left(slashPos); - } - return true; - } - } else { // a simple subdirectory - if (exists(dirName)) { - if (isRoot()) - d->dir = dirName; - else - d->dir += QLatin1String("/") + dirName; - return true; - } else { - return false; - } - } } + if (dirName == QLatin1String(".")) { + return true; + } + if (dirName == QLatin1String("..")) { + if (isRoot()) + return false; + int slashPos = d->dir.lastIndexOf(QLatin1String("/")); + if (slashPos == -1) + d->dir = QLatin1String(""); + else + d->dir = d->dir.left(slashPos); + return true; + } + if (exists(dirName)) { + if (isRoot()) + d->dir = dirName; + else + d->dir += QLatin1String("/") + dirName; + return true; + } + return false; } bool QuaZipDir::cdUp() @@ -196,10 +177,8 @@ static void QuaZipDir_convertInfoList(const QList &from, QStringList &to) { to.clear(); - for (QList::const_iterator i = from.constBegin(); - i != from.constEnd(); - ++i) { - to.append(i->name); + for (const auto& file : from) { + to.append(file.name); } } @@ -207,11 +186,9 @@ static void QuaZipDir_convertInfoList(const QList &from, QList &to) { to.clear(); - for (QList::const_iterator i = from.constBegin(); - i != from.constEnd(); - ++i) { + for (const auto& file : from) { QuaZipFileInfo info32; - i->toQuaZipFileInfo(info32); + file.toQuaZipFileInfo(info32); to.append(info32); } } @@ -248,12 +225,9 @@ class QuaZipDirComparator QString QuaZipDirComparator::getExtension(const QString &name) { - if (name.endsWith(QLatin1String(".")) || name.indexOf(QLatin1String("."), 1) == -1) { - return QLatin1String(""); - } else { + if (name.endsWith(QLatin1String(".")) || name.indexOf(QLatin1String("."), 1) == -1) + return QLatin1String(""); return name.mid(name.lastIndexOf(QLatin1String(".")) + 1); - } - } int QuaZipDirComparator::compareStrings(const QString &string1, @@ -262,13 +236,10 @@ int QuaZipDirComparator::compareStrings(const QString &string1, if (sort & QDir::LocaleAware) { if (sort & QDir::IgnoreCase) { return string1.toLower().localeAwareCompare(string2.toLower()); - } else { - return string1.localeAwareCompare(string2); } - } else { - return string1.compare(string2, (sort & QDir::IgnoreCase) - ? Qt::CaseInsensitive : Qt::CaseSensitive); + return string1.localeAwareCompare(string2); } + return string1.compare(string2, (sort & QDir::IgnoreCase) ? Qt::CaseInsensitive : Qt::CaseSensitive); } bool QuaZipDirComparator::operator()(const QuaZipFileInfo64 &info1, @@ -276,12 +247,13 @@ bool QuaZipDirComparator::operator()(const QuaZipFileInfo64 &info1, { QDir::SortFlags order = sort & (QDir::Name | QDir::Time | QDir::Size | QDir::Type); - if ((sort & QDir::DirsFirst) == QDir::DirsFirst - || (sort & QDir::DirsLast) == QDir::DirsLast) { - if (info1.name.endsWith(QLatin1String("/")) && !info2.name.endsWith(QLatin1String("/"))) + if ((sort & QDir::DirsFirst) == QDir::DirsFirst || (sort & QDir::DirsLast) == QDir::DirsLast) { + if (info1.name.endsWith(QLatin1String("/")) && !info2.name.endsWith(QLatin1String("/"))) { return (sort & QDir::DirsFirst) == QDir::DirsFirst; - else if (!info1.name.endsWith(QLatin1String("/")) && info2.name.endsWith(QLatin1String("/"))) + } + if (!info1.name.endsWith(QLatin1String("/")) && info2.name.endsWith(QLatin1String("/"))) { return (sort & QDir::DirsLast) == QDir::DirsLast; + } } bool result; int extDiff; @@ -321,7 +293,7 @@ bool QuaZipDirComparator::operator()(const QuaZipFileInfo64 &info1, } template -bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters, +bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters, QDir::Filters filter, QDir::SortFlags sort, TFileInfoList &result) const { QString basePath = simplePath(); @@ -403,10 +375,9 @@ QList QuaZipDir::entryInfoList(const QStringList &nameFilters, QDir::Filters filters, QDir::SortFlags sort) const { QList result; - if (d->entryInfoList(nameFilters, filters, sort, result)) - return result; - else + if (!d->entryInfoList(nameFilters, filters, sort, result)) return QList(); + return result; } QList QuaZipDir::entryInfoList(QDir::Filters filters, @@ -419,10 +390,9 @@ QList QuaZipDir::entryInfoList64(const QStringList &nameFilter QDir::Filters filters, QDir::SortFlags sort) const { QList result; - if (d->entryInfoList(nameFilters, filters, sort, result)) - return result; - else + if (!d->entryInfoList(nameFilters, filters, sort, result)) return QList(); + return result; } QList QuaZipDir::entryInfoList64(QDir::Filters filters, @@ -435,10 +405,9 @@ QStringList QuaZipDir::entryList(const QStringList &nameFilters, QDir::Filters filters, QDir::SortFlags sort) const { QStringList result; - if (d->entryInfoList(nameFilters, filters, sort, result)) - return result; - else + if (!d->entryInfoList(nameFilters, filters, sort, result)) return QStringList(); + return result; } QStringList QuaZipDir::entryList(QDir::Filters filters, @@ -464,33 +433,29 @@ bool QuaZipDir::exists(const QString &filePath) const #endif QuaZipDir dir(*this); return dir.cd(fileInfo.path()) && dir.exists(fileInfo.fileName()); - } else { - if (fileName == QLatin1String("..")) { - return !isRoot(); - } else if (fileName == QLatin1String(".")) { - return true; - } else { - QStringList entries = entryList(QDir::AllEntries, QDir::NoSort); + } + if (fileName == QLatin1String("..")) { + return !isRoot(); + } + if (fileName == QLatin1String(".")) { + return true; + } + QStringList entries = entryList(QDir::AllEntries, QDir::NoSort); #ifdef QUAZIP_QUAZIPDIR_DEBUG qDebug("QuaZipDir::exists(): looking for %s", fileName.toUtf8().constData()); - for (QStringList::const_iterator i = entries.constBegin(); - i != entries.constEnd(); - ++i) { + for (const auto& entry : entries) { qDebug("QuaZipDir::exists(): entry: %s", - i->toUtf8().constData()); + entry.toUtf8().constData()); } #endif Qt::CaseSensitivity cs = QuaZip::convertCaseSensitivity( d->caseSensitivity); if (filePath.endsWith(QLatin1String("/"))) { return entries.contains(filePath, cs); - } else { - return entries.contains(fileName, cs) - || entries.contains(fileName + QLatin1String("/"), cs); } - } - } + return entries.contains(fileName, cs) || + entries.contains(fileName + QLatin1String("/"), cs); } bool QuaZipDir::exists() const diff --git a/deps/quazip-1.3/quazip/quazipdir.h b/deps/quazip-1.5/quazip/quazipdir.h similarity index 100% rename from deps/quazip-1.3/quazip/quazipdir.h rename to deps/quazip-1.5/quazip/quazipdir.h diff --git a/deps/quazip-1.3/quazip/quazipfile.cpp b/deps/quazip-1.5/quazip/quazipfile.cpp similarity index 93% rename from deps/quazip-1.3/quazip/quazipfile.cpp rename to deps/quazip-1.5/quazip/quazipfile.cpp index d70acf7fe306..4a5f2f9b84e1 100644 --- a/deps/quazip-1.3/quazip/quazipfile.cpp +++ b/deps/quazip-1.5/quazip/quazipfile.cpp @@ -285,7 +285,7 @@ bool QuaZipFile::open(OpenMode mode, int *method, int *level, bool raw, const ch } if(p->zip->getMode()!=QuaZip::mdUnzip) { qWarning("QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d", - (int)mode, (int)p->zip->getMode()); + (int)mode, static_cast(p->zip->getMode())); return false; } if(!p->zip->hasCurrentFile()) { @@ -293,13 +293,13 @@ bool QuaZipFile::open(OpenMode mode, int *method, int *level, bool raw, const ch return false; } } - p->setZipError(unzOpenCurrentFile3(p->zip->getUnzFile(), method, level, (int)raw, password)); - if(p->zipError==UNZ_OK) { - setOpenMode(mode); - p->raw=raw; - return true; - } else + p->setZipError(unzOpenCurrentFile3(p->zip->getUnzFile(), method, level, static_cast(raw), password)); + if(p->zipError != UNZ_OK) { return false; + } + setOpenMode(mode); + p->raw=raw; + return true; } qWarning("QuaZipFile::open(): open mode %d not supported by this function", (int)mode); return false; @@ -327,7 +327,7 @@ bool QuaZipFile::open(OpenMode mode, const QuaZipNewInfo& info, } if(p->zip->getMode()!=QuaZip::mdCreate&&p->zip->getMode()!=QuaZip::mdAppend&&p->zip->getMode()!=QuaZip::mdAdd) { qWarning("QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d", - (int)mode, (int)p->zip->getMode()); + (int)mode, static_cast(p->zip->getMode())); return false; } info_z.tmz_date.tm_year=info.dateTime.date().year(); @@ -337,8 +337,8 @@ bool QuaZipFile::open(OpenMode mode, const QuaZipNewInfo& info, info_z.tmz_date.tm_min=info.dateTime.time().minute(); info_z.tmz_date.tm_sec=info.dateTime.time().second(); info_z.dosDate = 0; - info_z.internal_fa=(uLong)info.internalAttr; - info_z.external_fa=(uLong)info.externalAttr; + info_z.internal_fa=static_cast(info.internalAttr); + info_z.external_fa=static_cast(info.externalAttr); if (p->zip->isDataDescriptorWritingEnabled()) zipSetFlags(p->zip->getZipFile(), ZIP_WRITE_DATA_DESCRIPTOR); else @@ -353,23 +353,23 @@ bool QuaZipFile::open(OpenMode mode, const QuaZipNewInfo& info, p->zip->isUtf8Enabled() ? info.comment.toUtf8().constData() : p->zip->getCommentCodec()->fromUnicode(info.comment).constData(), - method, level, (int)raw, + method, level, static_cast(raw), windowBits, memLevel, strategy, - password, (uLong)crc, + password, static_cast(crc), (p->zip->getOsCode() << 8) | QUAZIP_VERSION_MADE_BY, 0, p->zip->isZip64Enabled())); - if(p->zipError==UNZ_OK) { - p->writePos=0; - setOpenMode(mode); - p->raw=raw; - if(raw) { - p->crc=crc; - p->uncompressedSize=info.uncompressedSize; - } - return true; - } else + if (p->zipError != UNZ_OK) { return false; + } + p->writePos=0; + setOpenMode(mode); + p->raw=raw; + if(raw) { + p->crc=crc; + p->uncompressedSize=info.uncompressedSize; + } + return true; } qWarning("QuaZipFile::open(): open mode %d not supported by this function", (int)mode); return false; @@ -395,8 +395,7 @@ qint64 QuaZipFile::pos()const // but thankfully bytesAvailable() returns the number of // bytes buffered, so we know how far ahead we are. return unztell64(p->zip->getUnzFile()) - QIODevice::bytesAvailable(); - else - return p->writePos; + return p->writePos; } bool QuaZipFile::atEnd()const @@ -413,8 +412,7 @@ bool QuaZipFile::atEnd()const // the same problem as with pos() return QIODevice::bytesAvailable() == 0 && unzeof(p->zip->getUnzFile())==1; - else - return true; + return true; } qint64 QuaZipFile::size()const @@ -425,8 +423,7 @@ qint64 QuaZipFile::size()const } if(openMode()&ReadOnly) return p->raw?csize():usize(); - else - return p->writePos; + return p->writePos; } qint64 QuaZipFile::csize()const @@ -454,12 +451,11 @@ qint64 QuaZipFile::usize()const bool QuaZipFile::getFileInfo(QuaZipFileInfo *info) { QuaZipFileInfo64 info64; - if (getFileInfo(&info64)) { - info64.toQuaZipFileInfo(*info); - return true; - } else { + if (!getFileInfo(&info64)) { return false; } + info64.toQuaZipFileInfo(*info); + return true; } bool QuaZipFile::getFileInfo(QuaZipFileInfo64 *info) @@ -498,9 +494,9 @@ void QuaZipFile::close() qint64 QuaZipFile::readData(char *data, qint64 maxSize) { p->setZipError(UNZ_OK); - qint64 bytesRead=unzReadCurrentFile(p->zip->getUnzFile(), data, (unsigned)maxSize); + qint64 bytesRead=unzReadCurrentFile(p->zip->getUnzFile(), data, static_cast(maxSize)); if (bytesRead < 0) { - p->setZipError((int) bytesRead); + p->setZipError(static_cast(bytesRead)); return -1; } return bytesRead; @@ -509,12 +505,12 @@ qint64 QuaZipFile::readData(char *data, qint64 maxSize) qint64 QuaZipFile::writeData(const char* data, qint64 maxSize) { p->setZipError(ZIP_OK); - p->setZipError(zipWriteInFileInZip(p->zip->getZipFile(), data, (uint)maxSize)); - if(p->zipError!=ZIP_OK) return -1; - else { - p->writePos+=maxSize; - return maxSize; + p->setZipError(zipWriteInFileInZip(p->zip->getZipFile(), data, static_cast(maxSize))); + if (p->zipError != ZIP_OK) { + return -1; } + p->writePos += maxSize; + return maxSize; } QString QuaZipFile::getFileName() const diff --git a/deps/quazip-1.3/quazip/quazipfile.h b/deps/quazip-1.5/quazip/quazipfile.h similarity index 96% rename from deps/quazip-1.3/quazip/quazipfile.h rename to deps/quazip-1.5/quazip/quazipfile.h index b49c50b9f37c..26c715c74700 100644 --- a/deps/quazip-1.3/quazip/quazipfile.h +++ b/deps/quazip-1.5/quazip/quazipfile.h @@ -81,9 +81,9 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { QuaZipFile& operator=(const QuaZipFile& that); protected: /// Implementation of the QIODevice::readData(). - qint64 readData(char *data, qint64 maxSize); + qint64 readData(char *data, qint64 maxSize) override; /// Implementation of the QIODevice::writeData(). - qint64 writeData(const char *data, qint64 maxSize); + qint64 writeData(const char *data, qint64 maxSize) override; public: /// Constructs a QuaZipFile instance. /** You should use setZipName() and setFileName() or setZip() before @@ -174,7 +174,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { /** Closes file if open, destructs internal QuaZip object (if it * exists and \em is internal, of course). **/ - virtual ~QuaZipFile(); + ~QuaZipFile() override; /// Returns the ZIP archive file name. /** If this object was created by passing QuaZip pointer to the * constructor, this function will return that QuaZip's file name @@ -201,7 +201,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * Returns null string if there is no file name set yet. This is the * case when this QuaZipFile operates on the existing QuaZip object * (constructor QuaZipFile(QuaZip*,QObject*) or setZip() was used). - * + * * \sa getActualFileName **/ QString getFileName() const; @@ -289,7 +289,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * QuaZipFile does not support unbuffered reading. So do not pass * QIODevice::Unbuffered flag in \a mode, or open will fail. **/ - virtual bool open(OpenMode mode); + bool open(OpenMode mode) override; /// Opens a file for reading. /** \overload * Argument \a password specifies a password to decrypt the file. If @@ -323,7 +323,8 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * use the raw mode (see below). * * Arguments \a method and \a level specify compression method and - * level. The only method supported is Z_DEFLATED, but you may also + * level. The only compression methods supported are + * Z_DEFLATED and Z_BZIP2ED. But you may also * specify 0 for no compression. If all of the files in the archive * use both method 0 and either level 0 is explicitly specified or * data descriptor writing is disabled with @@ -332,6 +333,10 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * format version, should you need that. Except for this, \a level * has no other effects with method 0. * + * If the method is \a Z_BZIP2ED, then the level must be specified + * explicitly (1 to 9), as the bzip2 backend doesn't support + * \a Z_DEFAULT_COMPRESSION. + * * If \a raw is \c true, no compression is performed. In this case, * \a crc and uncompressedSize field of the \a info are required. * @@ -343,7 +348,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false, int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY); /// Returns \c true, but \ref quazipfile-sequential "beware"! - virtual bool isSequential()const; + bool isSequential()const override; /// Returns current position in the file. /** Implementation of the QIODevice::pos(). When reading, this * function is a wrapper to the ZIP/UNZIP unztell(), therefore it is @@ -366,7 +371,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * Error code returned by getZipError() is not affected by this * function call. **/ - virtual qint64 pos()const; + qint64 pos()const override; /// Returns \c true if the end of file was reached. /** This function returns \c false in the case of error. This means * that you called this function on either not open file, or a file @@ -384,7 +389,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * Error code returned by getZipError() is not affected by this * function call. **/ - virtual bool atEnd()const; + bool atEnd()const override; /// Returns file size. /** This function returns csize() if the file is open for reading in * raw mode, usize() if it is open for reading in normal mode and @@ -398,7 +403,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * name would be very misguiding otherwise, so just keep in mind * this inconsistence. **/ - virtual qint64 size()const; + qint64 size()const override; /// Returns compressed file size. /** Equivalent to calling getFileInfo() and then getting * compressedSize field, but more convenient and faster. @@ -446,11 +451,11 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { /// Closes the file. /** Call getZipError() to determine if the close was successful. **/ - virtual void close(); + void close() override; /// Returns the error code returned by the last ZIP/UNZIP API call. int getZipError() const; /// Returns the number of bytes available for reading. - virtual qint64 bytesAvailable() const; + qint64 bytesAvailable() const override; /// Returns the local extra field /** There are two (optional) local extra fields associated with a file. diff --git a/deps/quazip-1.3/quazip/quazipfileinfo.cpp b/deps/quazip-1.5/quazip/quazipfileinfo.cpp similarity index 97% rename from deps/quazip-1.3/quazip/quazipfileinfo.cpp rename to deps/quazip-1.5/quazip/quazipfileinfo.cpp index c27ba370cc53..f182f744e36c 100644 --- a/deps/quazip-1.3/quazip/quazipfileinfo.cpp +++ b/deps/quazip-1.5/quazip/quazipfileinfo.cpp @@ -24,6 +24,8 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. #include "quazipfileinfo.h" +#include "quazip_qt_compat.h" + #include static QFile::Permissions permissionsFromExternalAttr(quint32 externalAttr) { @@ -123,7 +125,7 @@ static QDateTime getNTFSTime(const QByteArray &extra, int position, timeReader >> time; if (time == 0) return dateTime; - QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base = quazip_since_epoch_ntfs(); dateTime = base.addMSecs(time / 10000); if (fineTicks != nullptr) { *fineTicks = static_cast(time % 10000); @@ -167,7 +169,7 @@ QDateTime QuaZipFileInfo64::getExtTime(const QByteArray &extra, int flag) qint32 time; input >> time; if (nextFlag == flag) { - QDateTime base(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base = quazip_since_epoch(); dateTime = base.addSecs(time); return dateTime; } diff --git a/deps/quazip-1.3/quazip/quazipfileinfo.h b/deps/quazip-1.5/quazip/quazipfileinfo.h similarity index 100% rename from deps/quazip-1.3/quazip/quazipfileinfo.h rename to deps/quazip-1.5/quazip/quazipfileinfo.h diff --git a/deps/quazip-1.3/quazip/quazipnewinfo.cpp b/deps/quazip-1.5/quazip/quazipnewinfo.cpp similarity index 96% rename from deps/quazip-1.3/quazip/quazipnewinfo.cpp rename to deps/quazip-1.5/quazip/quazipnewinfo.cpp index a7a4e5741888..b55bb1b31dc5 100644 --- a/deps/quazip-1.3/quazip/quazipnewinfo.cpp +++ b/deps/quazip-1.5/quazip/quazipnewinfo.cpp @@ -105,6 +105,15 @@ QuaZipNewInfo::QuaZipNewInfo(const QString& name, const QString& file): } } +QuaZipNewInfo::QuaZipNewInfo(const QString& name, const QString& file, const QDateTime& dateTime): + name(name), dateTime(dateTime), internalAttr(0), externalAttr(0), uncompressedSize(0) +{ + QFileInfo info(file); + if (info.exists()) { + QuaZipNewInfo_setPermissions(this, info.permissions(), info.isDir(), quazip_is_symlink(info)); + } +} + void QuaZipNewInfo::setFileDateTime(const QString& file) { QFileInfo info(file); @@ -177,14 +186,12 @@ static void setNTFSTime(QByteArray &extra, const QDateTime &time, int position, timesPos = i - 4; // the beginning of the NTFS times tag ntfsTimesLength = tagsize; break; - } else { - i += tagsize; } + i += tagsize; } break; // I ain't going to search for yet another NTFS record! - } else { - i += length; } + i += length; } if (ntfsPos == -1) { // No NTFS record, need to create one. diff --git a/deps/quazip-1.3/quazip/quazipnewinfo.h b/deps/quazip-1.5/quazip/quazipnewinfo.h similarity index 94% rename from deps/quazip-1.3/quazip/quazipnewinfo.h rename to deps/quazip-1.5/quazip/quazipnewinfo.h index bad70c27d306..ee53d9bb9330 100644 --- a/deps/quazip-1.3/quazip/quazipnewinfo.h +++ b/deps/quazip-1.5/quazip/quazipnewinfo.h @@ -94,10 +94,18 @@ struct QUAZIP_EXPORT QuaZipNewInfo { * is inaccessible (e. g. you do not have read permission for the * directory file in), uses current time and zero permissions. Other attributes are * initialized with zeros, comment and extra field with null values. - * * \sa setFileDateTime() **/ QuaZipNewInfo(const QString& name, const QString& file); + /// Constructs QuaZipNewInfo instance. + /** Initializes name with \a name and provided timestamp. Permissions are taken + * from the specified file. If the \a file does not exists or + * is inaccessible (e. g. you do not have read permission for the + * directory file in), uses zero permissions. Other attributes are + * initialized with zeros, comment and extra field with null values. + * \sa setFileDateTime() + **/ + QuaZipNewInfo(const QString& name, const QString& file, const QDateTime& dateTime); /// Initializes the new instance from existing file info. /** Mainly used when copying files between archives. * diff --git a/deps/quazip-1.3/quazip/unzip.c b/deps/quazip-1.5/quazip/unzip.c similarity index 99% rename from deps/quazip-1.3/quazip/unzip.c rename to deps/quazip-1.5/quazip/unzip.c index 3e147d7d82f8..a39365df91c6 100644 --- a/deps/quazip-1.3/quazip/unzip.c +++ b/deps/quazip-1.5/quazip/unzip.c @@ -223,13 +223,8 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v *pi = (int)c; return UNZ_OK; } - else - { - if (ZERROR64(*pzlib_filefunc_def,filestream)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } + + return ZERROR64(*pzlib_filefunc_def, filestream) ? UNZ_ERRNO : UNZ_EOF; } @@ -780,8 +775,7 @@ extern unzFile ZEXPORT unzOpen2 (voidpf file, fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); return unzOpenInternal(file, &zlib_filefunc64_32_def_fill, 0, UNZ_DEFAULT_FLAGS); } - else - return unzOpenInternal(file, NULL, 0, UNZ_DEFAULT_FLAGS); + return unzOpenInternal(file, NULL, 0, UNZ_DEFAULT_FLAGS); } extern unzFile ZEXPORT unzOpen2_64 (voidpf file, @@ -795,8 +789,7 @@ extern unzFile ZEXPORT unzOpen2_64 (voidpf file, zlib_filefunc64_32_def_fill.zseek32_file = NULL; return unzOpenInternal(file, &zlib_filefunc64_32_def_fill, 1, UNZ_DEFAULT_FLAGS); } - else - return unzOpenInternal(file, NULL, 1, UNZ_DEFAULT_FLAGS); + return unzOpenInternal(file, NULL, 1, UNZ_DEFAULT_FLAGS); } extern unzFile ZEXPORT unzOpen (voidpf file) @@ -874,8 +867,8 @@ extern int ZEXPORT unzGetFileFlags (unzFile file, unsigned* pflags) */ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) { - ZPOS64_T uDate; - uDate = (ZPOS64_T)(ulDosDate>>16); + ZPOS64_T uDate = ulDosDate >> 16; + ptm->tm_mday = (uInt)(uDate&0x1f) ; ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; @@ -1782,7 +1775,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; + pfile_in_zip_read_info->stream.avail_in = uReadThis; } if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) @@ -1949,10 +1942,7 @@ extern int ZEXPORT unzeof (unzFile file) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; + return pfile_in_zip_read_info->rest_read_uncompressed == 0 ? 1 : 0; } @@ -2069,7 +2059,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS unz64_s* s; uLong uReadThis ; if (file==NULL) - return (int)UNZ_PARAMERROR; + return UNZ_PARAMERROR; s=(unz64_s*)file; uReadThis = uSizeBuf; diff --git a/deps/quazip-1.3/quazip/unzip.h b/deps/quazip-1.5/quazip/unzip.h similarity index 100% rename from deps/quazip-1.3/quazip/unzip.h rename to deps/quazip-1.5/quazip/unzip.h diff --git a/deps/quazip-1.3/quazip/zip.c b/deps/quazip-1.5/quazip/zip.c similarity index 96% rename from deps/quazip-1.3/quazip/zip.c rename to deps/quazip-1.5/quazip/zip.c index dc8e15fc2152..7788b88aa7bc 100644 --- a/deps/quazip-1.3/quazip/zip.c +++ b/deps/quazip-1.5/quazip/zip.c @@ -316,8 +316,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) return ZIP_ERRNO; - else - return ZIP_OK; + return ZIP_OK; } local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte)); @@ -368,13 +367,8 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo *pi = (int)c; return ZIP_OK; } - else - { - if (ZERROR64(*pzlib_filefunc_def,filestream)) - return ZIP_ERRNO; - else - return ZIP_EOF; - } + + return ZERROR64(*pzlib_filefunc_def, filestream) ? ZIP_ERRNO : ZIP_EOF; } @@ -830,7 +824,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T size_central_dir_to_read = size_central_dir; size_t buf_size = SIZEDATA_INDATABLOCK; - void* buf_read = (void*)ALLOC(buf_size); + void* buf_read = ALLOC(buf_size); if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) err=ZIP_ERRNO; @@ -934,11 +928,9 @@ extern zipFile ZEXPORT zipOpen3 (voidpf file, int append, zipcharpc* globalcomme TRYFREE(zi); return NULL; } - else - { - *zi = ziinit; - return (zipFile)zi; - } + + *zi = ziinit; + return (zipFile)zi; } extern zipFile ZEXPORT zipOpen2 (voidpf file, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) @@ -949,8 +941,7 @@ extern zipFile ZEXPORT zipOpen2 (voidpf file, int append, zipcharpc* globalcomme fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); return zipOpen3(file, append, globalcomment, &zlib_filefunc64_32_def_fill, ZIP_DEFAULT_FLAGS); } - else - return zipOpen3(file, append, globalcomment, NULL, ZIP_DEFAULT_FLAGS); + return zipOpen3(file, append, globalcomment, NULL, ZIP_DEFAULT_FLAGS); } extern zipFile ZEXPORT zipOpen2_64 (voidpf file, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) @@ -963,8 +954,7 @@ extern zipFile ZEXPORT zipOpen2_64 (voidpf file, int append, zipcharpc* globalco zlib_filefunc64_32_def_fill.zseek32_file = NULL; return zipOpen3(file, append, globalcomment, &zlib_filefunc64_32_def_fill, ZIP_DEFAULT_FLAGS); } - else - return zipOpen3(file, append, globalcomment, NULL, ZIP_DEFAULT_FLAGS); + return zipOpen3(file, append, globalcomment, NULL, ZIP_DEFAULT_FLAGS); } @@ -998,17 +988,17 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, else if(zi->ci.zip64) err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);/* version needed to extract */ else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)version_to_extract,2); + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,version_to_extract,2); } if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2); + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,zi->ci.flag,2); if (err==ZIP_OK) err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2); if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4); + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,zi->ci.dosDate,4); /* CRC / Compressed size / Uncompressed size will be filled in later and rewritten later */ if (err==ZIP_OK) @@ -1063,11 +1053,11 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, /* Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file) */ zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, HeaderID,2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, DataSize,2); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, UncompressedSize,8); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, CompressedSize,8); } return err; @@ -1112,6 +1102,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1187,11 +1188,11 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, zi->ci.size_centralExtra = size_extrafield_global; zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4); /* version info */ - zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2); - zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)version_to_extract,2); - zip64local_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2); + zip64local_putValue_inmemory(zi->ci.central_header+4,versionMadeBy,2); + zip64local_putValue_inmemory(zi->ci.central_header+6,version_to_extract,2); + zip64local_putValue_inmemory(zi->ci.central_header+8,zi->ci.flag,2); zip64local_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2); - zip64local_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4); + zip64local_putValue_inmemory(zi->ci.central_header+12,zi->ci.dosDate,4); zip64local_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/ zip64local_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/ zip64local_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/ @@ -1203,12 +1204,12 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, if (zipfi==NULL) zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); else - zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); + zip64local_putValue_inmemory(zi->ci.central_header+36,zipfi->internal_fa,2); if (zipfi==NULL) zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); else - zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); + zip64local_putValue_inmemory(zi->ci.central_header+38,zipfi->external_fa,4); if(zi->ci.pos_local_header >= 0xffffffff) zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4); @@ -1299,7 +1300,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, zi->ci.pcrc_32_tab = get_crc_table(); /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/ if (crcForCrypting == 0) { - crcForCrypting = (uLong)zi->ci.dosDate << 16; /* ATTANTION! Without this row, you don't unpack your password protected archive in other app. */ + crcForCrypting = zi->ci.dosDate << 16; /* ATTANTION! Without this row, you don't unpack your password protected archive in other app. */ } sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting); zi->ci.crypt_header_size = sizeHead; @@ -1645,7 +1646,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s if (!zi->ci.raw) { - crc32 = (uLong)zi->ci.crc32; + crc32 = zi->ci.crc32; uncompressed_size = zi->ci.totalUncompressedData; } compressed_size = zi->ci.totalCompressedData; @@ -1736,11 +1737,11 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s /* Update the extra info size field */ zi->ci.size_centralExtra += datasize + 4; - zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2); + zip64local_putValue_inmemory(zi->ci.central_header+30,zi->ci.size_centralExtra,2); } if (err==ZIP_OK) - err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); + err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, zi->ci.size_centralheader); TRYFREE(zi->ci.central_header); @@ -1874,7 +1875,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ { ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; - err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); + err = zip64local_putValue(&zi->z_filefunc,zi->filestream, pos,8); } return err; } @@ -1910,7 +1911,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, } if (err==ZIP_OK) /* size of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4); + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,size_centraldir,4); if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ { diff --git a/deps/quazip-1.3/quazip/zip.h b/deps/quazip-1.5/quazip/zip.h similarity index 100% rename from deps/quazip-1.3/quazip/zip.h rename to deps/quazip-1.5/quazip/zip.h diff --git a/deps/quazip-1.3/qztest/CMakeLists.txt b/deps/quazip-1.5/qztest/CMakeLists.txt similarity index 53% rename from deps/quazip-1.3/qztest/CMakeLists.txt rename to deps/quazip-1.5/qztest/CMakeLists.txt index fd5da07e10e0..acf0b22f8f9a 100644 --- a/deps/quazip-1.3/qztest/CMakeLists.txt +++ b/deps/quazip-1.5/qztest/CMakeLists.txt @@ -1,6 +1,8 @@ set(QZTEST_SOURCES qztest.h testjlcompress.h + testjlcp_compress.h + testjlcp_extract.h testquachecksum32.h testquagzipfile.h testquaziodevice.h @@ -11,6 +13,8 @@ set(QZTEST_SOURCES testquazipnewinfo.h qztest.cpp testjlcompress.cpp + testjlcp_compress.cpp + testjlcp_extract.cpp testquachecksum32.cpp testquagzipfile.cpp testquaziodevice.cpp @@ -23,13 +27,32 @@ set(QZTEST_SOURCES add_executable(qztest ${QZTEST_SOURCES} qztest.qrc) set_target_properties(qztest PROPERTIES AUTORCC ON) +target_include_directories(qztest PRIVATE ${QUAZIP_INC}) + +add_dependencies(qztest QuaZip::QuaZip) + target_link_libraries(qztest ${QUAZIP_TEST_QT_LIBRARIES} QuaZip::QuaZip ) -add_test(NAME qztest_test +add_test(NAME qztest_all COMMAND qztest WORKING_DIRECTORY ${QUAZIP_BINARY_DIR}/quazip # preliminary hack to find the dll on windows ) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose DEPENDS qztest) + +if (WIN32 AND BUILD_SHARED_LIBS) + message(STATUS "Setting up windeployqt") + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") + include(windeployqt) + windeployqt(qztest) + + # This copies quazip1-qt6.dll .dll, zlib1.dll and bz2.dll. + # For an unknown reason, bz2.dll is copied on second build only. :insert thinking emoji: + add_custom_command( + TARGET qztest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND_EXPAND_LISTS + ) +endif() \ No newline at end of file diff --git a/deps/quazip-1.3/qztest/qztest.cpp b/deps/quazip-1.5/qztest/qztest.cpp similarity index 81% rename from deps/quazip-1.3/qztest/qztest.cpp rename to deps/quazip-1.5/qztest/qztest.cpp index 37f11ef93456..1b65d1ea9b50 100644 --- a/deps/quazip-1.3/qztest/qztest.cpp +++ b/deps/quazip-1.5/qztest/qztest.cpp @@ -23,15 +23,17 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. */ #include "qztest.h" -#include "testquazip.h" -#include "testquazipfile.h" -#include "testquachecksum32.h" #include "testjlcompress.h" -#include "testquazipdir.h" +#include "testjlcp_compress.h" +#include "testjlcp_extract.h" +#include "testquachecksum32.h" #include "testquagzipfile.h" #include "testquaziodevice.h" -#include "testquazipnewinfo.h" +#include "testquazip.h" +#include "testquazipdir.h" +#include "testquazipfile.h" #include "testquazipfileinfo.h" +#include "testquazipnewinfo.h" #include #include @@ -56,6 +58,15 @@ bool createTestFiles(const QStringList &fileNames, int size, const QString &dir) testDir.path().toUtf8().constData()); return false; } + //qDebug() << "Created path " << testDir.path(); + QFile dirFile(testDir.path()); + if (!dirFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner | + QFileDevice::ReadGroup | QFileDevice::ExeGroup | + QFileDevice::ReadOther | QFileDevice::ExeOther)) { + qWarning("Couldn't set permissions for %s", + testDir.path().toUtf8().constData()); + return false; + } } if (fileName.endsWith('/')) { if (!curDir.mkpath(filePath)) { @@ -63,6 +74,15 @@ bool createTestFiles(const QStringList &fileNames, int size, const QString &dir) fileName.toUtf8().constData()); return false; } + //qDebug() << "Created path " << filePath; + QFile dirFile(filePath); + if (!dirFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner | + QFileDevice::ReadGroup | QFileDevice::ExeGroup | + QFileDevice::ReadOther | QFileDevice::ExeOther)) { + qWarning("Couldn't set permissions for %s", + filePath.toUtf8().constData()); + return false; + } } else { QFile testFile(filePath); if (!testFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -70,6 +90,8 @@ bool createTestFiles(const QStringList &fileNames, int size, const QString &dir) fileName.toUtf8().constData()); return false; } + testFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | + QFileDevice::ReadGroup | QFileDevice::ReadOther); if (size == -1) { QTextStream testStream(&testFile); testStream << "This is a test file named " << fileName << quazip_endl; @@ -146,9 +168,8 @@ bool createTestArchive(QuaZip &zip, const QString &zipName, zip.close(); if (zipName.startsWith("<")) { // something like "" return true; - } else { - return QFileInfo(zipName).exists(); } + return QFileInfo(zipName).exists(); } bool createTestArchive(const QString &zipName, @@ -229,6 +250,17 @@ int main(int argc, char **argv) TestQuaZipFileInfo testQuaZipFileInfo; err = qMax(err, QTest::qExec(&testQuaZipFileInfo, app.arguments())); } + if (QString(qgetenv("TEST_CR_COMPRESS")) == "true") + { + TestJlCpCompress testJlCpCompress; + err = qMax(err, QTest::qExec(&testJlCpCompress, app.arguments())); + } + if (QString(qgetenv("TEST_CR_DECOMPRESS")) == "true") + { + TestJlCpExtract testJlCpExtract; + err = qMax(err, QTest::qExec(&testJlCpExtract, app.arguments())); + } + if (err == 0) { qDebug("All tests executed successfully"); } else { diff --git a/deps/quazip-1.3/qztest/qztest.h b/deps/quazip-1.5/qztest/qztest.h similarity index 100% rename from deps/quazip-1.3/qztest/qztest.h rename to deps/quazip-1.5/qztest/qztest.h diff --git a/deps/quazip-1.3/qztest/qztest.qrc b/deps/quazip-1.5/qztest/qztest.qrc similarity index 100% rename from deps/quazip-1.3/qztest/qztest.qrc rename to deps/quazip-1.5/qztest/qztest.qrc diff --git a/deps/quazip-1.3/qztest/test_files/issue43_cant_get_dates.zip b/deps/quazip-1.5/qztest/test_files/issue43_cant_get_dates.zip similarity index 100% rename from deps/quazip-1.3/qztest/test_files/issue43_cant_get_dates.zip rename to deps/quazip-1.5/qztest/test_files/issue43_cant_get_dates.zip diff --git a/deps/quazip-1.3/qztest/testjlcompress.cpp b/deps/quazip-1.5/qztest/testjlcompress.cpp similarity index 58% rename from deps/quazip-1.3/qztest/testjlcompress.cpp rename to deps/quazip-1.5/qztest/testjlcompress.cpp index ecf03eaa14f8..35737d954db6 100644 --- a/deps/quazip-1.3/qztest/testjlcompress.cpp +++ b/deps/quazip-1.5/qztest/testjlcompress.cpp @@ -29,6 +29,7 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. #include #include #include +#include #include #include @@ -39,6 +40,8 @@ see quazip/(un)zip.h files for details. Basically it's the zlib license. #include #endif +Q_DECLARE_METATYPE(JlCompress::Options::CompressionStrategy) + void TestJlCompress::compressFile_data() { QTest::addColumn("zipName"); @@ -74,6 +77,100 @@ void TestJlCompress::compressFile() curDir.remove(zipName); } +void TestJlCompress::compressFileOptions_data() +{ + QTest::addColumn("zipName"); + QTest::addColumn("fileName"); + QTest::addColumn("dateTime"); + QTest::addColumn("strategy"); + QTest::addColumn("sha256sum_unix"); // Due to extra data archives are not identical + QTest::addColumn("sha256sum_win"); + QTest::newRow("simple") << "jlsimplefile.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Default + << "5eedd83aee92cf3381155d167fee54a4ef6e43b8bc7a979c903611d9aa28610a" + << "cb1847dff1a5c33a805efde2558fc74024ad4c64c8607f8b12903e4d92385955"; + QTest::newRow("simple-storage") << "jlsimplefile-storage.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Storage + << "" + << ""; + QTest::newRow("simple-fastest") << "jlsimplefile-fastest.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Fastest + << "" + << ""; + QTest::newRow("simple-faster") << "jlsimplefile-faster.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Faster + << "" + << ""; + QTest::newRow("simple-standard") << "jlsimplefile-standard.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Standard + << "5eedd83aee92cf3381155d167fee54a4ef6e43b8bc7a979c903611d9aa28610a" + << "cb1847dff1a5c33a805efde2558fc74024ad4c64c8607f8b12903e4d92385955"; + QTest::newRow("simple-better") << "jlsimplefile-better.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Better + << "" + << ""; + QTest::newRow("simple-best") << "jlsimplefile-best.zip" + << "test0.txt" + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Best + << "" + << ""; +} + +void TestJlCompress::compressFileOptions() +{ + QFETCH(QString, zipName); + QFETCH(QString, fileName); + QFETCH(QDateTime, dateTime); + QFETCH(JlCompress::Options::CompressionStrategy, strategy); + QFETCH(QString, sha256sum_unix); + QFETCH(QString, sha256sum_win); + QDir curDir; + if (curDir.exists(zipName)) { + if (!curDir.remove(zipName)) + QFAIL("Can't remove zip file"); + } + if (!createTestFiles(QStringList() << fileName)) { + QFAIL("Can't create test file"); + } + + const JlCompress::Options options(dateTime, strategy); + QVERIFY(JlCompress::compressFile(zipName, "tmp/" + fileName, options)); + // get the file list and check it + QStringList fileList = JlCompress::getFileList(zipName); + QCOMPARE(fileList.count(), 1); + QVERIFY(fileList[0] == fileName); + // now test the QIODevice* overload of getFileList() + QFile zipFile(zipName); + QVERIFY(zipFile.open(QIODevice::ReadOnly)); + fileList = JlCompress::getFileList(zipName); + QCOMPARE(fileList.count(), 1); + QVERIFY(fileList[0] == fileName); + // Hash is computed on the resulting file externally, then hardcoded in the test data + // This should help detecting any library breakage since we compare against a well-known stable result + QString hash = QCryptographicHash::hash(zipFile.readAll(), QCryptographicHash::Sha256).toHex(); + #ifdef Q_OS_WIN + if (!sha256sum_win.isEmpty()) QCOMPARE(hash, sha256sum_win); + #else + if (!sha256sum_unix.isEmpty()) QCOMPARE(hash, sha256sum_unix); + #endif + zipFile.close(); + removeTestFiles(QStringList() << fileName); + curDir.remove(zipName); +} + void TestJlCompress::compressFiles_data() { QTest::addColumn("zipName"); @@ -163,6 +260,142 @@ void TestJlCompress::compressDir() curDir.remove(zipName); } +void TestJlCompress::compressDirOptions_data() +{ + QTest::addColumn("zipName"); + QTest::addColumn("fileNames"); + QTest::addColumn("expected"); + QTest::addColumn("dateTime"); + QTest::addColumn("strategy"); + QTest::addColumn("sha256sum_unix"); + QTest::addColumn("sha256sum_win"); + QTest::newRow("simple") << "jldir.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Default + << "ed0d5921b2fc11b6b4cb214b3e43ea3ea28987d6ff8080faab54c4756de30af6" + << "1eba110a33718c07a4ddf3fa515d1b4c6e3f4fc912b2e29e5e32783e2cddf852"; + QTest::newRow("simple-storage") << "jldir-storage.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Storage + << "" + << ""; + QTest::newRow("simple-fastest") << "jldir-fastest.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Fastest + << "" + << ""; + QTest::newRow("simple-faster") << "jldir-faster.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Faster + << "" + << ""; + QTest::newRow("simple-standard") << "jldir-standard.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Standard + << "ed0d5921b2fc11b6b4cb214b3e43ea3ea28987d6ff8080faab54c4756de30af6" + << "1eba110a33718c07a4ddf3fa515d1b4c6e3f4fc912b2e29e5e32783e2cddf852"; + QTest::newRow("simple-better") << "jldir-better.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Better + << "" + << ""; + QTest::newRow("simple-best") << "jldir-best.zip" + << (QStringList() << "test0.txt" << "testdir1/test1.txt" + << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") + << (QStringList() << "test0.txt" + << "testdir1/" << "testdir1/test1.txt" + << "testdir2/" << "testdir2/test2.txt" + << "testdir2/subdir/" << "testdir2/subdir/test2sub.txt") + << QDateTime(QDate(2024, 9, 19), QTime(21, 0, 0), QTimeZone::utc()) + << JlCompress::Options::Best + << "" + << ""; +} + +void TestJlCompress::compressDirOptions() +{ + QFETCH(QString, zipName); + QFETCH(QStringList, fileNames); + QFETCH(QStringList, expected); + QFETCH(QDateTime, dateTime); + QFETCH(JlCompress::Options::CompressionStrategy, strategy); + QFETCH(QString, sha256sum_unix); + QFETCH(QString, sha256sum_win); + QDir curDir; + if (curDir.exists(zipName)) { + if (!curDir.remove(zipName)) + QFAIL("Can't remove zip file"); + } + if (!createTestFiles(fileNames, -1, "compressDir_tmp")) { + QFAIL("Can't create test files"); + } +#ifdef Q_OS_WIN + for (int i = 0; i < fileNames.size(); ++i) { + if (fileNames.at(i).startsWith(".")) { + QString fn = "compressDir_tmp\\" + fileNames.at(i); + SetFileAttributesW(reinterpret_cast(fn.utf16()), + FILE_ATTRIBUTE_HIDDEN); + } + } +#endif + const JlCompress::Options options(dateTime, strategy); + QVERIFY(JlCompress::compressDir(zipName, "compressDir_tmp", true, QDir::Hidden, options)); + // get the file list and check it + QStringList fileList = JlCompress::getFileList(zipName); + fileList.sort(); + expected.sort(); + QCOMPARE(fileList, expected); + QFile zipFile(curDir.absoluteFilePath(zipName)); + if (!zipFile.open(QIODevice::ReadOnly)) { + QFAIL("Can't read output zip file"); + } + QString hash = QCryptographicHash::hash(zipFile.readAll(), QCryptographicHash::Sha256).toHex(); +#ifdef Q_OS_WIN + if (!sha256sum_win.isEmpty()) QCOMPARE(hash, sha256sum_win); +#else + if (!sha256sum_unix.isEmpty()) QCOMPARE(hash, sha256sum_unix); +#endif + zipFile.close(); + removeTestFiles(fileNames, "compressDir_tmp"); + curDir.remove(zipName); +} + void TestJlCompress::extractFile_data() { QTest::addColumn("zipName"); @@ -345,9 +578,8 @@ void TestJlCompress::extractDir_data() class TemporarilyChangeToRoot { QString previousDir; - bool success; + bool success{false}; public: - TemporarilyChangeToRoot() : success{false} {} ~TemporarilyChangeToRoot() { if (success) { QDir::setCurrent(previousDir); // Let's HOPE it succeeds. diff --git a/deps/quazip-1.3/qztest/testjlcompress.h b/deps/quazip-1.5/qztest/testjlcompress.h similarity index 92% rename from deps/quazip-1.3/qztest/testjlcompress.h rename to deps/quazip-1.5/qztest/testjlcompress.h index 73be47c2cfec..2e4697ef6d06 100644 --- a/deps/quazip-1.3/qztest/testjlcompress.h +++ b/deps/quazip-1.5/qztest/testjlcompress.h @@ -41,10 +41,14 @@ class TestJlCompress: public QObject { private slots: void compressFile_data(); void compressFile(); + void compressFileOptions_data(); + void compressFileOptions(); void compressFiles_data(); void compressFiles(); void compressDir_data(); void compressDir(); + void compressDirOptions_data(); + void compressDirOptions(); void extractFile_data(); void extractFile(); void extractFiles_data(); diff --git a/deps/quazip-1.5/qztest/testjlcp_compress.cpp b/deps/quazip-1.5/qztest/testjlcp_compress.cpp new file mode 100644 index 000000000000..9e81ee3642e0 --- /dev/null +++ b/deps/quazip-1.5/qztest/testjlcp_compress.cpp @@ -0,0 +1,85 @@ +/* +Copyright (C) 2025 cen1 + +This file is part of QuaZip test suite. + +QuaZip is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 of the License, or +(at your option) any later version. + +QuaZip 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with QuaZip. If not, see . + +See COPYING file for the full LGPL text. +*/ + +#include "testjlcp_compress.h" + +#include "qztest.h" + +#include +#include +#include + +#include + +#ifdef Q_OS_WIN +#include +#endif + +Q_DECLARE_METATYPE(JlCompress::Options::CompressionStrategy) + +/* + * The purpose of these tests is to create a bundle of different zip files with most common options + * on each supported OS platform, NOT delete them after run, upload them to object storage + * and then perform extraction and validation on all other OS platforms. + * For example: produce archives on Windows and Linux, extract and verify on Mac. Repeat for all combinations. + */ +void TestJlCpCompress::compressFileOptions_data() +{ + QTest::addColumn("zipName"); + QTest::addColumn("fileName"); + QTest::addColumn("strategy"); + QTest::newRow("simple") << "jlsimplefile.zip" + << "test0.txt" + << JlCompress::Options::Default; + QTest::newRow("simple-storage") << "jlsimplefile-storage.zip" + << "test0.txt" + << JlCompress::Options::Storage; + QTest::newRow("simple-best") << "jlsimplefile-best.zip" + << "test0.txt" + << JlCompress::Options::Best; +} + +void TestJlCpCompress::compressFileOptions() +{ + QFETCH(QString, zipName); + QFETCH(QString, fileName); + QFETCH(JlCompress::Options::CompressionStrategy, strategy); + QDir curDir; + if (curDir.exists(zipName)) { + if (!curDir.remove(zipName)) + QFAIL("Can't remove zip file"); + } + if (!createTestFiles(QStringList() << fileName)) { + QFAIL("Can't create test file"); + } + + const JlCompress::Options options(strategy); + QVERIFY(JlCompress::compressFile(zipName, "tmp/" + fileName, options)); + + removeTestFiles(QStringList() << fileName); + + archivesToBundle << zipName; +} + +void TestJlCpCompress::createBundle() +{ + QVERIFY(JlCompress::compressFiles("cp.zip", archivesToBundle)); +} diff --git a/deps/quazip-1.5/qztest/testjlcp_compress.h b/deps/quazip-1.5/qztest/testjlcp_compress.h new file mode 100644 index 000000000000..2ad6580d43b4 --- /dev/null +++ b/deps/quazip-1.5/qztest/testjlcp_compress.h @@ -0,0 +1,46 @@ +#ifndef QUAZIP_TEST_JLCP_COMPRESS_H +#define QUAZIP_TEST_JLCP_COMPRESS_H + +/* +Copyright (C) 2025 cen1 + +This file is part of QuaZip test suite. + +QuaZip is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 of the License, or +(at your option) any later version. + +QuaZip 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with QuaZip. If not, see . + +See COPYING file for the full LGPL text. +*/ + +#include + +#ifdef Q_OS_UNIX +#define QUAZIP_SYMLINK_TEST +#define QUAZIP_EXTRACT_TO_ROOT_TEST +#endif + +#ifdef Q_OS_WIN +#define QUAZIP_SYMLINK_EXTRACTION_ON_WINDOWS_TEST +#endif + +class TestJlCpCompress: public QObject { + Q_OBJECT +private: + QStringList archivesToBundle; +private slots: + void compressFileOptions_data(); + void compressFileOptions(); + void createBundle(); +}; + +#endif // QUAZIP_TEST_JLCP_COMPRESS_H diff --git a/deps/quazip-1.5/qztest/testjlcp_extract.cpp b/deps/quazip-1.5/qztest/testjlcp_extract.cpp new file mode 100644 index 000000000000..22a768cb7734 --- /dev/null +++ b/deps/quazip-1.5/qztest/testjlcp_extract.cpp @@ -0,0 +1,120 @@ +/* +Copyright (C) 2025 cen1 + +This file is part of QuaZip test suite. + +QuaZip is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 of the License, or +(at your option) any later version. + +QuaZip 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with QuaZip. If not, see . + +See COPYING file for the full LGPL text. + +Original ZIP package is copyrighted by Gilles Vollant and contributors, +see quazip/(un)zip.h files for details. Basically it's the zlib license. +*/ + +#include "testjlcp_extract.h" + +#include "qztest.h" + +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef Q_OS_WIN +#include +#endif + +Q_DECLARE_METATYPE(JlCompress::Options::CompressionStrategy) + +/* Inside the CI env, /quazip directory contains directories like + * macos-13_qt5.15.2_sharedOFF_cp + * ubuntu-22.04_qt5.15.2_sharedOFF_cp + * Inside, there is a cp.zip which is a bundle of several zip files produced by TestJlCpCompress + * We extract all, check content. This verifies an archive created on different platform can be properly extracted. + */ +void TestJlCpExtract::extract() +{ + QSet zipNames = { + "jlsimplefile.zip", + "jlsimplefile-storage.zip", + "jlsimplefile-best.zip" + }; + + QSet fileNames = { + "test0.txt" + }; + + qDebug() << "Performing CP extract tests in " << QDir::currentPath(); + + QDirIterator it(QDir::currentPath(), QStringList() << "*_cp", QDir::Dirs, QDirIterator::Subdirectories); + + QVERIFY(it.hasNext()); + + while (it.hasNext()) { + QFileInfo artifact_dir(it.next()); + qDebug() << "====== Found artifact:" << artifact_dir.fileName() << "======"; + + QFileInfo cpZip(artifact_dir.absoluteFilePath(), "cp.zip"); + QVERIFY(cpZip.exists()); + + QDir target2(artifact_dir.absoluteFilePath()+"/cp"); + // macos-13_qt6.8.2_sharedON_cp/cp/ + JlCompress::extractDir(cpZip.absoluteFilePath(), target2.absolutePath()); + + QList extractedZipList = target2.entryList(QStringList() << "*.zip", QDir::Files); + QSet extractedZipSet(extractedZipList.begin(), extractedZipList.end()); + + extractedZipSet = extractedZipSet.subtract(zipNames); + QVERIFY(extractedZipSet.isEmpty()); + + for (const QString &zipFile : zipNames) { + qDebug() << "Found ZIP:" << zipFile; + QFileInfo zip(target2, zipFile); + QDir target3(target2.absolutePath()+"/"+zip.completeBaseName()); + // macos-13_qt6.8.2_sharedON_cp/cp/jlsimplefile/ + JlCompress::extractDir(zip.absoluteFilePath(), target3.absolutePath()); + + QList extractedFileList = target3.entryList(QDir::Files); + QSet extractedFileSet(extractedFileList.begin(), extractedFileList.end()); + + extractedFileSet = extractedFileSet.subtract(fileNames); + QVERIFY(extractedFileSet.isEmpty()); + + // Check file content + for (const QString &fileName : extractedFileList) { + qDebug() << "Found File:" << fileName; + + QFile file(target3.absolutePath()+"/"+fileName); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QFAIL("Failed to open file"); + } + + QTextStream in(&file); + QString fileContent = in.readAll(); + file.close(); + + QString expectedContent(""); + QTextStream ss(&expectedContent); + ss << "This is a test file named " << fileName << quazip_endl; + + QVERIFY(fileContent == expectedContent); + } + } + } +} diff --git a/deps/quazip-1.5/qztest/testjlcp_extract.h b/deps/quazip-1.5/qztest/testjlcp_extract.h new file mode 100644 index 000000000000..01c9a4ebf67f --- /dev/null +++ b/deps/quazip-1.5/qztest/testjlcp_extract.h @@ -0,0 +1,36 @@ +#ifndef QUAZIP_TEST_JLCPEXTRACT_H +#define QUAZIP_TEST_JLCPEXTRACT_H + +/* +Copyright (C) 2025 cen1 + +This file is part of QuaZip test suite. + +QuaZip is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 of the License, or +(at your option) any later version. + +QuaZip 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with QuaZip. If not, see . + +See COPYING file for the full LGPL text. + +Original ZIP package is copyrighted by Gilles Vollant and contributors, +see quazip/(un)zip.h files for details. Basically it's the zlib license. +*/ + +#include + +class TestJlCpExtract: public QObject { + Q_OBJECT +private slots: + void extract(); +}; + +#endif // QUAZIP_TEST_JLCPEXTRACT_H diff --git a/deps/quazip-1.3/qztest/testquachecksum32.cpp b/deps/quazip-1.5/qztest/testquachecksum32.cpp similarity index 100% rename from deps/quazip-1.3/qztest/testquachecksum32.cpp rename to deps/quazip-1.5/qztest/testquachecksum32.cpp diff --git a/deps/quazip-1.3/qztest/testquachecksum32.h b/deps/quazip-1.5/qztest/testquachecksum32.h similarity index 100% rename from deps/quazip-1.3/qztest/testquachecksum32.h rename to deps/quazip-1.5/qztest/testquachecksum32.h diff --git a/deps/quazip-1.3/qztest/testquagzipfile.cpp b/deps/quazip-1.5/qztest/testquagzipfile.cpp similarity index 100% rename from deps/quazip-1.3/qztest/testquagzipfile.cpp rename to deps/quazip-1.5/qztest/testquagzipfile.cpp diff --git a/deps/quazip-1.3/qztest/testquagzipfile.h b/deps/quazip-1.5/qztest/testquagzipfile.h similarity index 100% rename from deps/quazip-1.3/qztest/testquagzipfile.h rename to deps/quazip-1.5/qztest/testquagzipfile.h diff --git a/deps/quazip-1.3/qztest/testquaziodevice.cpp b/deps/quazip-1.5/qztest/testquaziodevice.cpp similarity index 100% rename from deps/quazip-1.3/qztest/testquaziodevice.cpp rename to deps/quazip-1.5/qztest/testquaziodevice.cpp diff --git a/deps/quazip-1.3/qztest/testquaziodevice.h b/deps/quazip-1.5/qztest/testquaziodevice.h similarity index 100% rename from deps/quazip-1.3/qztest/testquaziodevice.h rename to deps/quazip-1.5/qztest/testquaziodevice.h diff --git a/deps/quazip-1.3/qztest/testquazip.cpp b/deps/quazip-1.5/qztest/testquazip.cpp similarity index 97% rename from deps/quazip-1.3/qztest/testquazip.cpp rename to deps/quazip-1.5/qztest/testquazip.cpp index e060d6610ec4..c121fe9d35d2 100644 --- a/deps/quazip-1.3/qztest/testquazip.cpp +++ b/deps/quazip-1.5/qztest/testquazip.cpp @@ -87,16 +87,16 @@ void TestQuaZip::getFileList() } QList destList = testZip.getFileInfoList(); QCOMPARE(destList.size(), srcInfo.size()); - for (int i = 0; i < destList.size(); i++) { - QCOMPARE(static_cast(destList[i].uncompressedSize), - srcInfo[destList[i].name].size()); + for (const auto& dest : destList) { + QCOMPARE(static_cast(dest.uncompressedSize), + srcInfo[dest.name].size()); } // Now test zip64 QList destList64 = testZip.getFileInfoList64(); QCOMPARE(destList64.size(), srcInfo.size()); - for (int i = 0; i < destList64.size(); i++) { - QCOMPARE(static_cast(destList64[i].uncompressedSize), - srcInfo[destList64[i].name].size()); + for (const auto& dest : destList64) { + QCOMPARE(static_cast(dest.uncompressedSize), + srcInfo[dest.name].size()); } // test that we didn't mess up the current file QCOMPARE(testZip.getCurrentFileName(), firstFile); @@ -144,7 +144,7 @@ void TestQuaZip::add() QVERIFY(testZip.open(QuaZip::mdAdd)); foreach (QString fileName, fileNamesToAdd) { QuaZipFile testFile(&testZip); - QVERIFY(testFile.open(QIODevice::WriteOnly, + QVERIFY(testFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileName, "tmp/" + fileName))); QFile inFile("tmp/" + fileName); QVERIFY(inFile.open(QIODevice::ReadOnly)); diff --git a/deps/quazip-1.3/qztest/testquazip.h b/deps/quazip-1.5/qztest/testquazip.h similarity index 100% rename from deps/quazip-1.3/qztest/testquazip.h rename to deps/quazip-1.5/qztest/testquazip.h diff --git a/deps/quazip-1.3/qztest/testquazipdir.cpp b/deps/quazip-1.5/qztest/testquazipdir.cpp similarity index 100% rename from deps/quazip-1.3/qztest/testquazipdir.cpp rename to deps/quazip-1.5/qztest/testquazipdir.cpp diff --git a/deps/quazip-1.3/qztest/testquazipdir.h b/deps/quazip-1.5/qztest/testquazipdir.h similarity index 100% rename from deps/quazip-1.3/qztest/testquazipdir.h rename to deps/quazip-1.5/qztest/testquazipdir.h diff --git a/deps/quazip-1.3/qztest/testquazipfile.cpp b/deps/quazip-1.5/qztest/testquazipfile.cpp similarity index 93% rename from deps/quazip-1.3/qztest/testquazipfile.cpp rename to deps/quazip-1.5/qztest/testquazipfile.cpp index 5835862f821c..4ce6b9f85e88 100644 --- a/deps/quazip-1.3/qztest/testquazipfile.cpp +++ b/deps/quazip-1.5/qztest/testquazipfile.cpp @@ -43,33 +43,41 @@ void TestQuaZipFile::zipUnzip_data() QTest::addColumn("fileNames"); QTest::addColumn("fileNameCodec"); QTest::addColumn("password"); + QTest::addColumn("method"); + QTest::addColumn("level"); QTest::addColumn("zip64"); QTest::addColumn("utf8"); QTest::addColumn("size"); QTest::newRow("simple") << "simple.zip" << ( QStringList() << "test0.txt" << "testdir1/test1.txt" << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt") - << QByteArray() << QByteArray() << false << false << -1; + << QByteArray() << QByteArray() << Z_DEFLATED << Z_DEFAULT_COMPRESSION << false << false << -1; + #ifdef HAVE_BZIP2 + QTest::newRow("bzip") << "bzip.zip" << ( + QStringList() << "testb0.txt" << "testdirb/testb.txt" + << "testdir2b/test2b.txt" << "testdir2b/subdir/test2bsub.txt") + << QByteArray() << QByteArray() << Z_BZIP2ED << 9 << false << false << -1; +#endif QTest::newRow("Cyrillic") << "cyrillic.zip" << ( QStringList() << QString::fromUtf8("русское имя файла с пробелами.txt")) - << QByteArray("IBM866") << QByteArray() << false << false << -1; + << QByteArray("IBM866") << QByteArray() << Z_DEFLATED << Z_DEFAULT_COMPRESSION << false << false << -1; QTest::newRow("Unicode") << "unicode.zip" << ( QStringList() << QString::fromUtf8("Українське сало.txt") << QString::fromUtf8("Vin français.txt") << QString::fromUtf8("日本の寿司.txt") << QString::fromUtf8("ქართული ხაჭაპური.txt")) - << QByteArray("") << QByteArray() << false << true << -1; + << QByteArray("") << QByteArray() << Z_DEFLATED << Z_DEFAULT_COMPRESSION << false << true << -1; QTest::newRow("password") << "password.zip" << ( QStringList() << "test.txt") - << QByteArray() << QByteArray("PassPass") << false << false << -1; + << QByteArray() << QByteArray("PassPass") << Z_DEFLATED << Z_DEFAULT_COMPRESSION << false << false << -1; QTest::newRow("zip64") << "zip64.zip" << ( QStringList() << "test64.txt") - << QByteArray() << QByteArray() << true << false << -1; + << QByteArray() << QByteArray() << Z_DEFLATED << Z_DEFAULT_COMPRESSION << true << false << -1; QTest::newRow("large enough to flush") << "flush.zip" << ( QStringList() << "flush.txt") - << QByteArray() << QByteArray() << true << false << 65536 * 2; + << QByteArray() << QByteArray() << Z_DEFLATED << Z_DEFAULT_COMPRESSION << true << false << 65536 * 2; } void TestQuaZipFile::zipUnzip() @@ -78,6 +86,8 @@ void TestQuaZipFile::zipUnzip() QFETCH(QStringList, fileNames); QFETCH(QByteArray, fileNameCodec); QFETCH(QByteArray, password); + QFETCH(int, method); + QFETCH(int, level); QFETCH(bool, zip64); QFETCH(bool, utf8); QFETCH(int, size); @@ -105,9 +115,19 @@ void TestQuaZipFile::zipUnzip() QFAIL("Couldn't open input file"); } QuaZipFile outFile(&testZip); - QVERIFY(outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileName, - inFile.fileName()), - password.isEmpty() ? NULL : password.constData())); + if ( + !outFile.open( + QIODevice::WriteOnly, + QuaZipNewInfo(fileName, inFile.fileName()), + password.isEmpty() ? NULL : password.constData(), + 0, + method, + level + ) + ) { + qDebug("outFile.open() backend error, code %d", outFile.getZipError()); + QFAIL("outFile.open() returned FALSE"); + } for (qint64 pos = 0, len = inFile.size(); pos < len; ) { char buf[4096]; qint64 readSize = qMin(static_cast(4096), len - pos); diff --git a/deps/quazip-1.3/qztest/testquazipfile.h b/deps/quazip-1.5/qztest/testquazipfile.h similarity index 100% rename from deps/quazip-1.3/qztest/testquazipfile.h rename to deps/quazip-1.5/qztest/testquazipfile.h diff --git a/deps/quazip-1.3/qztest/testquazipfileinfo.cpp b/deps/quazip-1.5/qztest/testquazipfileinfo.cpp similarity index 92% rename from deps/quazip-1.3/qztest/testquazipfileinfo.cpp rename to deps/quazip-1.5/qztest/testquazipfileinfo.cpp index 72c92fdc11e1..74701679deaf 100644 --- a/deps/quazip-1.3/qztest/testquazipfileinfo.cpp +++ b/deps/quazip-1.5/qztest/testquazipfileinfo.cpp @@ -20,11 +20,6 @@ Q_DECLARE_METATYPE(QList); Q_DECLARE_METATYPE(QuaExtraFieldHash); #endif -TestQuaZipFileInfo::TestQuaZipFileInfo(QObject *parent) : - QObject(parent) -{ -} - void TestQuaZipFileInfo::getNTFSTime() { QFETCH(QString, zipName); @@ -41,7 +36,7 @@ void TestQuaZipFileInfo::getNTFSTime() if (!createTestFiles(testFiles)) { QFAIL("Can't create test file"); } - QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base(QDate(1601, 1, 1), QTime(0, 0), QTimeZone::utc()); quint64 mTicks, aTicks, cTicks; QFileInfo fileInfo("tmp/test.txt"); { @@ -140,39 +135,39 @@ void TestQuaZipFileInfo::getExtTime_data() QTest::addColumn("expectedAcTime"); QTest::addColumn("expectedCrTime"); QTest::newRow("no times") << QString::fromUtf8("noTimes") - << quint8(0) - << quint16(1) + << static_cast(0) + << static_cast(1) << QList() - << quint16(1) + << static_cast(1) << QList() << QDateTime() << QDateTime() << QDateTime(); QTest::newRow("all times") << QString::fromUtf8("allTimes") - << quint8(7) - << quint16(13) + << static_cast(7) + << static_cast(13) << (QList() << 1 << 2 << 3) - << quint16(5) + << static_cast(5) << (QList() << 1) - << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 1), Qt::UTC) - << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 2), Qt::UTC) - << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 3), Qt::UTC); + << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 1), QTimeZone::utc()) + << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 2), QTimeZone::utc()) + << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 3), QTimeZone::utc()); QTest::newRow("no ac time") << QString::fromUtf8("noAcTime") - << quint8(5) - << quint16(9) + << static_cast(5) + << static_cast(9) << (QList() << 1 << 3) - << quint16(5) + << static_cast(5) << (QList() << 1) - << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 1), Qt::UTC) + << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 1), QTimeZone::utc()) << QDateTime() - << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 3), Qt::UTC); + << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 3), QTimeZone::utc()); QTest::newRow("negativeTime") << QString::fromUtf8("negativeTime") - << quint8(1) - << quint16(5) + << static_cast(1) + << static_cast(5) << (QList() << -1) - << quint16(5) + << static_cast(5) << (QList() << -1) - << QDateTime(QDate(1969, 12, 31), QTime(23, 59, 59), Qt::UTC) + << QDateTime(QDate(1969, 12, 31), QTime(23, 59, 59), QTimeZone::utc()) << QDateTime() << QDateTime(); } @@ -259,7 +254,7 @@ void TestQuaZipFileInfo::getExtTime_issue43() QDateTime actualLocalAcTime = zipFile.getExtAcTime(); QDateTime actualLocalCrTime = zipFile.getExtCrTime(); zip.close(); - QDateTime extModTime(QDate(2019, 7, 2), QTime(15, 43, 47), Qt::UTC); + QDateTime extModTime(QDate(2019, 7, 2), QTime(15, 43, 47), QTimeZone::utc()); QDateTime extAcTime = extModTime; QDateTime extCrTime = extModTime; QCOMPARE(actualGlobalModTime, extModTime); diff --git a/deps/quazip-1.3/qztest/testquazipfileinfo.h b/deps/quazip-1.5/qztest/testquazipfileinfo.h similarity index 86% rename from deps/quazip-1.3/qztest/testquazipfileinfo.h rename to deps/quazip-1.5/qztest/testquazipfileinfo.h index 4874315a5cc7..3fa3dbaa3249 100644 --- a/deps/quazip-1.3/qztest/testquazipfileinfo.h +++ b/deps/quazip-1.5/qztest/testquazipfileinfo.h @@ -5,9 +5,8 @@ class TestQuaZipFileInfo : public QObject { +using QObject::QObject; Q_OBJECT -public: - explicit TestQuaZipFileInfo(QObject *parent = 0); private slots: void getNTFSTime_data(); void getNTFSTime(); diff --git a/deps/quazip-1.3/qztest/testquazipnewinfo.cpp b/deps/quazip-1.5/qztest/testquazipnewinfo.cpp similarity index 97% rename from deps/quazip-1.3/qztest/testquazipnewinfo.cpp rename to deps/quazip-1.5/qztest/testquazipnewinfo.cpp index 1468d6d81dfc..ec5cd759f507 100644 --- a/deps/quazip-1.3/qztest/testquazipnewinfo.cpp +++ b/deps/quazip-1.5/qztest/testquazipnewinfo.cpp @@ -12,11 +12,6 @@ #include #include -TestQuaZipNewInfo::TestQuaZipNewInfo(QObject *parent) : - QObject(parent) -{ -} - void TestQuaZipNewInfo::setFileNTFSTimes() { QString zipName = "newtimes.zip"; @@ -30,7 +25,7 @@ void TestQuaZipNewInfo::setFileNTFSTimes() if (!createTestFiles(testFiles)) { QFAIL("Can't create test file"); } - QDateTime base(QDate(1601, 1, 1), QTime(0, 0), Qt::UTC); + QDateTime base(QDate(1601, 1, 1), QTime(0, 0), QTimeZone::utc()); quint64 mTicks, aTicks, cTicks; { // create diff --git a/deps/quazip-1.3/qztest/testquazipnewinfo.h b/deps/quazip-1.5/qztest/testquazipnewinfo.h similarity index 78% rename from deps/quazip-1.3/qztest/testquazipnewinfo.h rename to deps/quazip-1.5/qztest/testquazipnewinfo.h index 5ccf6332f499..b51a97e4ebf9 100644 --- a/deps/quazip-1.3/qztest/testquazipnewinfo.h +++ b/deps/quazip-1.5/qztest/testquazipnewinfo.h @@ -5,9 +5,8 @@ class TestQuaZipNewInfo : public QObject { +using QObject::QObject; Q_OBJECT -public: - explicit TestQuaZipNewInfo(QObject *parent = 0); private slots: void setFileNTFSTimes(); }; diff --git a/deps/quazip-1.5/vcpkg.json b/deps/quazip-1.5/vcpkg.json new file mode 100644 index 000000000000..f5fc818886f3 --- /dev/null +++ b/deps/quazip-1.5/vcpkg.json @@ -0,0 +1,22 @@ +{ + "version": "1.5", + "name": "quazip", + "dependencies": [ + "zlib", + "bzip2" + ], + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "baseline": "2c401863dd54a640aeb26ed736c55489c079323b", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] + } +} diff --git a/plugins/dot_viewer/src/dot_graphics_view.cpp b/plugins/dot_viewer/src/dot_graphics_view.cpp index 2bfe6a6deaa1..2d4bd07c8d80 100644 --- a/plugins/dot_viewer/src/dot_graphics_view.cpp +++ b/plugins/dot_viewer/src/dot_graphics_view.cpp @@ -11,7 +11,7 @@ namespace hal { void DotGraphicsView::wheelEvent(QWheelEvent* event) { - qreal scaleFactor = qPow(2.0, event->delta() / 240.0); //How fast we zoom + qreal scaleFactor = qPow(2.0, event->angleDelta().y() / 240.0); //How fast we zoom scaleWithinLimits(scaleFactor); } diff --git a/plugins/gui/CMakeLists.txt b/plugins/gui/CMakeLists.txt index a96d8c2603d7..85d451ffa3be 100644 --- a/plugins/gui/CMakeLists.txt +++ b/plugins/gui/CMakeLists.txt @@ -67,7 +67,7 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) endforeach() endforeach() if(USE_VENDORED_QUAZIP) - set (QUAZIP_SUBDIR "${CMAKE_SOURCE_DIR}/deps/quazip-1.3") + set (QUAZIP_SUBDIR "${CMAKE_SOURCE_DIR}/deps/quazip-1.5") add_subdirectory(${QUAZIP_SUBDIR} ${CMAKE_BINARY_DIR}/quazip) message(STATUS "Using quazip from ${QUAZIP_SUBDIR}") else() diff --git a/plugins/gui/src/channel_manager/channel_model.cpp b/plugins/gui/src/channel_manager/channel_model.cpp index 855a46477918..4eeb5423f824 100644 --- a/plugins/gui/src/channel_manager/channel_model.cpp +++ b/plugins/gui/src/channel_manager/channel_model.cpp @@ -42,7 +42,7 @@ namespace hal Qt::ItemFlags ChannelModel::flags(const QModelIndex& index) const { if (!index.isValid()) - return 0; + return Qt::NoItemFlags; return QAbstractItemModel::flags(index); } diff --git a/plugins/gui/src/code_editor/code_editor.cpp b/plugins/gui/src/code_editor/code_editor.cpp index 3ee2267f64f4..dcb256240191 100644 --- a/plugins/gui/src/code_editor/code_editor.cpp +++ b/plugins/gui/src/code_editor/code_editor.cpp @@ -71,7 +71,7 @@ namespace hal QWheelEvent* wheel = static_cast(event); if (wheel->modifiers() == Qt::ControlModifier) { - if (wheel->delta() > 0) + if (wheel->angleDelta().y() > 0) zoomIn(2); else zoomOut(2); diff --git a/plugins/gui/src/comment_system/comment_entry.cpp b/plugins/gui/src/comment_system/comment_entry.cpp index b6ba1703bc19..ac5d5f993a71 100644 --- a/plugins/gui/src/comment_system/comment_entry.cpp +++ b/plugins/gui/src/comment_system/comment_entry.cpp @@ -1,5 +1,6 @@ #include "gui/comment_system/comment_entry.h" #include +#include namespace hal { diff --git a/plugins/gui/src/export/export_project_dialog.cpp b/plugins/gui/src/export/export_project_dialog.cpp index c896dc2402e8..8dc8d54e85ab 100644 --- a/plugins/gui/src/export/export_project_dialog.cpp +++ b/plugins/gui/src/export/export_project_dialog.cpp @@ -9,7 +9,7 @@ #include #include #include -#include // deps/quazip-1.3 +#include // deps/quazip-1.5 #include #include #include From 51fc44d4418048d438847547f17a22fce3fc1e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Thu, 15 Jan 2026 16:12:37 +0100 Subject: [PATCH 03/28] Added QtCompat functions to provide compatibility both with Qt5.15 and Qt6 --- .../expanding_list/expanding_list_button.h | 3 +- .../include/gui/hal_qt_compat/hal_qt_compat.h | 51 +++++++++++++++ .../gui/input_dialog/combobox_dialog.h | 3 +- .../gui/module_dialog/module_select_model.h | 4 +- .../src/code_editor/code_editor_minimap.cpp | 3 +- .../gui/src/code_editor/line_number_area.cpp | 3 +- .../src/comment_system/comment_manager.cpp | 4 +- .../comment_system/widgets/comment_dialog.cpp | 4 +- .../comment_system/widgets/comment_item.cpp | 5 +- .../comment_system/widgets/comment_widget.cpp | 7 +- .../src/content_manager/content_manager.cpp | 1 - .../src/docking_system/splitter_anchor.cpp | 6 +- plugins/gui/src/docking_system/tab_widget.cpp | 6 +- .../expanding_list/expanding_list_button.cpp | 2 +- .../layouters/net_layout_point.cpp | 1 + plugins/gui/src/gui_utils/geometry.cpp | 1 - .../gui/src/hal_qt_compat/hal_qt_compat.cpp | 65 +++++++++++++++++++ plugins/gui/src/main_settings_widget.cpp | 5 +- plugins/gui/src/main_window/main_window.cpp | 1 - .../src/module_dialog/module_select_model.cpp | 11 ++++ plugins/gui/src/module_model/module_model.cpp | 12 ++-- plugins/gui/src/python/python_code_editor.cpp | 1 - plugins/gui/src/python/python_console.cpp | 3 +- .../gui/src/searchbar/searchable_label.cpp | 2 +- .../tree_navigation/selection_tree_view.cpp | 13 ++-- .../src/selection_relay/selection_relay.cpp | 9 --- plugins/gui/src/settings/settings_manager.cpp | 1 - .../src/logic_evaluator_pingroup.cpp | 5 +- .../src/wave_data.cpp | 7 +- 29 files changed, 179 insertions(+), 60 deletions(-) create mode 100644 plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h create mode 100644 plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp diff --git a/plugins/gui/include/gui/expanding_list/expanding_list_button.h b/plugins/gui/include/gui/expanding_list/expanding_list_button.h index e5fcb41640a6..60d4c5480ccf 100644 --- a/plugins/gui/include/gui/expanding_list/expanding_list_button.h +++ b/plugins/gui/include/gui/expanding_list/expanding_list_button.h @@ -26,6 +26,7 @@ #pragma once #include +#include class QHBoxLayout; class QLabel; @@ -65,7 +66,7 @@ namespace hal * * @param event - The associated event. */ - void enterEvent(QEvent* event) override; + void enterEvent(QEnterEvent* event) override; /** * Overwritten qt function that is triggered when the mouse leaves the button. diff --git a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h new file mode 100644 index 000000000000..e41beff777e9 --- /dev/null +++ b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h @@ -0,0 +1,51 @@ +// MIT License +// +// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved. +// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved. +// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved. +// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace hal { + namespace QtCompat { + QRect desktopGeometry(); + + void styleOptionInit(QStyleOption& opt, QWidget* widget); + + void setMarginWidth(QLayout* layout, int marginWidth); + + template extern QSet listToSet(const QList& list); + + template extern QVector listToVector(const QList& list); + + template extern QVector stdVectorToVector(const std::vector& vec); + } +} diff --git a/plugins/gui/include/gui/input_dialog/combobox_dialog.h b/plugins/gui/include/gui/input_dialog/combobox_dialog.h index b61a11c4c0ba..6111efa0bed7 100644 --- a/plugins/gui/include/gui/input_dialog/combobox_dialog.h +++ b/plugins/gui/include/gui/input_dialog/combobox_dialog.h @@ -30,8 +30,7 @@ #include #include #include - -class QStringList; +#include namespace hal { diff --git a/plugins/gui/include/gui/module_dialog/module_select_model.h b/plugins/gui/include/gui/module_dialog/module_select_model.h index 29b9ccebadee..2a81798367a8 100644 --- a/plugins/gui/include/gui/module_dialog/module_select_model.h +++ b/plugins/gui/include/gui/module_dialog/module_select_model.h @@ -84,8 +84,8 @@ namespace hal { * @return selected items as formatted string */ QString selectionToString() const; - QSet modules() const { return QSet::fromList(mModules); } - QSet gates() const { return QSet::fromList(mGates); } + QSet modules() const; + QSet gates() const; }; /** diff --git a/plugins/gui/src/code_editor/code_editor_minimap.cpp b/plugins/gui/src/code_editor/code_editor_minimap.cpp index ef1740eaadc4..215b3ab16d07 100644 --- a/plugins/gui/src/code_editor/code_editor_minimap.cpp +++ b/plugins/gui/src/code_editor/code_editor_minimap.cpp @@ -2,6 +2,7 @@ #include "gui/code_editor/code_editor.h" #include "gui/code_editor/minimap_scrollbar.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -93,7 +94,7 @@ namespace hal Q_UNUSED(event) QStyleOption opt; - opt.init(this); + QtCompat::styleOptionInit(opt,this); QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); diff --git a/plugins/gui/src/code_editor/line_number_area.cpp b/plugins/gui/src/code_editor/line_number_area.cpp index 5b46ad57cbdd..1ada0b601b42 100644 --- a/plugins/gui/src/code_editor/line_number_area.cpp +++ b/plugins/gui/src/code_editor/line_number_area.cpp @@ -1,6 +1,7 @@ #include "gui/code_editor/line_number_area.h" #include "gui/code_editor/code_editor.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -42,7 +43,7 @@ namespace hal void LineNumberArea::paintEvent(QPaintEvent* event) { QStyleOption opt; - opt.init(this); + QtCompat::styleOptionInit(opt,this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); mEditor->lineNumberAreaPaintEvent(event); diff --git a/plugins/gui/src/comment_system/comment_manager.cpp b/plugins/gui/src/comment_system/comment_manager.cpp index 965269fe41b0..c5371556e315 100644 --- a/plugins/gui/src/comment_system/comment_manager.cpp +++ b/plugins/gui/src/comment_system/comment_manager.cpp @@ -84,7 +84,7 @@ namespace hal delete comEntry; continue; } - mEntries.insertMulti(comEntry->getNode(),comEntry); + mEntries.insert(comEntry->getNode(),comEntry); } } @@ -136,7 +136,7 @@ namespace hal for(const auto &item : mEntries.values(entry->getNode())) if(item == entry) return; - mEntries.insertMulti(entry->getNode(), entry); + mEntries.insert(entry->getNode(), entry); Q_EMIT entryAdded(entry); } diff --git a/plugins/gui/src/comment_system/widgets/comment_dialog.cpp b/plugins/gui/src/comment_system/widgets/comment_dialog.cpp index 6293b286343c..b5e2e0e0dad2 100644 --- a/plugins/gui/src/comment_system/widgets/comment_dialog.cpp +++ b/plugins/gui/src/comment_system/widgets/comment_dialog.cpp @@ -278,9 +278,7 @@ namespace hal void CommentDialog::codeTriggered() { QTextCharFormat fmt; - //mTextEdit->palette().color(QPalette::Background) - //fmt.setBackground(mCodeAction->isChecked() ? QColor("#334652") : mTextEdit->palette().color(QPalette::Background)); //dependent on background - fmt.setBackground(mCodeAction->isChecked() ? mTextEdit->palette().color(QPalette::AlternateBase) : mTextEdit->palette().color(QPalette::Background)); + fmt.setBackground(mCodeAction->isChecked() ? mTextEdit->palette().color(QPalette::AlternateBase) : mTextEdit->palette().color(QPalette::Window)); fmt.setFont(mCodeAction->isChecked() ? QFontDatabase::systemFont(QFontDatabase::FixedFont) : mDefaultFont); mergeFormatOnWordOrSelection(fmt); } diff --git a/plugins/gui/src/comment_system/widgets/comment_item.cpp b/plugins/gui/src/comment_system/widgets/comment_item.cpp index 0920dac73be6..ad280f1e6103 100644 --- a/plugins/gui/src/comment_system/widgets/comment_item.cpp +++ b/plugins/gui/src/comment_system/widgets/comment_item.cpp @@ -3,6 +3,7 @@ #include "gui/comment_system/widgets/comment_dialog.h" #include "gui/searchbar/searchable_label.h" #include "gui/gui_globals.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -125,14 +126,14 @@ namespace hal // TODO: replace fixed sizes (put them in stylesheet / compute them?) mLayout = new QVBoxLayout(this); mLayout->setSpacing(0); - mLayout->setMargin(0); + QtCompat::setMarginWidth(mLayout,0); // top part mTopWidget = new QWidget(this); mTopWidget->setFixedHeight(iconSize.height()+5); // just some spacing mTopLayout = new QHBoxLayout(mTopWidget); mTopLayout->setSpacing(0); - mTopLayout->setMargin(0); + QtCompat::setMarginWidth(mTopLayout,0); mHeader = new SearchableLabel(this); mHeader->setStyleSheet("font-weight: bold;"); diff --git a/plugins/gui/src/comment_system/widgets/comment_widget.cpp b/plugins/gui/src/comment_system/widgets/comment_widget.cpp index 7a2b2be42256..c562a7a90be2 100644 --- a/plugins/gui/src/comment_system/widgets/comment_widget.cpp +++ b/plugins/gui/src/comment_system/widgets/comment_widget.cpp @@ -3,6 +3,7 @@ #include "gui/comment_system/comment_entry.h" #include "gui/comment_system/widgets/comment_item.h" #include "gui/comment_system/widgets/comment_dialog.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include #include @@ -27,7 +28,7 @@ namespace hal //mTopLayout = new QVBoxLayout(this); mTopLayout = new QGridLayout(this); - mTopLayout->setMargin(0); + QtCompat::setMarginWidth(mTopLayout,0); mTopLayout->setSpacing(0); mSearchbar = new Searchbar(); mSearchbar->setEmitTextWithFlags(false); @@ -55,7 +56,7 @@ namespace hal // comment part mCommentsLayout = new QVBoxLayout(); mCommentsLayout->setSpacing(0); - mCommentsLayout->setMargin(0); + QtCompat::setMarginWidth(mCommentsLayout,0); mScrollArea = new QScrollArea(); mScrollArea->setWidgetResizable(true);//important as it seems so that the child widget will expandd if possible mCommentsContainer = new QWidget(); @@ -102,7 +103,7 @@ namespace hal QWidget* container = new QWidget(); QVBoxLayout* containerLayout = new QVBoxLayout(container); containerLayout->setSpacing(0); - containerLayout->setMargin(0); + QtCompat::setMarginWidth(containerLayout,0); auto commentList = gCommentManager->getEntriesForNode(nd); diff --git a/plugins/gui/src/content_manager/content_manager.cpp b/plugins/gui/src/content_manager/content_manager.cpp index 386beafa49bd..de2cf8c34d5e 100644 --- a/plugins/gui/src/content_manager/content_manager.cpp +++ b/plugins/gui/src/content_manager/content_manager.cpp @@ -36,7 +36,6 @@ */ #include #include -#include namespace hal { diff --git a/plugins/gui/src/docking_system/splitter_anchor.cpp b/plugins/gui/src/docking_system/splitter_anchor.cpp index 1a5ea174c998..ff820de3ccaa 100644 --- a/plugins/gui/src/docking_system/splitter_anchor.cpp +++ b/plugins/gui/src/docking_system/splitter_anchor.cpp @@ -1,11 +1,11 @@ -#include "gui/docking_system/splitter_anchor.h" #include "gui/content_frame/content_frame.h" #include "gui/content_widget/content_widget.h" #include "gui/docking_system/content_drag_relay.h" #include "gui/docking_system/dock_bar.h" +#include "gui/docking_system/splitter_anchor.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/splitter/splitter.h" #include -#include #include namespace hal @@ -51,7 +51,7 @@ namespace hal widget->hide(); widget->setParent(nullptr); ContentFrame* frame = new ContentFrame(widget, false, nullptr); - frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), qApp->desktop()->availableGeometry())); + frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopGeometry())); frame->show(); if (mSplitter->unused()) diff --git a/plugins/gui/src/docking_system/tab_widget.cpp b/plugins/gui/src/docking_system/tab_widget.cpp index 542a6e4addd2..170c66bfab2d 100644 --- a/plugins/gui/src/docking_system/tab_widget.cpp +++ b/plugins/gui/src/docking_system/tab_widget.cpp @@ -1,10 +1,10 @@ +#include "gui/docking_system/content_drag_relay.h" #include "gui/docking_system/tab_widget.h" #include "gui/content_frame/content_frame.h" #include "gui/content_widget/content_widget.h" -#include "gui/docking_system/content_drag_relay.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include -#include #include #include @@ -91,7 +91,7 @@ namespace hal { mDockBar->detachButton(widget); ContentFrame* frame = new ContentFrame(widget, false, nullptr); - frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), qApp->desktop()->availableGeometry())); + frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopGeometry())); frame->show(); if (widget == mCurrentWidget) diff --git a/plugins/gui/src/expanding_list/expanding_list_button.cpp b/plugins/gui/src/expanding_list/expanding_list_button.cpp index ba4d49ee2663..42a63110c339 100644 --- a/plugins/gui/src/expanding_list/expanding_list_button.cpp +++ b/plugins/gui/src/expanding_list/expanding_list_button.cpp @@ -60,7 +60,7 @@ namespace hal return retval; } - void ExpandingListButton::enterEvent(QEvent* event) + void ExpandingListButton::enterEvent(QEnterEvent *event) { Q_UNUSED(event) diff --git a/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp b/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp index 4d4e04786998..def1284b3115 100644 --- a/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp +++ b/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp @@ -8,6 +8,7 @@ #include #include #include +#include QPointF scenePoint(const QPoint& p) { diff --git a/plugins/gui/src/gui_utils/geometry.cpp b/plugins/gui/src/gui_utils/geometry.cpp index 1520f3b7f679..69d3c290bfe4 100644 --- a/plugins/gui/src/gui_utils/geometry.cpp +++ b/plugins/gui/src/gui_utils/geometry.cpp @@ -1,7 +1,6 @@ #include "gui/gui_utils/geometry.h" #include -#include #include namespace hal diff --git a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp new file mode 100644 index 000000000000..aed5dd907a3e --- /dev/null +++ b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp @@ -0,0 +1,65 @@ +#include "gui/hal_qt_compat/hal_qt_compat.h" +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#include +#else +#include +#endif +namespace hal { + + QRect QtCompat::desktopGeometry() + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QGuiApplication::primaryScreen()->availableGeometry(); +#else + return qApp->desktop()->availableGeometry(); +#endif + } + + template + QSet QtCompat::listToSet(const QList& list) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QSet(list.constBegin(),list.constEnd()); +#else + return QSet::fromList(list); +#endif + } + + template + QVector QtCompat::listToVector(const QList& list) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QVector(list.constBegin(),list.constEnd()); +#else + return QVector::fromList(list); +#endif + } + + template extern QVector QtCompat::stdVectorToVector(const std::vector& vec) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QVector(vec.begin(),vec.end()); +#else + return QVector::fromStdVector(vec); +#endif + } + + void QtCompat::setMarginWidth(QLayout* layout, int marginWidth) + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + layout->setContentsMargins(marginWidth, marginWidth, marginWidth, marginWidth); +#else + layout->setMargin(marginWith); +#endif + } + + void QtCompat::styleOptionInit(QStyleOption& opt, QWidget* widget) + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + opt.initFrom(widget); +#else + opt.init(widget); +#endif + } +} diff --git a/plugins/gui/src/main_settings_widget.cpp b/plugins/gui/src/main_settings_widget.cpp index ec9fc4fa97b5..ffa1d8128773 100644 --- a/plugins/gui/src/main_settings_widget.cpp +++ b/plugins/gui/src/main_settings_widget.cpp @@ -5,6 +5,7 @@ #include "gui/expanding_list/expanding_list_button.h" #include "gui/expanding_list/expanding_list_widget.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/gui_globals.h" //#include "checkbox_setting.h" //#include "dropdown_setting.h" @@ -170,8 +171,8 @@ namespace hal void MainSettingsWidget::initWidgets() { AssignedKeybindMap::instance()->initMap(); - QSet registeredItems = QSet::fromList(mSettingsList.getItems()); - QSet registeredCategories = QSet::fromList(mSectionNames.values()); + QSet registeredItems = QtCompat::listToSet(mSettingsList.getItems()); + QSet registeredCategories = QtCompat::listToSet(mSectionNames.values()); for (SettingsItem* si : SettingsManager::instance()->mSettingsList) { if (registeredItems.contains(si)) diff --git a/plugins/gui/src/main_window/main_window.cpp b/plugins/gui/src/main_window/main_window.cpp index ba51009ee72e..c4b0289e48d9 100644 --- a/plugins/gui/src/main_window/main_window.cpp +++ b/plugins/gui/src/main_window/main_window.cpp @@ -41,7 +41,6 @@ #include #include -#include #include #include #include diff --git a/plugins/gui/src/module_dialog/module_select_model.cpp b/plugins/gui/src/module_dialog/module_select_model.cpp index 299c3d7c74b6..6970a33fae44 100644 --- a/plugins/gui/src/module_dialog/module_select_model.cpp +++ b/plugins/gui/src/module_dialog/module_select_model.cpp @@ -2,6 +2,7 @@ #include "gui/content_manager/content_manager.h" #include "gui/graph_tab_widget/graph_tab_widget.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/gui_globals.h" #include "gui/gui_utils/graphics.h" #include "gui/module_dialog/module_dialog.h" @@ -244,6 +245,16 @@ namespace hal } } return retval; + } + + QSet ModuleSelectExclude::modules() const + { + return QtCompat::listToSet(mModules); + } + + QSet ModuleSelectExclude::gates() const + { + return QtCompat::listToSet(mGates); } //---------------- PICKER ----------------------------------------- diff --git a/plugins/gui/src/module_model/module_model.cpp b/plugins/gui/src/module_model/module_model.cpp index 3eb26fd427c9..012fef5e6761 100644 --- a/plugins/gui/src/module_model/module_model.cpp +++ b/plugins/gui/src/module_model/module_model.cpp @@ -1,13 +1,14 @@ #include "gui/module_model/module_model.h" #include "gui/gui_globals.h" - +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/selection_details_widget/selection_details_icon_provider.h" #include "gui/python/py_code_provider.h" #include "hal_core/netlist/gate.h" #include "hal_core/netlist/net.h" #include +#include namespace hal { @@ -137,7 +138,7 @@ namespace hal Qt::ItemFlags ModuleModel::flags(const QModelIndex& index) const { if (!index.isValid()) - return 0; + return Qt::NoItemFlags; return QAbstractItemModel::flags(index) | Qt::ItemIsDragEnabled; } @@ -625,12 +626,7 @@ namespace hal QSet netsToAssign; if (gateIds.isEmpty()) { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - QList tempKeys = parentAssignment.keys(); - netsToAssign = QSet(tempKeys.begin(),tempKeys.end()); -#else - netsToAssign = parentAssignment.keys().toSet(); -#endif + netsToAssign = QtCompat::listToSet(parentAssignment.keys()); } else { diff --git a/plugins/gui/src/python/python_code_editor.cpp b/plugins/gui/src/python/python_code_editor.cpp index dac44631ce1c..ed1ab858de93 100644 --- a/plugins/gui/src/python/python_code_editor.cpp +++ b/plugins/gui/src/python/python_code_editor.cpp @@ -7,7 +7,6 @@ #include "gui/gui_globals.h" #include -#include #include #include #include diff --git a/plugins/gui/src/python/python_console.cpp b/plugins/gui/src/python/python_console.cpp index e6f6a7f7930c..dea4cb3f166f 100644 --- a/plugins/gui/src/python/python_console.cpp +++ b/plugins/gui/src/python/python_console.cpp @@ -2,6 +2,7 @@ #include "hal_core/utilities/log.h" #include "gui/gui_globals.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -474,7 +475,7 @@ namespace hal setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); setLineWidth(2); QHBoxLayout* layout = new QHBoxLayout(this); - layout->setMargin(2); + QtCompat::setMarginWidth(layout,2); mLabel = new QLabel(this); layout->addWidget(mLabel); mAbortButton = new QPushButton("Abort", this); diff --git a/plugins/gui/src/searchbar/searchable_label.cpp b/plugins/gui/src/searchbar/searchable_label.cpp index 80ba287282ef..c10f1c01b1d0 100644 --- a/plugins/gui/src/searchbar/searchable_label.cpp +++ b/plugins/gui/src/searchbar/searchable_label.cpp @@ -41,7 +41,7 @@ namespace hal { else yText = 0; if (autoFillBackground()) - painter.fillRect(rect(),palette().color(QPalette::Background)); + painter.fillRect(rect(),palette().color(QPalette::Window)); int p0 = 0; for (QPair p1 : mMatchPositions) { diff --git a/plugins/gui/src/selection_details_widget/tree_navigation/selection_tree_view.cpp b/plugins/gui/src/selection_details_widget/tree_navigation/selection_tree_view.cpp index 3ad887766977..5b7fec88389a 100644 --- a/plugins/gui/src/selection_details_widget/tree_navigation/selection_tree_view.cpp +++ b/plugins/gui/src/selection_details_widget/tree_navigation/selection_tree_view.cpp @@ -2,6 +2,7 @@ #include "gui/graph_widget/contexts/graph_context.h" #include "gui/graph_tab_widget/graph_tab_widget.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/gui_globals.h" #include "gui/context_manager_widget/context_manager_widget.h" #include "gui/module_context_menu/module_context_menu.h" @@ -132,9 +133,9 @@ namespace hal { if(mVisible) { - QVector modIds = QVector::fromList(gSelectionRelay->selectedModulesList()); - QVector gateIds = QVector::fromList(gSelectionRelay->selectedGatesList()); - QVector netIds = QVector::fromList(gSelectionRelay->selectedNetsList()); + QVector modIds = QtCompat::listToVector(gSelectionRelay->selectedModulesList()); + QVector gateIds = QtCompat::listToVector(gSelectionRelay->selectedGatesList()); + QVector netIds = QtCompat::listToVector(gSelectionRelay->selectedNetsList()); treeModel->populateTree(modIds, gateIds, netIds); } else treeModel->clear(); @@ -142,9 +143,9 @@ namespace hal else { Grouping* grouping = gNetlist->get_grouping_by_id(groupingId); - QVector modIds = QVector::fromStdVector(grouping->get_module_ids()); - QVector gateIds = QVector::fromStdVector(grouping->get_gate_ids()); - QVector netIds = QVector::fromStdVector(grouping->get_net_ids()); + QVector modIds = QtCompat::stdVectorToVector(grouping->get_module_ids()); + QVector gateIds = QtCompat::stdVectorToVector(grouping->get_gate_ids()); + QVector netIds = QtCompat::stdVectorToVector(grouping->get_net_ids()); treeModel->populateTree(modIds, gateIds, netIds); } diff --git a/plugins/gui/src/selection_relay/selection_relay.cpp b/plugins/gui/src/selection_relay/selection_relay.cpp index 91a0072bf55f..4072b908856f 100644 --- a/plugins/gui/src/selection_relay/selection_relay.cpp +++ b/plugins/gui/src/selection_relay/selection_relay.cpp @@ -375,15 +375,6 @@ namespace hal relaySubfocusChanged(nullptr); } - /*void SelectionRelay::suppressedByFilter(const QList& modIds, const QList& gatIds, const QList& netIds) - { - initializeAction(); - mModulesSuppressedByFilter = modIds.toSet(); - mGatesSuppressedByFilter = gatIds.toSet(); - mNetsSuppressedByFilter = netIds.toSet(); - executeAction(); - }*/ - bool SelectionRelay::isModuleSelected(u32 id) const { return mSelectedModules.contains(id) && !mModulesSuppressedByFilter.contains(id); diff --git a/plugins/gui/src/settings/settings_manager.cpp b/plugins/gui/src/settings/settings_manager.cpp index f7709e083b8e..2dd0cf88dd5a 100644 --- a/plugins/gui/src/settings/settings_manager.cpp +++ b/plugins/gui/src/settings/settings_manager.cpp @@ -5,7 +5,6 @@ #include "gui/content_manager/content_manager.h" #include #include -#include #include namespace hal diff --git a/plugins/logic_evaluator/src/logic_evaluator_pingroup.cpp b/plugins/logic_evaluator/src/logic_evaluator_pingroup.cpp index 618e7c039ce0..69a39239100d 100644 --- a/plugins/logic_evaluator/src/logic_evaluator_pingroup.cpp +++ b/plugins/logic_evaluator/src/logic_evaluator_pingroup.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "hal_core/netlist/net.h" namespace hal { @@ -38,7 +39,7 @@ namespace hal { : QWidget(parent), mLabel(nullptr), mSpinBox(nullptr) { QVBoxLayout* layout = new QVBoxLayout(this); - layout->setMargin(0); + QtCompat::setMarginWidth(layout,0); if (nbits > 1) { mSpinBox = new LogicEvaluatorHexSpinbox(this); @@ -115,7 +116,7 @@ namespace hal { topLayout->setContentsMargins(mOutput?0:8,4,mOutput?8:0,4); QVBoxLayout* valLayout = new QVBoxLayout; valLayout->setSpacing(4); - valLayout->setMargin(0); + QtCompat::setMarginWidth(valLayout,0); if (!grpName.isEmpty()) { diff --git a/plugins/simulator/netlist_simulator_controller/src/wave_data.cpp b/plugins/simulator/netlist_simulator_controller/src/wave_data.cpp index 7ad36f5b2781..2ffdf7764a44 100644 --- a/plugins/simulator/netlist_simulator_controller/src/wave_data.cpp +++ b/plugins/simulator/netlist_simulator_controller/src/wave_data.cpp @@ -1725,8 +1725,11 @@ namespace hal { QSet WaveDataList::toSet() const { QList keyList = mIds.keys(); - return keyList.toSet(); - // return QSet(keyList.begin(),keyList.end()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QSet(keyList.constBegin(),keyList.constEnd()); +#else + return QSet::fromList(keyList); +#endif } void WaveDataList::remove(u32 id) From 5268310ce22ad35fd2279a97a3f7aefc9a0d88fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Fri, 16 Jan 2026 01:09:09 +0100 Subject: [PATCH 04/28] More fixes, mostly type related --- .../gui/graph_widget/layouters/net_layout_point.h | 1 + .../gui/include/gui/hal_qt_compat/hal_qt_compat.h | 2 ++ plugins/gui/include/gui/main_window/file_actions.h | 2 +- .../include/gui/welcome_screen/get_in_touch_item.h | 2 +- .../include/gui/welcome_screen/recent_file_item.h | 2 +- plugins/gui/src/code_editor/code_editor.cpp | 2 +- plugins/gui/src/docking_system/dock_button.cpp | 2 +- .../items/nets/labeled_separated_net.cpp | 2 +- .../items/nodes/gates/standard_graphics_gate.cpp | 4 ++-- .../src/graph_widget/items/nodes/graphics_node.cpp | 6 +++--- .../items/nodes/modules/standard_graphics_module.cpp | 4 ++-- .../items/utility_items/node_drag_shadow.cpp | 2 +- .../src/graph_widget/layouters/graph_layouter.cpp | 5 ++++- .../src/graph_widget/layouters/wait_to_be_seated.cpp | 1 + plugins/gui/src/grouping/grouping_manager_widget.cpp | 9 +++++---- plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp | 10 ++++++++++ plugins/gui/src/main_window/file_actions.cpp | 1 - .../src/user_action/action_add_boolean_function.cpp | 4 ++-- .../src/user_action/action_add_items_to_object.cpp | 12 ++++++------ plugins/gui/src/user_action/action_create_object.cpp | 6 +++--- plugins/gui/src/user_action/action_move_item.cpp | 4 ++-- plugins/gui/src/user_action/action_move_node.cpp | 2 +- .../gui/src/user_action/action_open_netlist_file.cpp | 4 ++-- plugins/gui/src/user_action/action_pingroup.cpp | 8 ++++---- .../user_action/action_remove_items_from_object.cpp | 8 ++++---- plugins/gui/src/user_action/action_rename_object.cpp | 2 +- .../gui/src/user_action/action_set_object_color.cpp | 2 +- .../gui/src/user_action/action_set_object_data.cpp | 12 ++++++------ .../gui/src/user_action/action_set_object_type.cpp | 2 +- .../src/user_action/action_set_selection_focus.cpp | 6 +++--- plugins/gui/src/user_action/user_action.cpp | 2 +- plugins/gui/src/user_action/user_action_compound.cpp | 6 +++--- plugins/gui/src/user_action/user_action_manager.cpp | 4 ++-- plugins/gui/src/welcome_screen/get_in_touch_item.cpp | 3 ++- plugins/gui/src/welcome_screen/recent_file_item.cpp | 3 ++- .../simulator/waveform_viewer/src/boolean_dialog.cpp | 3 ++- 36 files changed, 85 insertions(+), 65 deletions(-) diff --git a/plugins/gui/include/gui/graph_widget/layouters/net_layout_point.h b/plugins/gui/include/gui/graph_widget/layouters/net_layout_point.h index 1bb0eaaa8dd2..9513948ac0db 100644 --- a/plugins/gui/include/gui/graph_widget/layouters/net_layout_point.h +++ b/plugins/gui/include/gui/graph_widget/layouters/net_layout_point.h @@ -31,6 +31,7 @@ #include #include #include +#include class QGraphicsEllipseItem; class QGraphicsLineItem; diff --git a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h index e41beff777e9..a583a692d12c 100644 --- a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h +++ b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h @@ -44,6 +44,8 @@ namespace hal { template extern QSet listToSet(const QList& list); + template extern QList setToList(const QSet& cset); + template extern QVector listToVector(const QList& list); template extern QVector stdVectorToVector(const std::vector& vec); diff --git a/plugins/gui/include/gui/main_window/file_actions.h b/plugins/gui/include/gui/main_window/file_actions.h index cf20ba0b2b5f..5b5f731f841d 100644 --- a/plugins/gui/include/gui/main_window/file_actions.h +++ b/plugins/gui/include/gui/main_window/file_actions.h @@ -26,7 +26,7 @@ #pragma once #include "gui/action/action.h" #include - +#include namespace hal { class MainWindow; diff --git a/plugins/gui/include/gui/welcome_screen/get_in_touch_item.h b/plugins/gui/include/gui/welcome_screen/get_in_touch_item.h index c0092d48794f..b6ee71ca7b07 100644 --- a/plugins/gui/include/gui/welcome_screen/get_in_touch_item.h +++ b/plugins/gui/include/gui/welcome_screen/get_in_touch_item.h @@ -62,7 +62,7 @@ namespace hal * * @param event - The event */ - void enterEvent(QEvent* event) override; + void enterEvent(QEnterEvent *event) override; /** * Handles the event, that the mouse leaves the widget. diff --git a/plugins/gui/include/gui/welcome_screen/recent_file_item.h b/plugins/gui/include/gui/welcome_screen/recent_file_item.h index 41e49e847eab..0b8c3113eeef 100644 --- a/plugins/gui/include/gui/welcome_screen/recent_file_item.h +++ b/plugins/gui/include/gui/welcome_screen/recent_file_item.h @@ -66,7 +66,7 @@ namespace hal * * @param event - The QEvent */ - void enterEvent(QEvent* event) override; + void enterEvent(QEnterEvent *event) override; /** * Handles that the mouse leaves the widget. diff --git a/plugins/gui/src/code_editor/code_editor.cpp b/plugins/gui/src/code_editor/code_editor.cpp index dcb256240191..9479bbab8bec 100644 --- a/plugins/gui/src/code_editor/code_editor.cpp +++ b/plugins/gui/src/code_editor/code_editor.cpp @@ -122,7 +122,7 @@ namespace hal { // WARNING FUNCTION ONLY RETURNS CORRECT VALUES FOR MONOSPACE FONTS ! QFontMetrics fm(mLineNumberFont); - return mLineNumberArea->leftOffset() + fm.width(QString::number(blockCount())) + mLineNumberArea->rightOffset(); + return mLineNumberArea->leftOffset() + fm.horizontalAdvance(QString::number(blockCount())) + mLineNumberArea->rightOffset(); } int CodeEditor::minimapWidth() diff --git a/plugins/gui/src/docking_system/dock_button.cpp b/plugins/gui/src/docking_system/dock_button.cpp index f64a445a681b..40e18acdf221 100644 --- a/plugins/gui/src/docking_system/dock_button.cpp +++ b/plugins/gui/src/docking_system/dock_button.cpp @@ -95,7 +95,7 @@ namespace hal auto font = property("font").value(); //, QFont::PreferAntialias); QFontMetrics fm(font); - int textwidth = fm.width(text()); + int textwidth = fm.horizontalAdvance(text()); mRelativeWidth = mIconSize + textwidth + mWidthPadding; if (mOrientation == button_orientation::horizontal) diff --git a/plugins/gui/src/graph_widget/items/nets/labeled_separated_net.cpp b/plugins/gui/src/graph_widget/items/nets/labeled_separated_net.cpp index b1edadd74f0a..3ba84a174120 100644 --- a/plugins/gui/src/graph_widget/items/nets/labeled_separated_net.cpp +++ b/plugins/gui/src/graph_widget/items/nets/labeled_separated_net.cpp @@ -36,7 +36,7 @@ namespace hal if (ipos >= 0) mText = mText.mid(ipos+1); QFontMetricsF fm(sFont); - mTextWidth = fm.width(mText); + mTextWidth = fm.horizontalAdvance(mText); } void LabeledSeparatedNet::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) diff --git a/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp b/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp index 24dbfdf2f58b..0083e299f7f4 100644 --- a/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp +++ b/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp @@ -301,14 +301,14 @@ void StandardGraphicsGate::format(const bool& adjust_size_to_grid) for (const QString& input_pin : mInputPins) { - qreal width = pin_fm.width(input_pin); + qreal width = pin_fm.horizontalAdvance(input_pin); if (width > max_pin_width) max_pin_width = width; } for (const QString& output_pin : mOutputPins) { - qreal width = pin_fm.width(output_pin); + qreal width = pin_fm.horizontalAdvance(output_pin); if (width > max_pin_width) max_pin_width = width; } diff --git a/plugins/gui/src/graph_widget/items/nodes/graphics_node.cpp b/plugins/gui/src/graph_widget/items/nodes/graphics_node.cpp index 7022b1728b6d..5b29fb5d501c 100644 --- a/plugins/gui/src/graph_widget/items/nodes/graphics_node.cpp +++ b/plugins/gui/src/graph_widget/items/nodes/graphics_node.cpp @@ -41,7 +41,7 @@ namespace hal if (lines[iline].isEmpty()) continue; QFontMetricsF fmf(sTextFont[iline]); mNodeText[iline] = lines[iline]; - qreal textWidth = fmf.width(mNodeText[iline]); + qreal textWidth = fmf.horizontalAdvance(mNodeText[iline]); if (init) { if (textWidth > mMaxTextWidth) @@ -55,7 +55,7 @@ namespace hal while (!mNodeText[iline].isEmpty() && textWidth > mMaxTextWidth) { shorter.chop(1); - textWidth = fmf.width(shorter + "…"); + textWidth = fmf.horizontalAdvance(shorter + "…"); } mNodeText[iline] = shorter + "…"; } @@ -69,7 +69,7 @@ namespace hal for (int iline=0; iline<3; iline++) { QFontMetricsF fmf(sTextFont[iline]); - qreal textWidth = fmf.width(mNodeText[iline]); + qreal textWidth = fmf.horizontalAdvance(mNodeText[iline]); y0 += sTextFontHeight[iline]; mTextPosition[iline].setX(mWidth / 2 - textWidth / 2); mTextPosition[iline].setY(y0); diff --git a/plugins/gui/src/graph_widget/items/nodes/modules/standard_graphics_module.cpp b/plugins/gui/src/graph_widget/items/nodes/modules/standard_graphics_module.cpp index cd5291bb6b10..c2436ee4d45b 100644 --- a/plugins/gui/src/graph_widget/items/nodes/modules/standard_graphics_module.cpp +++ b/plugins/gui/src/graph_widget/items/nodes/modules/standard_graphics_module.cpp @@ -234,14 +234,14 @@ namespace hal for (const ModulePin& input_pin : mInputPins) { - qreal width = pin_fm.width(input_pin.name); + qreal width = pin_fm.horizontalAdvance(input_pin.name); if (width > max_pin_width) max_pin_width = width; } for (const ModulePin& output_pin : mOutputPins) { - qreal width = pin_fm.width(output_pin.name); + qreal width = pin_fm.horizontalAdvance(output_pin.name); if (width > max_pin_width) max_pin_width = width; } diff --git a/plugins/gui/src/graph_widget/items/utility_items/node_drag_shadow.cpp b/plugins/gui/src/graph_widget/items/utility_items/node_drag_shadow.cpp index 63ec05fa826b..fda9f71ed320 100644 --- a/plugins/gui/src/graph_widget/items/utility_items/node_drag_shadow.cpp +++ b/plugins/gui/src/graph_widget/items/utility_items/node_drag_shadow.cpp @@ -40,7 +40,7 @@ namespace hal NodeDragShadow::NodeDragShadow() : QGraphicsItem(), mRect(0,0,100,100) { - setAcceptedMouseButtons(0); + setAcceptedMouseButtons(Qt::NoButton); } void NodeDragShadow::start(const QPointF& posF, const QSizeF& sizeF) diff --git a/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp b/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp index d2bb0655e3a3..90d29284e11d 100644 --- a/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp +++ b/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp @@ -8,6 +8,7 @@ #include "gui/graph_widget/items/nets/standard_graphics_net.h" #include "gui/gui_def.h" #include "gui/gui_globals.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/implementations/qpoint_extension.h" #include "gui/selection_details_widget/selection_details_widget.h" #include "gui/comment_system/comment_entry.h" @@ -19,6 +20,7 @@ #include #include #include +#include #include namespace hal @@ -553,7 +555,8 @@ namespace hal case EndpointList::SourceAndDestination: case EndpointList::HasGlobalEndpoint: { - NetLayoutConnectionFactory nlcf(srcPoints.toList(), dstPoints.toList()); + NetLayoutConnectionFactory nlcf(QtCompat::setToList(srcPoints), + QtCompat::setToList(dstPoints)); // nlcf.dump(QString("wire %1").arg(id)); mConnectionMetric.insert(NetLayoutMetric(id, nlcf.connection), nlcf.connection); } diff --git a/plugins/gui/src/graph_widget/layouters/wait_to_be_seated.cpp b/plugins/gui/src/graph_widget/layouters/wait_to_be_seated.cpp index 0e9072f4b145..a531db031cc6 100644 --- a/plugins/gui/src/graph_widget/layouters/wait_to_be_seated.cpp +++ b/plugins/gui/src/graph_widget/layouters/wait_to_be_seated.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace hal { diff --git a/plugins/gui/src/grouping/grouping_manager_widget.cpp b/plugins/gui/src/grouping/grouping_manager_widget.cpp index beba0987cb59..ea441ea2df9c 100644 --- a/plugins/gui/src/grouping/grouping_manager_widget.cpp +++ b/plugins/gui/src/grouping/grouping_manager_widget.cpp @@ -7,6 +7,7 @@ #include "gui/gui_def.h" #include "gui/gui_globals.h" #include "gui/gui_utils/graphics.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/input_dialog/input_dialog.h" #include "gui/searchbar/searchbar.h" #include "gui/toolbar/toolbar.h" @@ -324,7 +325,7 @@ namespace hal QVector todoNet; QSet handledBox; QSet handledNet; - todoNet.append(QVector::fromStdVector(succ ? tbn.outputNets() : tbn.inputNets())); + todoNet.append(QtCompat::stdVectorToVector(succ ? tbn.outputNets() : tbn.inputNets())); handledBox.insert(tbn.mNode); for (int loop = 0; !maxDepth || loop < maxDepth; loop++) { @@ -354,7 +355,7 @@ namespace hal default: continue; } - nextRound.append(QVector::fromStdVector(succ ? nextNode.outputNets() : nextNode.inputNets())); + nextRound.append(QtCompat::stdVectorToVector(succ ? nextNode.outputNets() : nextNode.inputNets())); } } todoNet = nextRound; @@ -387,7 +388,7 @@ namespace hal QVector nextDst; QSet handledNode; QSet handledNet; - nextDst.append(QVector::fromStdVector(succ ? tbn.outputNets() : tbn.inputNets())); + nextDst.append(QtCompat::stdVectorToVector(succ ? tbn.outputNets() : tbn.inputNets())); handledNode.insert(tbn.mNode); for (int iround = 1; iround <= maxDepth; iround++) { @@ -419,7 +420,7 @@ namespace hal default: continue; } - nextDst.append(QVector::fromStdVector(succ ? nextNode.outputNets() : nextNode.inputNets())); + nextDst.append(QtCompat::stdVectorToVector(succ ? nextNode.outputNets() : nextNode.inputNets())); } } if (!mods.isEmpty() || !nets.isEmpty() || !gats.isEmpty()) diff --git a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp index aed5dd907a3e..223565d2fc55 100644 --- a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp +++ b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp @@ -26,6 +26,16 @@ namespace hal { #endif } + template + QList setToList(const QSet& cset) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QList(cset.constBegin(),cset.constEnd()); +#else + return QList::fromset(list); +#endif + } + template QVector QtCompat::listToVector(const QList& list) { diff --git a/plugins/gui/src/main_window/file_actions.cpp b/plugins/gui/src/main_window/file_actions.cpp index 4c6b278829dc..c0bd2b7e7551 100644 --- a/plugins/gui/src/main_window/file_actions.cpp +++ b/plugins/gui/src/main_window/file_actions.cpp @@ -2,7 +2,6 @@ #include "gui/main_window/main_window.h" #include "gui/gui_utils/graphics.h" #include "gui/settings/settings_items/settings_item_keybind.h" -#include "gui/gatelibrary_management/gatelibrary_content_widget.h" #include "gui/file_status_manager/file_status_manager.h" #include "gui/plugin_relay/gui_plugin_manager.h" #include "gui/gui_globals.h" diff --git a/plugins/gui/src/user_action/action_add_boolean_function.cpp b/plugins/gui/src/user_action/action_add_boolean_function.cpp index 8681ee010624..44a2f3167082 100644 --- a/plugins/gui/src/user_action/action_add_boolean_function.cpp +++ b/plugins/gui/src/user_action/action_add_boolean_function.cpp @@ -51,9 +51,9 @@ namespace hal { while(xmlIn.readNextStartElement()) { - if(xmlIn.name() == "name") + if(xmlIn.name() == QString("name")) mName = xmlIn.readElementText(); - if(xmlIn.name() == "bf") + if(xmlIn.name() == QString("bf")) { auto res = BooleanFunction::from_string(xmlIn.readElementText().toStdString()); if(res.is_ok()) diff --git a/plugins/gui/src/user_action/action_add_items_to_object.cpp b/plugins/gui/src/user_action/action_add_items_to_object.cpp index c86a6442f992..8cbd19387ddd 100644 --- a/plugins/gui/src/user_action/action_add_items_to_object.cpp +++ b/plugins/gui/src/user_action/action_add_items_to_object.cpp @@ -76,7 +76,7 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "placement") + if (xmlIn.name() == QString("placement")) { u32 id = xmlIn.attributes().value("id").toInt(); UserActionObjectType::ObjectType tp = UserActionObjectType::fromString(xmlIn.attributes().value("type").toString()); @@ -84,18 +84,18 @@ namespace hal mPlacementHint = PlacementHint(mode, Node(id, UserActionObjectType::toNodeType(tp))); xmlIn.skipCurrentElement(); // no text body to read } - else if (xmlIn.name() == "gridposition") + else if (xmlIn.name() == QString("gridposition")) { GridPlacement gp(gridFromText(xmlIn.readElementText())); mPlacementHint = PlacementHint(gp); } - else if (xmlIn.name() == "modules") + else if (xmlIn.name() == QString("modules")) mModules = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "gates") + else if (xmlIn.name() == QString("gates")) mGates = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "nets") + else if (xmlIn.name() == QString("nets")) mNets = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "pins") + else if (xmlIn.name() == QString("pins")) mPins = setFromText(xmlIn.readElementText()); } } diff --git a/plugins/gui/src/user_action/action_create_object.cpp b/plugins/gui/src/user_action/action_create_object.cpp index 97f60788fd39..b337f2b3f493 100644 --- a/plugins/gui/src/user_action/action_create_object.cpp +++ b/plugins/gui/src/user_action/action_create_object.cpp @@ -48,11 +48,11 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "objectname") + if (xmlIn.name() == QString("objectname")) mObjectName = xmlIn.readElementText(); - if (xmlIn.name() == "parentid") + if (xmlIn.name() == QString("parentid")) mParentId = xmlIn.readElementText().toInt(); - if (xmlIn.name() == "linkedid") + if (xmlIn.name() == QString("linkedid")) mLinkedObjectId = xmlIn.readElementText().toInt(); } } diff --git a/plugins/gui/src/user_action/action_move_item.cpp b/plugins/gui/src/user_action/action_move_item.cpp index 567768da93e9..5abb17608d95 100644 --- a/plugins/gui/src/user_action/action_move_item.cpp +++ b/plugins/gui/src/user_action/action_move_item.cpp @@ -45,9 +45,9 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "target_parent_id") + if (xmlIn.name() == QString("target_parent_id")) mTargetParentId = xmlIn.readElementText().toUInt(); - if (xmlIn.name() == "source_parent_id") + if (xmlIn.name() == QString("source_parent_id")) mSourceParentId = xmlIn.readElementText().toUInt(); } } diff --git a/plugins/gui/src/user_action/action_move_node.cpp b/plugins/gui/src/user_action/action_move_node.cpp index 6f8cc2033052..ab5e37f0435a 100644 --- a/plugins/gui/src/user_action/action_move_node.cpp +++ b/plugins/gui/src/user_action/action_move_node.cpp @@ -108,7 +108,7 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "to") + if (xmlIn.name() == QString("to")) mTo = parseFromString(xmlIn.readElementText()); } } diff --git a/plugins/gui/src/user_action/action_open_netlist_file.cpp b/plugins/gui/src/user_action/action_open_netlist_file.cpp index 5ab6ed184d27..6a450672ad76 100644 --- a/plugins/gui/src/user_action/action_open_netlist_file.cpp +++ b/plugins/gui/src/user_action/action_open_netlist_file.cpp @@ -62,9 +62,9 @@ namespace hal mMethod = Undefined; while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "filename") + if (xmlIn.name() == QString("filename")) mFilename = xmlIn.readElementText(); - if (xmlIn.name() == "method") + if (xmlIn.name() == QString("method")) { QString meth = xmlIn.readElementText(); for (int i=0; sOpenMethodsPersist[i]; i++) diff --git a/plugins/gui/src/user_action/action_pingroup.cpp b/plugins/gui/src/user_action/action_pingroup.cpp index b6d51e220b6a..1d3ce323786b 100644 --- a/plugins/gui/src/user_action/action_pingroup.cpp +++ b/plugins/gui/src/user_action/action_pingroup.cpp @@ -160,13 +160,13 @@ namespace hal QString name; int val = 0; - if (xmlIn.name() == "type") + if (xmlIn.name() == QString("type")) tp = PinActionType::fromString(xmlIn.readElementText()); - if (xmlIn.name() == "id") + if (xmlIn.name() == QString("id")) id = xmlIn.readElementText().toInt(); - if (xmlIn.name() == "name") + if (xmlIn.name() == QString("name")) name = xmlIn.readElementText(); - if (xmlIn.name() == "value") + if (xmlIn.name() == QString("value")) val = xmlIn.readElementText().toInt(); mPinActions.append(AtomicAction(tp,id,name,val)); } diff --git a/plugins/gui/src/user_action/action_remove_items_from_object.cpp b/plugins/gui/src/user_action/action_remove_items_from_object.cpp index d3598dd3c895..d0fa177e2730 100644 --- a/plugins/gui/src/user_action/action_remove_items_from_object.cpp +++ b/plugins/gui/src/user_action/action_remove_items_from_object.cpp @@ -54,13 +54,13 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "modules") + if (xmlIn.name() == QString("modules")) mModules = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "gates") + else if (xmlIn.name() == QString("gates")) mGates = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "nets") + else if (xmlIn.name() == QString("nets")) mNets = setFromText(xmlIn.readElementText()); - else if (xmlIn.name() == "pins") + else if (xmlIn.name() == QString("pins")) mPins = setFromText(xmlIn.readElementText()); } } diff --git a/plugins/gui/src/user_action/action_rename_object.cpp b/plugins/gui/src/user_action/action_rename_object.cpp index b126c3316636..24f854a5354a 100644 --- a/plugins/gui/src/user_action/action_rename_object.cpp +++ b/plugins/gui/src/user_action/action_rename_object.cpp @@ -40,7 +40,7 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "name") + if (xmlIn.name() == QString("name")) mNewName = xmlIn.readElementText(); } } diff --git a/plugins/gui/src/user_action/action_set_object_color.cpp b/plugins/gui/src/user_action/action_set_object_color.cpp index 20b173a4ba32..85c9eba36ea2 100644 --- a/plugins/gui/src/user_action/action_set_object_color.cpp +++ b/plugins/gui/src/user_action/action_set_object_color.cpp @@ -35,7 +35,7 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "color") + if (xmlIn.name() == QString("color")) mColor = QColor(xmlIn.readElementText()); } } diff --git a/plugins/gui/src/user_action/action_set_object_data.cpp b/plugins/gui/src/user_action/action_set_object_data.cpp index 8d9f5eb226d3..ae6b6fcfd775 100644 --- a/plugins/gui/src/user_action/action_set_object_data.cpp +++ b/plugins/gui/src/user_action/action_set_object_data.cpp @@ -92,20 +92,20 @@ namespace hal { while(xmlIn.readNextStartElement()) { - if(xmlIn.name() == "category") + if(xmlIn.name() == QString("category")) mCat = xmlIn.readElementText(); - else if(xmlIn.name() == "key") + else if(xmlIn.name() == QString("key")) mKey = xmlIn.readElementText(); - else if(xmlIn.name() == "type") + else if(xmlIn.name() == QString("type")) mType = xmlIn.readElementText(); - else if(xmlIn.name() == "value") + else if(xmlIn.name() == QString("value")) mVal = xmlIn.readElementText(); - else if(xmlIn.name() == "oldCategory") + else if(xmlIn.name() == QString("oldCategory")) { mKeyOrCatModified = true; mOldCat = xmlIn.readElementText(); } - else if(xmlIn.name() == "oldKey") + else if(xmlIn.name() == QString("oldKey")) { mKeyOrCatModified = true; mOldKey = xmlIn.readElementText(); diff --git a/plugins/gui/src/user_action/action_set_object_type.cpp b/plugins/gui/src/user_action/action_set_object_type.cpp index c1ffcbc727c6..1a883939bdd6 100644 --- a/plugins/gui/src/user_action/action_set_object_type.cpp +++ b/plugins/gui/src/user_action/action_set_object_type.cpp @@ -38,7 +38,7 @@ namespace hal { while (xmlIn.readNextStartElement()) { - if (xmlIn.name() == "type") + if (xmlIn.name() == QString("type")) mObjectType = xmlIn.readElementText(); } } diff --git a/plugins/gui/src/user_action/action_set_selection_focus.cpp b/plugins/gui/src/user_action/action_set_selection_focus.cpp index aa55f0911a27..bbc50fc4c8a7 100644 --- a/plugins/gui/src/user_action/action_set_selection_focus.cpp +++ b/plugins/gui/src/user_action/action_set_selection_focus.cpp @@ -75,11 +75,11 @@ namespace hal while (xmlIn.readNextStartElement()) { - if (xmlIn.name()=="modules") + if (xmlIn.name()==QString("modules")) mModules = setFromText(xmlIn.readElementText()); - else if (xmlIn.name()=="gates") + else if (xmlIn.name()==QString("gates")) mGates = setFromText(xmlIn.readElementText()); - else if (xmlIn.name()=="nets") + else if (xmlIn.name()==QString("nets")) mNets = setFromText(xmlIn.readElementText()); } } diff --git a/plugins/gui/src/user_action/user_action.cpp b/plugins/gui/src/user_action/user_action.cpp index bfdca882ccd9..434c7c280e57 100644 --- a/plugins/gui/src/user_action/user_action.cpp +++ b/plugins/gui/src/user_action/user_action.cpp @@ -118,7 +118,7 @@ namespace hal void UserAction::readParentObjectFromXml(QXmlStreamReader &xmlIn) { - if(xmlIn.name() == "parentObj") + if(xmlIn.name() == QString("parentObj")) { mParentObject.readFromXml(xmlIn); xmlIn.readNext();//to read the corresponding EndElement diff --git a/plugins/gui/src/user_action/user_action_compound.cpp b/plugins/gui/src/user_action/user_action_compound.cpp index 2247a9bf36a4..57e70ee5eb97 100644 --- a/plugins/gui/src/user_action/user_action_compound.cpp +++ b/plugins/gui/src/user_action/user_action_compound.cpp @@ -64,10 +64,10 @@ namespace hal { { if (xmlIn.isStartElement()) { - if (xmlIn.name() == "actions") + if (xmlIn.name() == QString("actions")) { parseActions = true; - mUseCreatedObject = (xmlIn.attributes().value("useCreatedObject")=="true"); + mUseCreatedObject = (xmlIn.attributes().value("useCreatedObject").toString()=="true"); } else if (parseActions) { @@ -77,7 +77,7 @@ namespace hal { } else if (xmlIn.isEndElement()) { - if (xmlIn.name() == "actions") + if (xmlIn.name() == QString("actions")) { parseActions = false; return; diff --git a/plugins/gui/src/user_action/user_action_manager.cpp b/plugins/gui/src/user_action/user_action_manager.cpp index d482ddd7891a..032c906ad0f2 100644 --- a/plugins/gui/src/user_action/user_action_manager.cpp +++ b/plugins/gui/src/user_action/user_action_manager.cpp @@ -161,7 +161,7 @@ namespace hal { if (xmlIn.isStartElement()) { - if (xmlIn.name() == "actions") + if (xmlIn.name() == QString("actions")) parseActions = true; else if (parseActions) { @@ -171,7 +171,7 @@ namespace hal } else if (xmlIn.isEndElement()) { - if (xmlIn.name() == "actions") + if (xmlIn.name() == QString("actions")) parseActions = false; } } diff --git a/plugins/gui/src/welcome_screen/get_in_touch_item.cpp b/plugins/gui/src/welcome_screen/get_in_touch_item.cpp index 8393bd4c340b..bc5faaea66cd 100644 --- a/plugins/gui/src/welcome_screen/get_in_touch_item.cpp +++ b/plugins/gui/src/welcome_screen/get_in_touch_item.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,7 @@ namespace hal repolish(); } - void GetInTouchItem::enterEvent(QEvent* event) + void GetInTouchItem::enterEvent(QEnterEvent* event) { Q_UNUSED(event) diff --git a/plugins/gui/src/welcome_screen/recent_file_item.cpp b/plugins/gui/src/welcome_screen/recent_file_item.cpp index 563487aa68a5..aa4f04f69693 100644 --- a/plugins/gui/src/welcome_screen/recent_file_item.cpp +++ b/plugins/gui/src/welcome_screen/recent_file_item.cpp @@ -13,6 +13,7 @@ #include #include #include +#include namespace hal { @@ -63,7 +64,7 @@ namespace hal repolish(); } - void RecentFileItem::enterEvent(QEvent* event) + void RecentFileItem::enterEvent(QEnterEvent* event) { Q_UNUSED(event) if(mMissing) diff --git a/plugins/simulator/waveform_viewer/src/boolean_dialog.cpp b/plugins/simulator/waveform_viewer/src/boolean_dialog.cpp index 425d8f731ed7..0f892c14548b 100644 --- a/plugins/simulator/waveform_viewer/src/boolean_dialog.cpp +++ b/plugins/simulator/waveform_viewer/src/boolean_dialog.cpp @@ -1,4 +1,5 @@ #include "waveform_viewer/boolean_dialog.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include #include @@ -178,6 +179,6 @@ namespace hal { if (!incomplete) val.insert(v); } - return val.toList(); + return QtCompat::setToList(val); } } From 036223f324e36e76d0bb1b72e9f0c7e318a1753a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Sat, 17 Jan 2026 01:12:29 +0100 Subject: [PATCH 05/28] Replacing code which used function alread deprecated in Qt5.15 --- .../include/gui/hal_qt_compat/hal_qt_compat.h | 10 +++++- .../src/docking_system/splitter_anchor.cpp | 2 +- plugins/gui/src/docking_system/tab_widget.cpp | 2 +- .../src/graph_widget/graph_graphics_view.cpp | 4 +-- .../nodes/gates/standard_graphics_gate.cpp | 4 +-- .../layouters/net_layout_point.cpp | 3 +- plugins/gui/src/gui_utils/geometry.cpp | 3 +- .../gui_utils/special_log_content_manager.cpp | 4 +-- .../gui/src/hal_qt_compat/hal_qt_compat.cpp | 31 +++++++++++++++++-- plugins/gui/src/python/python_code_editor.cpp | 3 +- plugins/gui/src/python/python_console.cpp | 2 +- plugins/gui/src/python/python_editor.cpp | 4 +-- plugins/gui/src/settings/settings_manager.cpp | 3 +- .../action_set_selection_focus.cpp | 6 ++-- .../src/user_action/user_action_manager.cpp | 2 +- .../src/user_action/user_action_object.cpp | 4 +-- 16 files changed, 63 insertions(+), 24 deletions(-) diff --git a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h index a583a692d12c..e4783ad16571 100644 --- a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h +++ b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h @@ -33,10 +33,18 @@ #include #include #include +#include +#include namespace hal { namespace QtCompat { - QRect desktopGeometry(); + QRect desktopAvailableGeometry(); + + QRect widgetAvailableGeometry(QWidget* widget); + + QRect desktopScreenGeometry(); + + uint qHashPoint(const QPoint& p); void styleOptionInit(QStyleOption& opt, QWidget* widget); diff --git a/plugins/gui/src/docking_system/splitter_anchor.cpp b/plugins/gui/src/docking_system/splitter_anchor.cpp index ff820de3ccaa..96e890ef2e6d 100644 --- a/plugins/gui/src/docking_system/splitter_anchor.cpp +++ b/plugins/gui/src/docking_system/splitter_anchor.cpp @@ -51,7 +51,7 @@ namespace hal widget->hide(); widget->setParent(nullptr); ContentFrame* frame = new ContentFrame(widget, false, nullptr); - frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopGeometry())); + frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopAvailableGeometry())); frame->show(); if (mSplitter->unused()) diff --git a/plugins/gui/src/docking_system/tab_widget.cpp b/plugins/gui/src/docking_system/tab_widget.cpp index 170c66bfab2d..57379ee874c3 100644 --- a/plugins/gui/src/docking_system/tab_widget.cpp +++ b/plugins/gui/src/docking_system/tab_widget.cpp @@ -91,7 +91,7 @@ namespace hal { mDockBar->detachButton(widget); ContentFrame* frame = new ContentFrame(widget, false, nullptr); - frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopGeometry())); + frame->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, frame->size(), QtCompat::desktopAvailableGeometry())); frame->show(); if (widget == mCurrentWidget) diff --git a/plugins/gui/src/graph_widget/graph_graphics_view.cpp b/plugins/gui/src/graph_widget/graph_graphics_view.cpp index 123edf8ce915..4eabe96759ba 100644 --- a/plugins/gui/src/graph_widget/graph_graphics_view.cpp +++ b/plugins/gui/src/graph_widget/graph_graphics_view.cpp @@ -262,7 +262,7 @@ namespace hal return; if ((event->modifiers() == mPanModifier && event->button() == Qt::LeftButton) || - (event->button() == Qt::MidButton && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) + (event->button() == Qt::MiddleButton && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) { mMovePosition = event->pos(); } @@ -314,7 +314,7 @@ namespace hal } if ((event->buttons().testFlag(Qt::LeftButton) && event->modifiers() == mPanModifier) || - (event->buttons().testFlag(Qt::MidButton) && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) + (event->buttons().testFlag(Qt::MiddleButton) && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) { QScrollBar* hBar = horizontalScrollBar(); QScrollBar* vBar = verticalScrollBar(); diff --git a/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp b/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp index 0083e299f7f4..25078c0a590e 100644 --- a/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp +++ b/plugins/gui/src/graph_widget/items/nodes/gates/standard_graphics_gate.cpp @@ -159,7 +159,7 @@ void StandardGraphicsGate::paint(QPainter* painter, const QStyleOptionGraphicsIt QBrush lastBrush = painter->brush(); painter->setBrush(pinBackground); painter->setPen(QPen(pinBackground,0)); - painter->drawRoundRect(sPinOuterHorizontalSpacing,yText-sPinFontAscent,wbox,sPinFontHeight,35,35); + painter->drawRoundedRect(sPinOuterHorizontalSpacing,yText-sPinFontAscent,wbox,sPinFontHeight,35,35); painter->setBrush(lastBrush); pinTextColor = legibleColor(pinBackground); } @@ -202,7 +202,7 @@ void StandardGraphicsGate::paint(QPainter* painter, const QStyleOptionGraphicsIt xbox -= (mOutputPinTextWidth.at(i) - wbox); wbox = mOutputPinTextWidth.at(i); } - painter->drawRoundRect(xbox,yText-sPinFontAscent,wbox,sPinFontHeight,35,35); + painter->drawRoundedRect(xbox,yText-sPinFontAscent,wbox,sPinFontHeight,35,35); painter->setBrush(lastBrush); pinTextColor = legibleColor(pinBackground); } diff --git a/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp b/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp index def1284b3115..3a682b9f57c8 100644 --- a/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp +++ b/plugins/gui/src/graph_widget/layouters/net_layout_point.cpp @@ -1,4 +1,5 @@ #include "gui/graph_widget/layouters/net_layout_point.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include #include @@ -21,7 +22,7 @@ namespace hal { uint qHash(const hal::NetLayoutPoint& p) { - return qHash(static_cast(p)); + return QtCompat::qHashPoint(static_cast(p)); } uint qHash(const hal::NetLayoutWire& w) diff --git a/plugins/gui/src/gui_utils/geometry.cpp b/plugins/gui/src/gui_utils/geometry.cpp index 69d3c290bfe4..67fd2ae471e1 100644 --- a/plugins/gui/src/gui_utils/geometry.cpp +++ b/plugins/gui/src/gui_utils/geometry.cpp @@ -1,4 +1,5 @@ #include "gui/gui_utils/geometry.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -9,7 +10,7 @@ namespace hal { void ensureOnScreen(QWidget* w) { - auto boundingRect = QApplication::desktop()->availableGeometry(w); + auto boundingRect = QtCompat::widgetAvailableGeometry(w); auto requiredRect = w->geometry(); // Try fitting vertically, prioritizing top on screen if (boundingRect.top() > requiredRect.top()) diff --git a/plugins/gui/src/gui_utils/special_log_content_manager.cpp b/plugins/gui/src/gui_utils/special_log_content_manager.cpp index 2a1d2a7a711a..7c4c922e7e4b 100644 --- a/plugins/gui/src/gui_utils/special_log_content_manager.cpp +++ b/plugins/gui/src/gui_utils/special_log_content_manager.cpp @@ -53,7 +53,7 @@ namespace hal } } - QString fileName = "Screenshot_" +QString::number(QDateTime::currentDateTime().toTime_t()); + QString fileName = "Screenshot_" +QString::number(QDateTime::currentDateTime().toSecsSinceEpoch()); QString fileType = "png"; QList pixmapList; @@ -107,7 +107,7 @@ namespace hal } QTabWidget* pythonTabWidget = mPythonEditor->getTabWidget(); - QString fileName = "Pythoncodeeditors_" + QString::number(QDateTime::currentDateTime().toTime_t()); + QString fileName = "Pythoncodeeditors_" + QString::number(QDateTime::currentDateTime().toSecsSinceEpoch()); QString fileType = "txt"; QFile file(pythonEditorDumpPath + "/" + fileName + "." + fileType); diff --git a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp index 223565d2fc55..3724b66a4b59 100644 --- a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp +++ b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp @@ -7,7 +7,7 @@ #endif namespace hal { - QRect QtCompat::desktopGeometry() + QRect QtCompat::desktopAvailableGeometry() { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) return QGuiApplication::primaryScreen()->availableGeometry(); @@ -16,6 +16,33 @@ namespace hal { #endif } + QRect QtCompat::desktopScreenGeometry() + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QGuiApplication::primaryScreen()->geometry(); +#else + return qApp->desktop()->screenGeometry(); +#endif + } + + QRect QtCompat::widgetAvailableGeometry(QWidget* widget) + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return widget->screen()->availableGeometry(); +#else + return qApp->desktop()->availableGeometry(widget); +#endif + } + + uint QtCompat::qHashPoint(const QPoint& p) + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return qHash(p,0); +#else + return qHash(p); +#endif + } + template QSet QtCompat::listToSet(const QList& list) { @@ -71,5 +98,5 @@ namespace hal { #else opt.init(widget); #endif - } + } } diff --git a/plugins/gui/src/python/python_code_editor.cpp b/plugins/gui/src/python/python_code_editor.cpp index ed1ab858de93..dc547040d75d 100644 --- a/plugins/gui/src/python/python_code_editor.cpp +++ b/plugins/gui/src/python/python_code_editor.cpp @@ -5,6 +5,7 @@ #include "hal_core/netlist/project_manager.h" #include "hal_core/utilities/log.h" #include "gui/gui_globals.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include @@ -154,7 +155,7 @@ namespace hal auto menu_width = dialog->width(); auto menu_height = dialog->height(); - auto desk_rect = QApplication::desktop()->screenGeometry(); + auto desk_rect = QtCompat::desktopScreenGeometry(); auto desk_width = desk_rect.width(); auto desk_height = desk_rect.height(); auto anchor = this->cursorRect().bottomRight(); diff --git a/plugins/gui/src/python/python_console.cpp b/plugins/gui/src/python/python_console.cpp index dea4cb3f166f..9cd765f2a80d 100644 --- a/plugins/gui/src/python/python_console.cpp +++ b/plugins/gui/src/python/python_console.cpp @@ -206,7 +206,7 @@ namespace hal void PythonConsole::mousePressEvent(QMouseEvent* event) { // m_position = textCursor().position(); - // if (event->button() == Qt::MidButton) + // if (event->button() == Qt::MiddleButton) // { // copy(); // QTextCursor cursor = cursorForPosition(event->pos()); diff --git a/plugins/gui/src/python/python_editor.cpp b/plugins/gui/src/python/python_editor.cpp index 40738aaa6608..10d3a1706347 100644 --- a/plugins/gui/src/python/python_editor.cpp +++ b/plugins/gui/src/python/python_editor.cpp @@ -1204,7 +1204,7 @@ namespace hal for (QString snapshot_file_name : snapshot_files) { QString snapshot_file_path = snapshot_dir.absoluteFilePath(snapshot_file_name); - QPair original_path_and_content = this->readSnapshotFile(snapshot_file_path); + QPair original_path_and_content = this->readSnapshotFile(QFileInfo(snapshot_file_path)); QString original_path = original_path_and_content.first; if (original_path.isEmpty() || (!QFileInfo(original_path).exists())) { @@ -1299,7 +1299,7 @@ namespace hal if (editor->document()->isModified()) { // The snapshot is only created if there are modifications - this->writeSnapshotFile(snapshot_file_path, editor->getAbsFilename(), editor->toPlainText()); + this->writeSnapshotFile(QFileInfo(snapshot_file_path), editor->getAbsFilename(), editor->toPlainText()); } } } diff --git a/plugins/gui/src/settings/settings_manager.cpp b/plugins/gui/src/settings/settings_manager.cpp index 2dd0cf88dd5a..498efd0f531b 100644 --- a/plugins/gui/src/settings/settings_manager.cpp +++ b/plugins/gui/src/settings/settings_manager.cpp @@ -3,6 +3,7 @@ #include "gui/content_widget/content_widget.h" #include "gui/content_frame/content_frame.h" #include "gui/content_manager/content_manager.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include #include #include @@ -79,7 +80,7 @@ namespace hal QSize SettingsManager::mainWindowSize() const { - QRect rect = QApplication::desktop()->screenGeometry(); + QRect rect = QtCompat::desktopScreenGeometry(); return mUserSettingsFile->value("MainWindow/size", rect.size()).toSize(); } diff --git a/plugins/gui/src/user_action/action_set_selection_focus.cpp b/plugins/gui/src/user_action/action_set_selection_focus.cpp index bbc50fc4c8a7..9cc154bffbfd 100644 --- a/plugins/gui/src/user_action/action_set_selection_focus.cpp +++ b/plugins/gui/src/user_action/action_set_selection_focus.cpp @@ -58,15 +58,15 @@ namespace hal void ActionSetSelectionFocus::readFromXml(QXmlStreamReader& xmlIn) { - QStringRef sfocAttribute = xmlIn.attributes().value("subfocus"); + auto sfocAttribute = xmlIn.attributes().value("subfocus"); // Qt5: QStringRef Qt6: QStringView if (!sfocAttribute.isNull() && !sfocAttribute.isEmpty()) { - if (sfocAttribute == "Left") + if (sfocAttribute == QString("Left")) { mSubfocus = SelectionRelay::Subfocus::Left; mSubfocusIndex = xmlIn.attributes().value("subfocusIndex").toInt(); } - else if (sfocAttribute == "Right") + else if (sfocAttribute == QString("Right")) { mSubfocus = SelectionRelay::Subfocus::Right; mSubfocusIndex = xmlIn.attributes().value("subfocusIndex").toInt(); diff --git a/plugins/gui/src/user_action/user_action_manager.cpp b/plugins/gui/src/user_action/user_action_manager.cpp index 032c906ad0f2..ef71f517db9d 100644 --- a/plugins/gui/src/user_action/user_action_manager.cpp +++ b/plugins/gui/src/user_action/user_action_manager.cpp @@ -208,7 +208,7 @@ namespace hal UserAction* retval = fac->newAction(); if (retval) { - QStringRef compound = xmlIn.attributes().value("compound"); + auto compound = xmlIn.attributes().value("compound"); // Qt5: QStringRef Qt6: QStringView if (!compound.isNull() && !compound.isEmpty()) retval->setCompoundOrder(compound.toInt()); UserActionObject actObj; diff --git a/plugins/gui/src/user_action/user_action_object.cpp b/plugins/gui/src/user_action/user_action_object.cpp index 9830556023ca..589c0fcc4b96 100644 --- a/plugins/gui/src/user_action/user_action_object.cpp +++ b/plugins/gui/src/user_action/user_action_object.cpp @@ -112,9 +112,9 @@ namespace hal { void UserActionObject::readFromXml(QXmlStreamReader& xmlIn) { - QStringRef srId = xmlIn.attributes().value("id"); + auto srId = xmlIn.attributes().value("id"); // Qt5: QStringRef Qt6: QStringView if (srId.isNull() || srId.isEmpty()) return; - QStringRef srTp = xmlIn.attributes().value("type"); + auto srTp = xmlIn.attributes().value("type"); if (srTp.isNull() || srTp.isEmpty()) return; bool ok = false; mId = srId.toInt(&ok); From bc01d447da31dc1ef56bfe2711b088a465d204ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Sun, 18 Jan 2026 01:26:38 +0100 Subject: [PATCH 06/28] minor fixes --- .../gui/settings/settings_widgets/settings_widget_dropdown.h | 2 +- plugins/gui/src/selection_details_widget/data_table_model.cpp | 4 ++-- .../settings/settings_widgets/settings_widget_dropdown.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/gui/include/gui/settings/settings_widgets/settings_widget_dropdown.h b/plugins/gui/include/gui/settings/settings_widgets/settings_widget_dropdown.h index 0415c9977dea..04d963198963 100644 --- a/plugins/gui/include/gui/settings/settings_widgets/settings_widget_dropdown.h +++ b/plugins/gui/include/gui/settings/settings_widgets/settings_widget_dropdown.h @@ -66,7 +66,7 @@ namespace hal virtual QVariant value() override; private: - void on_index_changed(QString text); + void on_index_changed(int inx); SettingsItemDropdown* mSettingsItem; QStringList mOptions; diff --git a/plugins/gui/src/selection_details_widget/data_table_model.cpp b/plugins/gui/src/selection_details_widget/data_table_model.cpp index cec400d893c3..da0192781def 100644 --- a/plugins/gui/src/selection_details_widget/data_table_model.cpp +++ b/plugins/gui/src/selection_details_widget/data_table_model.cpp @@ -122,7 +122,7 @@ namespace hal mDataEntries.append(e); } // The data is sorted by category first and then by key. However the category generic is always displayed first. - qSort(mDataEntries.begin(), mDataEntries.end(), + std::sort(mDataEntries.begin(), mDataEntries.end(), [](const DataEntry a, const DataEntry b) -> bool { @@ -145,7 +145,7 @@ namespace hal int rowIdx = 0; for(const DataEntry& entry : mDataEntries) { - mEntryToRowStyle[QPair(entry.category, entry.key)] = getRowStyleByEntry(entry, rowIdx); + mEntryToRowStyle[QPair(entry.category, entry.key)] = getRowStyleByEntry(entry, rowIdx); rowIdx++; } diff --git a/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp b/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp index 842125073842..3275c2f783a4 100644 --- a/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp +++ b/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp @@ -40,9 +40,9 @@ namespace hal return mComboBox->currentIndex(); } - void SettingsWidgetDropdown::on_index_changed(QString text) + void SettingsWidgetDropdown::on_index_changed(int inx) { - Q_UNUSED(text); + Q_UNUSED(inx); this->trigger_setting_updated(); } } From 12db97698cb3696c04581b68dab69b276ff34131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Mon, 19 Jan 2026 00:18:46 +0100 Subject: [PATCH 07/28] Fixes of the fix --- .../gui/graph_widget/graph_graphics_view.h | 2 -- .../include/gui/hal_qt_compat/hal_qt_compat.h | 2 ++ .../models/context_tree_model.cpp | 6 ++-- .../src/graph_widget/graph_graphics_view.cpp | 31 ++++++++----------- .../gui/src/hal_qt_compat/hal_qt_compat.cpp | 12 ++++++- .../settings_widget_dropdown.cpp | 2 +- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/plugins/gui/include/gui/graph_widget/graph_graphics_view.h b/plugins/gui/include/gui/graph_widget/graph_graphics_view.h index 1354855fd3ad..d5f559826017 100644 --- a/plugins/gui/include/gui/graph_widget/graph_graphics_view.h +++ b/plugins/gui/include/gui/graph_widget/graph_graphics_view.h @@ -188,8 +188,6 @@ namespace hal void mousePressEventNotItemDrag(QMouseEvent* event); void showContextMenu(const QPoint& pos); - void updateMatrix(const int delta); - void toggleAntialiasing(); bool itemDraggable(GraphicsItem* item); diff --git a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h index e4783ad16571..104d12dea7d7 100644 --- a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h +++ b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h @@ -50,6 +50,8 @@ namespace hal { void setMarginWidth(QLayout* layout, int marginWidth); + QString dateToLocaleString(const QDateTime &dt); + template extern QSet listToSet(const QList& list); template extern QList setToList(const QSet& cset); diff --git a/plugins/gui/src/context_manager_widget/models/context_tree_model.cpp b/plugins/gui/src/context_manager_widget/models/context_tree_model.cpp index 38a4e94476d8..5f6f5447363b 100644 --- a/plugins/gui/src/context_manager_widget/models/context_tree_model.cpp +++ b/plugins/gui/src/context_manager_widget/models/context_tree_model.cpp @@ -1,10 +1,8 @@ #include "gui/context_manager_widget/models/context_tree_model.h" #include "gui/selection_details_widget/selection_details_icon_provider.h" -#include "gui/gui_globals.h" -#include "gui/gui_utils/graphics.h" +#include "gui/hal_qt_compat/hal_qt_compat.h" #include "gui/user_action/action_delete_object.h" -#include #include namespace hal @@ -73,7 +71,7 @@ namespace hal case 1: return mContext->id(); case 2: - return mContext->getTimestamp().toString(Qt::SystemLocaleShortDate); + return QtCompat::dateToLocaleString(mContext->getTimestamp()); } } return QVariant(); diff --git a/plugins/gui/src/graph_widget/graph_graphics_view.cpp b/plugins/gui/src/graph_widget/graph_graphics_view.cpp index 4eabe96759ba..46f9536afdfe 100644 --- a/plugins/gui/src/graph_widget/graph_graphics_view.cpp +++ b/plugins/gui/src/graph_widget/graph_graphics_view.cpp @@ -437,7 +437,7 @@ namespace hal { if (QApplication::keyboardModifiers() == mZoomModifier) { - if (event->orientation() == Qt::Vertical) + if (event->angleDelta().y() != 0) { qreal angle = event->angleDelta().y(); qreal factor = qPow(mZoomFactorBase, angle); @@ -696,15 +696,6 @@ namespace hal gPythonContext->pythonThread()->unlock(); } - void GraphGraphicsView::updateMatrix(const int delta) - { - qreal scale = qPow(2.0, delta / 100.0); - - QMatrix matrix; - matrix.scale(scale, scale); - setMatrix(matrix); - } - void GraphGraphicsView::toggleAntialiasing() { setRenderHint(QPainter::Antialiasing, !(renderHints() & QPainter::Antialiasing)); @@ -1560,15 +1551,19 @@ namespace hal for (const Module* m : modSet) if (m) modDepth.insertMulti(m->get_submodule_depth(),m); - QMapIterator it(modDepth); - it.toBack(); - while (it.hasPrevious()) + if (!modDepth.empty()) { - it.previous(); - const Module* m = it.value(); - ActionFoldModule* act = new ActionFoldModule(m->get_id()); - act->setContextId(context->id()); - act->exec(); + auto it = modDepth.constEnd(); + for (;;) + { + --it; + const Module* m = it.value(); + ActionFoldModule* act = new ActionFoldModule(m->get_id()); + act->setContextId(context->id()); + act->exec(); + if (it == modDepth.constBegin()) + break; + } } } diff --git a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp index 3724b66a4b59..ae12de7b777b 100644 --- a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp +++ b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp @@ -98,5 +98,15 @@ namespace hal { #else opt.init(widget); #endif - } + } + + QString QtCompat::dateToLocaleString(const QDateTime &dt) + { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QLocale::system().toString(dt, QLocale::ShortFormat); +#else + return dt.toString(Qt::SystemLocaleShortDate); +#endif + } + } diff --git a/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp b/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp index 3275c2f783a4..f96f92ac02bc 100644 --- a/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp +++ b/plugins/gui/src/settings/settings_widgets/settings_widget_dropdown.cpp @@ -18,7 +18,7 @@ namespace hal { mComboBox = new QComboBox(this); mComboBox->addItems(mOptions); - connect(mComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &SettingsWidgetDropdown::on_index_changed); + connect(mComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &SettingsWidgetDropdown::on_index_changed); mContainer->addWidget(mComboBox); From 4b6d2e56cd80128ba2197af1ded47d320595f06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Tue, 20 Jan 2026 19:44:43 +0100 Subject: [PATCH 08/28] First version that builds with Qt6 --- plugins/dot_viewer/src/dot_graphics_view.cpp | 4 ++-- .../include/gui/module_widget/module_widget.h | 2 -- .../selection_details_widget.h | 3 +-- .../generalinfo_wizardpage.cpp | 4 ++-- .../gatelibrary_pages/state_wizardpage.cpp | 4 ++-- plugins/gui/src/graph_widget/graph_widget.cpp | 1 - plugins/gui/src/gui_utils/graphics.cpp | 20 +++++++++---------- plugins/gui/src/pin_model/pin_model.cpp | 8 ++++---- .../src/plugin_relay/gui_plugin_manager.cpp | 9 +++++---- plugins/gui/src/python/python_thread.cpp | 4 ++-- .../src/logic_evaluator_truthtable.cpp | 4 ++-- .../src/saleae_file.cpp | 1 - .../include/waveform_viewer/wave_widget.h | 1 + .../src/wave_graphics_canvas.cpp | 2 +- .../waveform_viewer/src/wave_item.cpp | 2 +- .../waveform_viewer/src/wave_tree_model.cpp | 4 ++-- .../waveform_viewer/src/wave_widget.cpp | 1 - 17 files changed, 35 insertions(+), 39 deletions(-) diff --git a/plugins/dot_viewer/src/dot_graphics_view.cpp b/plugins/dot_viewer/src/dot_graphics_view.cpp index 2d4bd07c8d80..02e8eb64de9d 100644 --- a/plugins/dot_viewer/src/dot_graphics_view.cpp +++ b/plugins/dot_viewer/src/dot_graphics_view.cpp @@ -35,7 +35,7 @@ namespace hal { void DotGraphicsView::mousePressEvent(QMouseEvent* event) { if ((event->modifiers() == mPanModifier && event->button() == Qt::LeftButton) || - (event->button() == Qt::MidButton && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) + (event->button() == Qt::MiddleButton && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) { mMovePosition = event->pos(); } @@ -47,7 +47,7 @@ namespace hal { return; if ((event->buttons().testFlag(Qt::LeftButton) && event->modifiers() == mPanModifier) || - (event->buttons().testFlag(Qt::MidButton) && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) + (event->buttons().testFlag(Qt::MiddleButton) && gGraphContextManager->sSettingPanOnMiddleButton->value().toBool())) { QScrollBar* hBar = horizontalScrollBar(); QScrollBar* vBar = verticalScrollBar(); diff --git a/plugins/gui/include/gui/module_widget/module_widget.h b/plugins/gui/include/gui/module_widget/module_widget.h index 26ae06d2530e..ad41ba2ef0bd 100644 --- a/plugins/gui/include/gui/module_widget/module_widget.h +++ b/plugins/gui/include/gui/module_widget/module_widget.h @@ -263,8 +263,6 @@ namespace hal QAction* mFilterAction; - QList mRegexps; - bool mIgnoreSelectionChange; ModuleModel* mModuleModel; diff --git a/plugins/gui/include/gui/selection_details_widget/selection_details_widget.h b/plugins/gui/include/gui/selection_details_widget/selection_details_widget.h index d2649568f701..926a2a948410 100644 --- a/plugins/gui/include/gui/selection_details_widget/selection_details_widget.h +++ b/plugins/gui/include/gui/selection_details_widget/selection_details_widget.h @@ -28,8 +28,7 @@ #include "gui/content_widget/content_widget.h" #include "gui/module_model/module_model.h" #include "gui/selection_details_widget/tree_navigation/selection_tree_proxy.h" -#include "hal_core/defines.h" - +#include class QTableWidget; class QStackedWidget; diff --git a/plugins/gui/src/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.cpp b/plugins/gui/src/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.cpp index f1135b804527..9f5efafff36f 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.cpp @@ -112,8 +112,8 @@ namespace hal connect(mDelBtn, &QPushButton::clicked, this, &GeneralInfoWizardPage::deleteProperty); connect(mName, &QLineEdit::textChanged, this, &GeneralInfoWizardPage::handleNameChanged); - QRegExp rx("[A-z]([A-z]|\\d|_)*"); - mValidator = new QRegExpValidator(rx, this); + QRegularExpression rx("^[A-z]([A-z]|\\d|_)*$"); + mValidator = new QRegularExpressionValidator(rx, this); mName->setValidator(mValidator); } diff --git a/plugins/gui/src/gatelibrary_management/gatelibrary_pages/state_wizardpage.cpp b/plugins/gui/src/gatelibrary_management/gatelibrary_pages/state_wizardpage.cpp index ebf52ece2228..96f41517dd1b 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_pages/state_wizardpage.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_pages/state_wizardpage.cpp @@ -26,8 +26,8 @@ namespace hal connect(mStateIdentifier, &QLineEdit::textChanged, this, &StateWizardPage::handleTextChanged); connect(mNegStateIdentifier, &QLineEdit::textChanged, this, &StateWizardPage::handleNegTextChanged); - QRegExp rx("[A-z]([A-z]|\\d|_)*"); - mValidator = new QRegExpValidator(rx, this); + QRegularExpression rx("^[A-z]([A-z]|\\d|_)*$"); + mValidator = new QRegularExpressionValidator(rx, this); mStateIdentifier->setValidator(mValidator); mNegStateIdentifier->setValidator(mValidator); } diff --git a/plugins/gui/src/graph_widget/graph_widget.cpp b/plugins/gui/src/graph_widget/graph_widget.cpp index 27c2e452801e..3567d2478ff5 100644 --- a/plugins/gui/src/graph_widget/graph_widget.cpp +++ b/plugins/gui/src/graph_widget/graph_widget.cpp @@ -1051,7 +1051,6 @@ namespace hal void GraphWidget::pluginProgressIndicator(int percent, const std::string& msg) { - // qDebug() << "progress" << hex << (quintptr) QThread::currentThread() << (quintptr) gPythonContext->currentThread() << (quintptr) dynamic_cast(QThread::currentThread()); if (!sInstance || gPythonContext->pythonThread()) return; if (percent==100) sInstance->handleSceneAvailable(); diff --git a/plugins/gui/src/gui_utils/graphics.cpp b/plugins/gui/src/gui_utils/graphics.cpp index 9a6068b81e60..0be0834d6122 100644 --- a/plugins/gui/src/gui_utils/graphics.cpp +++ b/plugins/gui/src/gui_utils/graphics.cpp @@ -4,6 +4,7 @@ #include #include +#include namespace hal { @@ -11,28 +12,27 @@ namespace hal { void changeSvgColor(QString& svg_data, const QColor& from, const QColor& to) { - QRegExp regex(from.name()); + QRegularExpression regex(from.name()); svg_data.replace(regex, to.name().toUtf8()); } void changeAllSvgColors(QString& svg_data, const QColor& to) { - QRegExp regex("#[0-9a-f]{6}", Qt::CaseInsensitive); + QRegularExpression regex("#[0-9a-f]{6}",QRegularExpression::CaseInsensitiveOption); svg_data.replace(regex, to.name().toUtf8()); } bool applyColorStyle(QString& svg_data, const QString& color_style) { - QRegExp color_regex("#[0-9a-f]{6}", Qt::CaseInsensitive); - QRegExp all_to_color_regex("\\s*all\\s*->\\s*#[0-9a-f]{6}\\s*", Qt::CaseInsensitive); - QRegExp color_to_color_regex("\\s*(#[0-9a-f]{6}\\s*->\\s*#[0-9a-f]{6}\\s*,\\s*)*#[0-9a-f]{6}\\s*->\\s*#[0-9a-f]{6}\\s*", Qt::CaseInsensitive); - if (all_to_color_regex.exactMatch(color_style)) + QRegularExpression color_regex("#[0-9a-f]{6}", QRegularExpression::CaseInsensitiveOption); + QRegularExpression all_to_color_regex("\\s*all\\s*->\\s*#[0-9a-f]{6}\\s*", QRegularExpression::CaseInsensitiveOption); + QRegularExpression color_to_color_regex("\\s*(#[0-9a-f]{6}\\s*->\\s*#[0-9a-f]{6}\\s*,\\s*)*#[0-9a-f]{6}\\s*->\\s*#[0-9a-f]{6}\\s*", QRegularExpression::CaseInsensitiveOption); + if (all_to_color_regex.match(color_style).hasMatch()) { - color_regex.indexIn(color_style); - QString color = color_regex.cap(0); + QString color = color_regex.match(color_style).captured(); svg_data.replace(color_regex, color.toUtf8()); } - else if (color_to_color_regex.exactMatch(color_style)) + else if (color_to_color_regex.match(color_style).hasMatch()) { QString copy = color_style; copy = copy.simplified(); @@ -45,7 +45,7 @@ namespace hal QString from_color = string.left(7); QString to_color = string.right(7); - QRegExp regex(from_color); + QRegularExpression regex(from_color); svg_data.replace(regex, to_color.toUtf8()); } } diff --git a/plugins/gui/src/pin_model/pin_model.cpp b/plugins/gui/src/pin_model/pin_model.cpp index 3448276a7dd5..d7e48c317e7f 100644 --- a/plugins/gui/src/pin_model/pin_model.cpp +++ b/plugins/gui/src/pin_model/pin_model.cpp @@ -379,8 +379,8 @@ namespace hal //TODO change pinItems name within function and not after its call QString name = newName; - QRegExp rx("[A-Za-z]([A-Za-z]|\\d|_|\\(|\\))*"); - QValidator* val = new QRegExpValidator(rx, this); + QRegularExpression rx("^[A-Za-z]([A-Za-z]|\\d|_|\\(|\\))*$"); + QValidator* val = new QRegularExpressionValidator(rx, this); int pos = 0; if(val->validate(name, pos) != QValidator::Acceptable) return false; @@ -418,8 +418,8 @@ namespace hal //TODO change pinItems name within function and not after its call QString name = newName; - QRegExp rx("[A-Za-z]([A-Za-z]|\\d|_|\\(|\\))*"); - QValidator* val = new QRegExpValidator(rx, this); + QRegularExpression rx("^[A-Za-z]([A-Za-z]|\\d|_|\\(|\\))*$"); + QValidator* val = new QRegularExpressionValidator(rx, this); int pos = 0; if(val->validate(name, pos) != QValidator::Acceptable) return false; //Check if name is already in use diff --git a/plugins/gui/src/plugin_relay/gui_plugin_manager.cpp b/plugins/gui/src/plugin_relay/gui_plugin_manager.cpp index ecf423e67a91..455f58d7e14e 100644 --- a/plugins/gui/src/plugin_relay/gui_plugin_manager.cpp +++ b/plugins/gui/src/plugin_relay/gui_plugin_manager.cpp @@ -658,7 +658,7 @@ namespace hal { reStr = "Default (.*) Parser"; else if (mFeature == FacExtensionInterface::FacGatelibWriter || mFeature == FacExtensionInterface::FacNetlistWriter) reStr = "Default (.*) Writer"; - QRegExp re(reStr, Qt::CaseInsensitive); + QRegularExpression reFileType(reStr, QRegularExpression::CaseInsensitiveOption); QString retval; @@ -676,9 +676,10 @@ namespace hal { for (auto it = pluginMap.constBegin(); it != pluginMap.constEnd(); ++it) { QString label = it.value(); - QString fileFmt = (re.indexIn(label) < 0) - ? label.remove(QChar(':')) - : re.cap(1) + QString(" files "); + QRegularExpressionMatch reFileTypeMatch = reFileType.match(label); + QString fileFmt = (reFileTypeMatch.hasMatch()) + ? reFileTypeMatch.captured(1) + QString(" files ") + : label.remove(QChar(':')); if (formatMap.contains(fileFmt)) formatMap[fileFmt] += " *" + it.key(); else diff --git a/plugins/gui/src/python/python_thread.cpp b/plugins/gui/src/python/python_thread.cpp index d894ada5f758..adb18ff8850d 100644 --- a/plugins/gui/src/python/python_thread.cpp +++ b/plugins/gui/src/python/python_thread.cpp @@ -25,12 +25,12 @@ namespace hal { : QThread(parent), mScript(script), mSingleStatement(singleStatement), mAbortRequested(false), mSpamCount(0) { - // qDebug() << "+++PythonThread" << hex << (quintptr) this; + // qDebug() << "+++PythonThread" << QString::number((quintptr) this, 16); } PythonThread::~PythonThread() { - // qDebug() << "---PythonThread" << hex << (quintptr) this; + // qDebug() << "---PythonThread" << QString::number((quintptr) this, 16); } void PythonThread::run() diff --git a/plugins/logic_evaluator/src/logic_evaluator_truthtable.cpp b/plugins/logic_evaluator/src/logic_evaluator_truthtable.cpp index fe879e6ec904..56760f757af9 100644 --- a/plugins/logic_evaluator/src/logic_evaluator_truthtable.cpp +++ b/plugins/logic_evaluator/src/logic_evaluator_truthtable.cpp @@ -138,9 +138,9 @@ namespace hal { if (i) layout->addStretch(); layout->addWidget(new QLabel(QString("%1%2 sort key").arg(i+1).arg(i<3?ordinal[i]:ordinal[2]),this)); mSortKey[i] = new QComboBox(this); - mSortKey[i]->addItem("--not used--", (const void*) nullptr); + mSortKey[i]->addItem("--not used--", QVariant::fromValue(nullptr)); for (const Net* n : mNets) - mSortKey[i]->addItem(QString::fromStdString(n->get_name()),(const void*)n); + mSortKey[i]->addItem(QString::fromStdString(n->get_name()),QVariant::fromValue((const void*)n)); layout->addWidget(mSortKey[i]); } QDialogButtonBox* bbox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); diff --git a/plugins/simulator/netlist_simulator_controller/src/saleae_file.cpp b/plugins/simulator/netlist_simulator_controller/src/saleae_file.cpp index bb718a945f9c..a1ef57e5c431 100644 --- a/plugins/simulator/netlist_simulator_controller/src/saleae_file.cpp +++ b/plugins/simulator/netlist_simulator_controller/src/saleae_file.cpp @@ -440,7 +440,6 @@ namespace hal SaleaeOutputFile::~SaleaeOutputFile() { - // qDebug() << good() << "~SaleaeOutputFile" << hex << (quintptr) this; if (good()) close(); } diff --git a/plugins/simulator/waveform_viewer/include/waveform_viewer/wave_widget.h b/plugins/simulator/waveform_viewer/include/waveform_viewer/wave_widget.h index 12da6114452b..00c8e98638b6 100644 --- a/plugins/simulator/waveform_viewer/include/waveform_viewer/wave_widget.h +++ b/plugins/simulator/waveform_viewer/include/waveform_viewer/wave_widget.h @@ -37,6 +37,7 @@ #include "waveform_viewer/wave_item.h" #include "waveform_viewer/wave_selection_dialog.h" #include "netlist_simulator_controller/netlist_simulator_controller.h" +#include "gui/module_model/module_item.h" namespace hal { diff --git a/plugins/simulator/waveform_viewer/src/wave_graphics_canvas.cpp b/plugins/simulator/waveform_viewer/src/wave_graphics_canvas.cpp index 9f324277e437..75a484cd764d 100644 --- a/plugins/simulator/waveform_viewer/src/wave_graphics_canvas.cpp +++ b/plugins/simulator/waveform_viewer/src/wave_graphics_canvas.cpp @@ -244,7 +244,7 @@ namespace hal { if (newScale >= 100) return; if (newScale*mTransform.deltaT()*1.2width() && newScale < oldScale) return; double tEvent = (evt->modifiers() & Qt::ShiftModifier) - ? mScrollbar->tPosF(evt->pos().x()) + ? mScrollbar->tPosF(evt->position().x()) : mCursorTime; mTransform.setScale(newScale); diff --git a/plugins/simulator/waveform_viewer/src/wave_item.cpp b/plugins/simulator/waveform_viewer/src/wave_item.cpp index 521bc853e107..cdacf50f9b16 100644 --- a/plugins/simulator/waveform_viewer/src/wave_item.cpp +++ b/plugins/simulator/waveform_viewer/src/wave_item.cpp @@ -240,7 +240,7 @@ namespace hal { setState(Painted); } else - qDebug() << mData->fileIndex() << "invalid state when terminating thread" << mState << hex << (quintptr) mLoader << dec; + qDebug() << mData->fileIndex() << "invalid state when terminating thread" << mState << QString::number((quintptr) mLoader, 16); mLoader->deleteLater(); mLoader = nullptr; mMutex.unlock(); diff --git a/plugins/simulator/waveform_viewer/src/wave_tree_model.cpp b/plugins/simulator/waveform_viewer/src/wave_tree_model.cpp index fcfe13b77dd4..00730bd8b107 100644 --- a/plugins/simulator/waveform_viewer/src/wave_tree_model.cpp +++ b/plugins/simulator/waveform_viewer/src/wave_tree_model.cpp @@ -8,13 +8,13 @@ #include "waveform_viewer/wave_graphics_canvas.h" #include "hal_core/utilities/json_write_document.h" #include "rapidjson/document.h" -#include "rapidjson/reader.h" #include "rapidjson/filereadstream.h" #include #include #include #include #include +#include namespace hal { @@ -470,7 +470,7 @@ namespace hal { if (index.column() != 2) return QVariant(); int v = valueAtCursor(index); if (v == SaleaeDataTuple::sReadError) - return QColor::fromRgb(255,255,qrand()%256); + return QColor::fromRgb(255,255,QRandomGenerator::global()->bounded(256)); if (v<-1) v=-1; if (v>1) v=1; return QColor(NetlistSimulatorControllerPlugin::sSimulationSettings->color((SimulationSettings::ColorSetting) (SimulationSettings::Value0+v))); diff --git a/plugins/simulator/waveform_viewer/src/wave_widget.cpp b/plugins/simulator/waveform_viewer/src/wave_widget.cpp index 44d7e4bae525..99f401ef5200 100644 --- a/plugins/simulator/waveform_viewer/src/wave_widget.cpp +++ b/plugins/simulator/waveform_viewer/src/wave_widget.cpp @@ -26,7 +26,6 @@ #include "gui/grouping/grouping_manager_widget.h" #include "gui/grouping/grouping_table_model.h" #include "gui/selection_details_widget/selection_details_widget.h" -#include "gui/module_model/module_item.h" #include "gui/gui_globals.h" namespace hal { From 2b79109cd6137b45cf216bca9d3ce5fbc84b351f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 21 Jan 2026 13:29:41 +0100 Subject: [PATCH 09/28] CI workflows restored --- .github/workflows/macOS.yml | 138 +++++++++++++++++++++++++ .github/workflows/releaseDoc.yml | 162 ++++++++++++++++++++++++++++++ .github/workflows/ubuntu22.04.yml | 133 ++++++++++++++++++++++++ .github/workflows/ubuntu24.04.yml | 133 ++++++++++++++++++++++++ 4 files changed, 566 insertions(+) create mode 100644 .github/workflows/macOS.yml create mode 100644 .github/workflows/releaseDoc.yml create mode 100644 .github/workflows/ubuntu22.04.yml create mode 100644 .github/workflows/ubuntu24.04.yml diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml new file mode 100644 index 000000000000..85bc98f04b10 --- /dev/null +++ b/.github/workflows/macOS.yml @@ -0,0 +1,138 @@ +name: macOS + +on: + push: +# create: +# tags: +# - v* + +jobs: + build-test: + name: Build and Test macOS + + strategy: + matrix: + # runs-on: [ubuntu-latest, macOS-latest] + runs-on: [macOS-latest] + fail-fast: false + + runs-on: ${{ matrix.runs-on }} + + steps: + - name: Checkout + uses: actions/checkout@v1 + + + - name: Cache pip macOS + uses: actions/cache@v4 + if: startsWith(runner.os, 'macOS') + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Cache Homebrew Downloads + if: startsWith(runner.os, 'macOS') + uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew + # key: ${{ runner.OS }}-build-downloads-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.OS }}-build-downloads + restore-keys: | + ${{ runner.OS }}-build-downloads-${{ env.cache-name }}- + ${{ runner.OS }}-build-downloads- + +# - name: Cache Homebrew +# if: matrix.os == 'macOS-latest' +# uses: actions/cache@v4 +# with: +# path: /usr/local/Homebrew +# # key: ${{ runner.OS }}-build-localbrew-${{ hashFiles('**/package-lock.json') }} +# key: ${{ runner.OS }}-build-localbrew +# restore-keys: | +# ${{ runner.OS }}-build-localbrew-${{ env.cache-name }}- +# ${{ runner.OS }}-build-localbrew- + + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + + - name: ccache cache files + uses: actions/cache@v4 + with: + path: ${{runner.workspace}}/.ccache + key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: | + ${{ runner.OS }}-ccache- + + - name: Install Dependencies + run: ./install_dependencies.sh + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + if: startsWith(runner.os, 'macOS') + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + # brew link --force qt@5 + run: | + mkdir -p build + cd build + export PATH="$(brew --prefix qt@5)/bin:$PATH" + export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON + env: + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 500M + + - name: Build + if: startsWith(runner.os, 'macOS') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + export PATH="$(brew --prefix qt@5)/bin:$PATH" + export BUILD_TYPE=Debug + export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + export SDKROOT=$(xcrun --show-sdk-path) + cmake --build . --target all --clean-first --config $BUILD_TYPE + env: + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 500M + +# - name: Setup tmate session +# uses: mxschmitt/action-tmate@v1 + + - name: Test + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + cd build + export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + ctest --rerun-failed --output-on-failure + # ninja -v hal_coverage + # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" + env: + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 500M diff --git a/.github/workflows/releaseDoc.yml b/.github/workflows/releaseDoc.yml new file mode 100644 index 000000000000..8a5cc839a441 --- /dev/null +++ b/.github/workflows/releaseDoc.yml @@ -0,0 +1,162 @@ +name: Build Documentation + +on: + push: +# create: +# tags: +# - v* + +jobs: + release-doc: + name: Build and release documentation + + strategy: + matrix: + # runs-on: [ ubuntu-20.04, macOS-latest] + runs-on: [ ubuntu-22.04 ] + fail-fast: false + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: actions/checkout@v2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - run: | + git fetch --prune --unshallow + + - name: Cache pip Linux + uses: actions/cache@v4 + if: startsWith(runner.os, 'Linux') + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Cache pip macOS + uses: actions/cache@v4 + if: startsWith(runner.os, 'macOS') + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: ccache cache files + uses: actions/cache@v4 + with: + path: ${{runner.workspace}}/.ccache + key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: | + ${{ runner.OS }}-ccache- + + - name: Install Dependencies + run: ./install_dependencies.sh + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Cache CCache + uses: actions/cache@v4 + with: + path: ~/.ccache + # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.OS }}-build-ccache + restore-keys: | + ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- + ${{ runner.OS }}-build-ccache- + + - name: Configure CMake + if: startsWith(runner.os, 'Linux') + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + run: | + mkdir -p build/doc + cd build + echo "==> Disk usage before clean" + df -h . + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/hostedtoolcache + echo "==> Disk usage after clean" + df -h . + export BUILD_TYPE=Debug + cp -v $GITHUB_WORKSPACE/documentation/index.html doc/ + cp -v $GITHUB_WORKSPACE/documentation/hal_screenshot.* doc/ + ls -l doc + $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE + cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Build + if: startsWith(runner.os, 'Linux') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + ninja + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Build Doxygen + if: startsWith(runner.os, 'Linux') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + export BUILD_TYPE=Debug + mkdir -p doc/doc + cmake --build . --target doc --config $BUILD_TYPE + cp -R documentation/cpp-doc/html/* doc/doc/ + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Build Sphinx + if: startsWith(runner.os, 'Linux') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + export BUILD_TYPE=Debug + mkdir -p doc/pydoc + cmake --build . --target pydoc --config $BUILD_TYPE + cp -R documentation/python-doc/html/* doc/pydoc/ + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + + - name: Deploy Doc + if: github.ref == 'refs/heads/master' + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + BRANCH: gh-pages + ACCESS_TOKEN: ${{ secrets.GH_PAGES_TOKEN}} + FOLDER: build/doc + GIT_CONFIG_NAME: 'github-actions[bot]' + GIT_CONFIG_EMAIL: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/ubuntu22.04.yml b/.github/workflows/ubuntu22.04.yml new file mode 100644 index 000000000000..a6fd37d51ed0 --- /dev/null +++ b/.github/workflows/ubuntu22.04.yml @@ -0,0 +1,133 @@ +name: Ubuntu 22.04 + +on: + push: +# create: +# tags: +# - v* + +jobs: + build_ubuntu_22_04: + name: Build and Test on Ubuntu 22.04 + + strategy: + matrix: + # runs-on: [ ubuntu-20.04, macOS-latest] + runs-on: [ ubuntu-22.04 ] + fail-fast: false + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: actions/checkout@v2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - run: | + git fetch --prune --unshallow + + - name: Cache pip Linux + uses: actions/cache@v4 + if: startsWith(runner.os, 'Linux') + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Cache pip macOS + uses: actions/cache@v4 + if: startsWith(runner.os, 'macOS') + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: ccache cache files + uses: actions/cache@v4 + with: + path: ${{runner.workspace}}/.ccache + key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: | + ${{ runner.OS }}-ccache- + + - name: Install Dependencies + run: ./install_dependencies.sh + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Cache CCache + uses: actions/cache@v4 + with: + path: ~/.ccache + # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.OS }}-build-ccache + restore-keys: | + ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- + ${{ runner.OS }}-build-ccache- + + - name: Configure CMake + if: startsWith(runner.os, 'Linux') + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + run: | + mkdir -p build/doc + cd build + export BUILD_TYPE=Debug + cp $GITHUB_WORKSPACE/documentation/index.html doc/ + $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE + cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Build + if: startsWith(runner.os, 'Linux') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + echo "==> Disk usage before clean" + df -h . + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/hostedtoolcache + echo "==> Disk usage after clean" + df -h . + ninja + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Test + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + cd build + ctest --rerun-failed --output-on-failure + # ninja -v hal_coverage + # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" + env: + LDFLAGS: "-L/usr/local/opt/qt/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" + CPPFLAGS: "-I/usr/local/opt/qt/include -I/usr/local/opt/llvm/include" + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M \ No newline at end of file diff --git a/.github/workflows/ubuntu24.04.yml b/.github/workflows/ubuntu24.04.yml new file mode 100644 index 000000000000..0fc3f5463a90 --- /dev/null +++ b/.github/workflows/ubuntu24.04.yml @@ -0,0 +1,133 @@ +name: Ubuntu 24.04 + +on: + push: +# create: +# tags: +# - v* + +jobs: + build_ubuntu_24_04: + name: Build and Test on Ubuntu 24.04 + + strategy: + matrix: + # runs-on: [ ubuntu-22.04, macOS-latest] + runs-on: [ ubuntu-24.04 ] + fail-fast: false + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: actions/checkout@v2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - run: | + git fetch --prune --unshallow + + - name: Cache pip Linux + uses: actions/cache@v4 + if: startsWith(runner.os, 'Linux') + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Cache pip macOS + uses: actions/cache@v4 + if: startsWith(runner.os, 'macOS') + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: ccache cache files + uses: actions/cache@v4 + with: + path: ${{runner.workspace}}/.ccache + key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: | + ${{ runner.OS }}-ccache- + + - name: Install Dependencies + run: ./install_dependencies.sh + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Cache CCache + uses: actions/cache@v4 + with: + path: ~/.ccache + # key: ${{ runner.OS }}-build-ccache-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.OS }}-build-ccache + restore-keys: | + ${{ runner.OS }}-build-ccache-${{ env.cache-name }}- + ${{ runner.OS }}-build-ccache- + + - name: Configure CMake + if: startsWith(runner.os, 'Linux') + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + run: | + mkdir -p build/doc + cd build + export BUILD_TYPE=Debug + cp $GITHUB_WORKSPACE/documentation/index.html doc/ + $GITHUB_WORKSPACE/tools/genversion.py $GITHUB_WORKSPACE + cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DPL_GUI=ON -DBUILD_DOCUMENTATION=ON -DPACKAGE_DEB=OFF -DCMAKE_INSTALL_PREFIX=/usr/ -DPYBIND11_PYTHON_VERSION=3.6 + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Build + if: startsWith(runner.os, 'Linux') + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: | + cd build + echo "==> Disk usage before clean" + df -h . + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/hostedtoolcache + echo "==> Disk usage after clean" + df -h . + ninja + env: + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + + - name: Test + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + cd build + ctest --rerun-failed --output-on-failure + # ninja -v hal_coverage + # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" + env: + LDFLAGS: "-L/usr/local/opt/qt/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" + CPPFLAGS: "-I/usr/local/opt/qt/include -I/usr/local/opt/llvm/include" + HAL_BASE_PATH: ${{runner.workspace}}/hal/build + CCACHE_DIR: ${{runner.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_COMPRESSLEVEL: 6 + CCACHE_MAXSIZE: 400M \ No newline at end of file From 79f7b8517a707a75cbc22d7b95d7f88131312250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Thu, 22 Jan 2026 15:41:20 +0100 Subject: [PATCH 10/28] typo in package name, should be 'qt6-base-dev' --- install_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 40e6b98dda34..c49bc2f564ab 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -72,7 +72,7 @@ elif [[ "$platform" == 'linux' ]]; then if [ "$distribution" == 'Ubuntu' ] || [ "$distribution" == 'LinuxMint' ]; then sudo apt-get update && sudo apt-get install -y build-essential verilator \ - lsb-release git cmake pkgconf libboost-all-dev qtbase6-dev \ + lsb-release git cmake pkgconf libboost-all-dev qt6-base-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ @@ -110,7 +110,7 @@ elif [[ "$platform" == 'linux' ]]; then elif [[ "$platform" == 'docker' ]]; then # We can assume that we are in a ubuntu container, because of the official Dockerfile in the hal project apt-get update && apt-get install -y build-essential verilator \ - lsb-release git cmake pkgconf libboost-all-dev qtbase6-dev \ + lsb-release git cmake pkgconf libboost-all-dev qt6-base-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ From bbf6a42e0a4467fec82aab90011ba48cbd1b8601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Thu, 29 Jan 2026 15:21:09 +0100 Subject: [PATCH 11/28] Added line in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ad75420d82..87498428bf45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +* updated to Qt major version 6 comes with a lot of code fixes * added information to GUI setting file so that widgets position and size from previous session gets restored * plugins * changed behavior of GUI plugin manager to keep only those plugins loaded which are requested by user From 2298eb9075e1108042f1e63d10954513956ac6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Tue, 3 Feb 2026 12:30:21 +0100 Subject: [PATCH 12/28] Added xkb development package --- install_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index c49bc2f564ab..7601bcfdc726 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -77,7 +77,7 @@ elif [[ "$platform" == 'linux' ]]; then libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev z3 \ - libreadline-dev apport python3-dateutil libgraphviz-dev \ + libreadline-dev apport python3-dateutil libgraphviz-dev libxcb-xkb-dev \ $additional_deps \ graphviz libomp-dev libsuitesparse-dev # For documentation elif [[ "$distribution" == "Arch" ]]; then @@ -115,6 +115,6 @@ elif [[ "$platform" == 'docker' ]]; then libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 python3-dateutil rapidjson-dev \ - libspdlog-dev libz3-dev libreadline-dev \ + libspdlog-dev libz3-dev libreadline-dev libxcb-xkb-dev \ graphviz libomp-dev libsuitesparse-dev # For documentation fi From 9461325ad7a4028a7c7514ea129f46ab1eab70b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 4 Feb 2026 00:42:18 +0100 Subject: [PATCH 13/28] Added Qt core5 compat package --- install_dependencies.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 7601bcfdc726..603f9579366b 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -74,7 +74,8 @@ elif [[ "$platform" == 'linux' ]]; then sudo apt-get update && sudo apt-get install -y build-essential verilator \ lsb-release git cmake pkgconf libboost-all-dev qt6-base-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ - libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ + libqt6svg6-dev libqt6svg6* libqt6core5compat6 qt6-5compat-dev \ + ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev z3 \ libreadline-dev apport python3-dateutil libgraphviz-dev libxcb-xkb-dev \ @@ -112,7 +113,8 @@ elif [[ "$platform" == 'docker' ]]; then apt-get update && apt-get install -y build-essential verilator \ lsb-release git cmake pkgconf libboost-all-dev qt6-base-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ - libqt6svg6-dev libqt6svg6* ninja-build lcov gcovr python3-sphinx \ + libqt6svg6-dev libqt6svg6* libqt6core5compat6 qt6-5compat-dev \ + ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 python3-dateutil rapidjson-dev \ libspdlog-dev libz3-dev libreadline-dev libxcb-xkb-dev \ From 2575f3974d67ec6c22e2295a22f62dfbcd17ffad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 4 Feb 2026 14:12:56 +0100 Subject: [PATCH 14/28] Take into account that package was renamed from Ubuntu 22 -> 23 --- install_dependencies.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 603f9579366b..673c45ec51ee 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -15,6 +15,7 @@ elif [[ "$unamestr" == 'Linux' ]]; then elif [[ "$unamestr" == 'Darwin' ]]; then platform='macOS' fi +major=${release%%.*} if [[ "$platform" == 'macOS' ]]; then echo "Executing brew bundle" @@ -70,11 +71,15 @@ if [[ "$platform" == 'macOS' ]]; then elif [[ "$platform" == 'linux' ]]; then . /etc/os-release if [ "$distribution" == 'Ubuntu' ] || [ "$distribution" == 'LinuxMint' ]; then - + if [[ "$major" -le 22 ]]; then + additional_deps="libqt6core5compat6-dev" + else + additional_deps="qt6-5compat-dev" + fi sudo apt-get update && sudo apt-get install -y build-essential verilator \ lsb-release git cmake pkgconf libboost-all-dev qt6-base-dev \ libpython3-dev ccache autoconf autotools-dev libsodium-dev \ - libqt6svg6-dev libqt6svg6* libqt6core5compat6 qt6-5compat-dev \ + libqt6svg6-dev libqt6svg6* \ ninja-build lcov gcovr python3-sphinx \ doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \ pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev z3 \ From 42191b8e8211c42e7a5cfa0aace81c6e547b6858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Sat, 7 Feb 2026 18:58:42 +0100 Subject: [PATCH 15/28] Remove explicit link to Qt5 from macOS Brew/Build --- .github/workflows/macOS.yml | 14 +++++++------- Brewfile | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 85bc98f04b10..7945538ae871 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -85,13 +85,13 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - # brew link --force qt@5 + # brew link --force qt run: | mkdir -p build cd build - export PATH="$(brew --prefix qt@5)/bin:$PATH" - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" - cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON + export PATH="$(brew --prefix qt)/bin:$PATH" + export LDFLAGS="-L$(brew --prefix qt)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON env: HAL_BASE_PATH: ${{runner.workspace}}/hal/build CCACHE_DIR: ${{runner.workspace}}/.ccache @@ -105,9 +105,9 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: | cd build - export PATH="$(brew --prefix qt@5)/bin:$PATH" + export PATH="$(brew --prefix qt)/bin:$PATH" export BUILD_TYPE=Debug - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + export LDFLAGS="-L$(brew --prefix qt)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" export SDKROOT=$(xcrun --show-sdk-path) cmake --build . --target all --clean-first --config $BUILD_TYPE env: @@ -126,7 +126,7 @@ jobs: # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: | cd build - export LDFLAGS="-L$(brew --prefix qt@5)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" + export LDFLAGS="-L$(brew --prefix qt)/lib -Wl,-rpath,$(brew --prefix llvm)/lib" ctest --rerun-failed --output-on-failure # ninja -v hal_coverage # bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" diff --git a/Brewfile b/Brewfile index c260f2f189f3..e36983c06d35 100644 --- a/Brewfile +++ b/Brewfile @@ -1,6 +1,6 @@ brew "pkgconfig" brew "lcov" -brew "qt@5" +brew "qt" brew "ccache" brew "llvm" brew "libomp" From 6e1f022c519808fa08284d96dda8ffd2a374a38f Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Thu, 2 Apr 2026 13:52:34 +0200 Subject: [PATCH 16/28] Fix build on MacOS --- plugins/gui/CMakeLists.txt | 4 +-- .../include/gui/hal_qt_compat/hal_qt_compat.h | 36 ++++++++++++++++--- .../gui/src/hal_qt_compat/hal_qt_compat.cpp | 5 ++- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/plugins/gui/CMakeLists.txt b/plugins/gui/CMakeLists.txt index 85d451ffa3be..c1917210d276 100644 --- a/plugins/gui/CMakeLists.txt +++ b/plugins/gui/CMakeLists.txt @@ -58,8 +58,6 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) aux_source_directory(${SRCROOT} SRC) file(GLOB_RECURSE RSRC ${RSRCROOT}/*.qrc) - qt6_wrap_cpp(MOC_source ${SRC}) - foreach(i IN ITEMS "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO") foreach(j IN ITEMS "RUNTIME" "ARCHIVE" "LIBRARY") set(STORE_${j}_OUTDIR${i} ${CMAKE_${j}_OUTPUT_DIRECTORY${i}}) @@ -120,6 +118,8 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) file(WRITE "${RSRCROOT}/path/gate_library_definitions.txt" "${GLDIR}") hal_plugin_documentation(gui SPHINX_DOC_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/documentation/gui.rst) +# qt6_wrap_cpp(MOC_source ${SRC} TARGET gui) + install(TARGETS gui EXPORT hal LIBRARY DESTINATION ${PLUGIN_LIBRARY_INSTALL_DIRECTORY} diff --git a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h index 104d12dea7d7..4836ce1455d8 100644 --- a/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h +++ b/plugins/gui/include/gui/hal_qt_compat/hal_qt_compat.h @@ -52,12 +52,40 @@ namespace hal { QString dateToLocaleString(const QDateTime &dt); - template extern QSet listToSet(const QList& list); + template extern QSet listToSet(const QList& list) + { + #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QSet(list.constBegin(),list.constEnd()); + #else + return QSet::fromList(list); + #endif + } - template extern QList setToList(const QSet& cset); + template extern QList setToList(const QSet& cset) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QList(cset.constBegin(),cset.constEnd()); +#else + return QList::fromset(list); +#endif + } - template extern QVector listToVector(const QList& list); + template extern QVector listToVector(const QList& list) + { + #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QVector(list.constBegin(),list.constEnd()); + #else + return QVector::fromList(list); + #endif + } - template extern QVector stdVectorToVector(const std::vector& vec); + template extern QVector stdVectorToVector(const std::vector& vec) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return QVector(vec.begin(),vec.end()); +#else + return QVector::fromStdVector(vec); +#endif + } } } diff --git a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp index ae12de7b777b..879c5263b5f9 100644 --- a/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp +++ b/plugins/gui/src/hal_qt_compat/hal_qt_compat.cpp @@ -42,7 +42,7 @@ namespace hal { return qHash(p); #endif } - +/* template QSet QtCompat::listToSet(const QList& list) { @@ -65,6 +65,7 @@ namespace hal { template QVector QtCompat::listToVector(const QList& list) + { #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) return QVector(list.constBegin(),list.constEnd()); @@ -73,6 +74,7 @@ namespace hal { #endif } + template extern QVector QtCompat::stdVectorToVector(const std::vector& vec) { #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) @@ -81,6 +83,7 @@ namespace hal { return QVector::fromStdVector(vec); #endif } + */ void QtCompat::setMarginWidth(QLayout* layout, int marginWidth) { From 1ee1e9aa473fb9d0bc9c24d2eac2d05f39e8cbe9 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Thu, 2 Apr 2026 15:05:07 +0200 Subject: [PATCH 17/28] Update graphics_scene.h [Feature/Qt6] Fix build on MacOS --- plugins/gui/include/gui/graph_widget/graphics_scene.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gui/include/gui/graph_widget/graphics_scene.h b/plugins/gui/include/gui/graph_widget/graphics_scene.h index ba7b852f5600..236b6e2bd543 100644 --- a/plugins/gui/include/gui/graph_widget/graphics_scene.h +++ b/plugins/gui/include/gui/graph_widget/graphics_scene.h @@ -105,7 +105,7 @@ namespace hal * @param pos - The position to snap to the grid * @returns the closest position on the grid */ - static QPointF snapToGrid(const QPointF& pos) Q_DECL_DEPRECATED; + static QPointF snapToGrid(const QPointF& pos); /** * Constructor. From 3d645bd60eb5a2aecf8740b877267c0b834cf76d Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:33:17 +0200 Subject: [PATCH 18/28] Create build_and_test.sh [feature/qt6] Fix verilator result file path being doubled in simulator controller. Error appeared in tests on MacOS --- build_and_test.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 build_and_test.sh diff --git a/build_and_test.sh b/build_and_test.sh new file mode 100644 index 000000000000..68b20e0d68ff --- /dev/null +++ b/build_and_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")" + +rm -rf build +mkdir build +cd build + +cmake -G Ninja .. \ + -DQt6_DIR="$(brew --prefix qt)/lib/cmake/Qt6" \ + -DPL_GUI=ON \ + -DCMAKE_C_COMPILER="$(brew --prefix llvm)/bin/clang" \ + -DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" \ + -DBUILD_ALL_PLUGINS=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTS=ON + +ninja From 6c14bd6b3918b3ad81ad7843bbb3334af913af47 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:35:28 +0200 Subject: [PATCH 19/28] Revert "Create build_and_test.sh" This reverts commit 3d645bd60eb5a2aecf8740b877267c0b834cf76d. --- build_and_test.sh | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 build_and_test.sh diff --git a/build_and_test.sh b/build_and_test.sh deleted file mode 100644 index 68b20e0d68ff..000000000000 --- a/build_and_test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -set -e - -cd "$(dirname "$0")" - -rm -rf build -mkdir build -cd build - -cmake -G Ninja .. \ - -DQt6_DIR="$(brew --prefix qt)/lib/cmake/Qt6" \ - -DPL_GUI=ON \ - -DCMAKE_C_COMPILER="$(brew --prefix llvm)/bin/clang" \ - -DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" \ - -DBUILD_ALL_PLUGINS=ON \ - -DCMAKE_BUILD_TYPE=Debug \ - -DBUILD_TESTS=ON - -ninja From 0711ab7ca6d6ef85c4d0c549e0d3d5aea22001d8 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:37:03 +0200 Subject: [PATCH 20/28] [feature/qt6] Fix for tests on MacOS [feature/qt6] Fix verilator result file path being doubled in simulator controller. Error appeared in tests on MacOS --- plugins/simulator/verilator/src/verilator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/simulator/verilator/src/verilator.cpp b/plugins/simulator/verilator/src/verilator.cpp index c3d6442e95b4..0f94032080bf 100644 --- a/plugins/simulator/verilator/src/verilator.cpp +++ b/plugins/simulator/verilator/src/verilator.cpp @@ -301,7 +301,7 @@ namespace hal bool VerilatorEngine::finalize() { - mResultFilename = std::string(m_simulator_dir / "waveform.vcd"); + mResultFilename = "waveform.vcd"; mState = Done; return true; } From 260e21d617e90a079026295c4aee22ec240242ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 8 Apr 2026 14:50:42 +0200 Subject: [PATCH 21/28] Dependency added for Ubuntu 22 build --- install_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 673c45ec51ee..b2d23ef13d1c 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -72,7 +72,7 @@ elif [[ "$platform" == 'linux' ]]; then . /etc/os-release if [ "$distribution" == 'Ubuntu' ] || [ "$distribution" == 'LinuxMint' ]; then if [[ "$major" -le 22 ]]; then - additional_deps="libqt6core5compat6-dev" + additional_deps="libqt6core5compat6-dev libglu1-mesa-dev" else additional_deps="qt6-5compat-dev" fi From 0afafa70cfe66d35a6ab60f85eb235d247bd3087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Wed, 8 Apr 2026 15:36:41 +0200 Subject: [PATCH 22/28] Declare header for QHash --- plugins/gui/src/python/python_console_qss_adapter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/gui/src/python/python_console_qss_adapter.cpp b/plugins/gui/src/python/python_console_qss_adapter.cpp index 98613bd2716b..5bf65adf45bf 100644 --- a/plugins/gui/src/python/python_console_qss_adapter.cpp +++ b/plugins/gui/src/python/python_console_qss_adapter.cpp @@ -1,5 +1,6 @@ #include "gui/python/python_console_qss_adapter.h" #include +#include namespace hal { From e2b14d6f41f67cd7df3839dd759d650738662bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Thu, 9 Apr 2026 13:23:41 +0200 Subject: [PATCH 23/28] Fixed dataflow bug that caused a blocked thread when writing results --- CHANGELOG.md | 4 +++- plugins/dataflow_analysis/src/processing/processing.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8bb5f0dc83..ea82928761fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,9 @@ All notable changes to this project will be documented in this file. * added feature, selecting a waveform in viewer selects net in graph view as well * fixed bug in waveform viewer, make sure that deleting a controller causes closing the tab * added 'hover over node' feature in dot viewer - * fixed broken initialization of DANA plugin when starting via CLI + * dataflow + * fixed broken initialization of DANA plugin when starting via CLI + * fixed bug that caused a blocked thread when writing results * changed behavior of GUI plugin manager to keep only those plugins loaded which are requested by user * fixed bug in the bitorder propagation algorithm that would assign a wrong propagation order if pingroups with direction none were given as parameters diff --git a/plugins/dataflow_analysis/src/processing/processing.cpp b/plugins/dataflow_analysis/src/processing/processing.cpp index 7261dd4c9c92..f82ef942b65d 100644 --- a/plugins/dataflow_analysis/src/processing/processing.cpp +++ b/plugins/dataflow_analysis/src/processing/processing.cpp @@ -107,10 +107,10 @@ namespace hal } ctx.finished_passes++; - m_progress_printer.print_progress((float)ctx.finished_passes / ctx.current_passes.size(), - std::to_string(ctx.finished_passes) + "\\" + std::to_string(ctx.current_passes.size()) + " (" - + std::to_string(ctx.new_unique_groupings.size()) + " new results)"); } + m_progress_printer.print_progress((float)ctx.finished_passes / ctx.current_passes.size(), + std::to_string(ctx.finished_passes) + "\\" + std::to_string(ctx.current_passes.size()) + " (" + + std::to_string(ctx.new_unique_groupings.size()) + " new results)"); } } } From 6d681ab8a2f611307180dadbfbd181b4905fa943 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:09:20 +0200 Subject: [PATCH 24/28] [feature/qt6] Fix GUI freeze during dataflow analysis by skipping progress updates from worker threads --- plugins/gui/src/graph_widget/graph_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gui/src/graph_widget/graph_widget.cpp b/plugins/gui/src/graph_widget/graph_widget.cpp index e967a46fdef1..c44b1b737275 100644 --- a/plugins/gui/src/graph_widget/graph_widget.cpp +++ b/plugins/gui/src/graph_widget/graph_widget.cpp @@ -1066,7 +1066,7 @@ namespace hal void GraphWidget::pluginProgressIndicator(int percent, const std::string& msg) { - if (!sInstance || gPythonContext->pythonThread()) return; + if (!sInstance || gPythonContext->pythonThread() || QThread::currentThread() != qApp->thread()) return; if (percent==100) sInstance->handleSceneAvailable(); else From fa3036d5d888fe38aa68f6bab25eb660b846e232 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Wed, 15 Apr 2026 17:25:16 +0200 Subject: [PATCH 25/28] [feature/qt6] Migrate QRegExp to QRegularExpression --- plugins/gui/src/main_window/main_window.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/gui/src/main_window/main_window.cpp b/plugins/gui/src/main_window/main_window.cpp index c4b0289e48d9..c35c6607236f 100644 --- a/plugins/gui/src/main_window/main_window.cpp +++ b/plugins/gui/src/main_window/main_window.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -215,10 +215,11 @@ namespace hal if (it.second.empty()) continue; // no extensions registered QString label = QString::fromStdString(it.first); - QRegExp re("Default (.*) Writer", Qt::CaseInsensitive); - QString txt = (re.indexIn(label) < 0) - ? label.remove(QChar(':')) - : QString("Export as ") + re.cap(1); + QRegularExpression re("Default (.*) Writer", QRegularExpression::CaseInsensitiveOption); + QRegularExpressionMatch match = re.match(label); + QString txt = (match.hasMatch()) + ? QString("Export as ") + match.captured(1) + : label.remove(QChar(':')); QStringList extensions; extensions.append(txt); From 284f99c57fdb26c8a66f0d4e3cd64df1a73d4268 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:31:42 +0200 Subject: [PATCH 26/28] [feature/qt6] Remove unused includes from module_widget.cpp --- plugins/gui/src/module_widget/module_widget.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/gui/src/module_widget/module_widget.cpp b/plugins/gui/src/module_widget/module_widget.cpp index 487ad45348c3..8adcf5b04a49 100644 --- a/plugins/gui/src/module_widget/module_widget.cpp +++ b/plugins/gui/src/module_widget/module_widget.cpp @@ -20,14 +20,11 @@ #include #include #include -#include #include #include #include #include #include -#include -#include namespace hal { From 35358b131db3e2208fc98aa6842bc093c63149a1 Mon Sep 17 00:00:00 2001 From: Ari Haji <131377449+AriKHaji@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:29:01 +0200 Subject: [PATCH 27/28] Check index for tree insert --- plugins/gui/src/basic_tree_model/base_tree_item.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/gui/src/basic_tree_model/base_tree_item.cpp b/plugins/gui/src/basic_tree_model/base_tree_item.cpp index 2d7aad398509..75c2f03f1dc3 100644 --- a/plugins/gui/src/basic_tree_model/base_tree_item.cpp +++ b/plugins/gui/src/basic_tree_model/base_tree_item.cpp @@ -45,6 +45,10 @@ namespace hal void BaseTreeItem::insertChild(int index, BaseTreeItem *child) { child->setParent(this); + if (index > mChildren.size()) + { + index = mChildren.size(); + } mChildren.insert(index, child); } From f182b3ca755b5032963789e3eaa23388d122dcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Langheinrich?= Date: Thu, 27 Aug 2026 23:34:30 +0200 Subject: [PATCH 28/28] Anotated Qt version in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7234a714fdf..24383a95211e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ All notable changes to this project will be documented in this file. * dot viewer * added 'hover over node' feature in dot viewer * GUI + * changed major Qt version 5 -> 6 * fixed the GUI hanging for minutes when a module with many gates is selected, `ModuleModel` emitted a row insert signal per item while the model was already being reset, which made the attached filter proxy remap its rows once per item * fixed the GUI stalling when a large module is unfolded, the tree views measured every row individually and shaped the text of each gate name just to learn how tall the row is * changed the module elements tree to not rebuild itself twice per selection change