From bfb0827416bea16875995f15be681dbc8e0a2fd0 Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:22:42 +0200 Subject: [PATCH] Remove Qt 5 support As time goes by, it becomes more and more laborious to maintain two major Qt versions in parallel. We had many workarounds and missing features for the Qt 5 version, which had its last public release almost 4 years ago. Additionally, the system requirements for Qt 6 are not unreasonable, so the majority of people should be able to run it. So, for those reasons, we decided to remove Qt 5 support completely. Users that can't run the Qt 6 version for whatever reason, are free to either disable updates and stay on Notes 2.3.x, or manually build Notes off of the "qt5" branch. Co-authored-by: guihkx <626206+guihkx@users.noreply.github.com> --- .github/workflows/linux.yml | 27 +- .github/workflows/macos.yml | 56 +- .github/workflows/windows.yml | 101 +- CMakeLists.txt | 78 +- Dockerfiles/appimage-qt5 | 83 -- Dockerfiles/ubuntu-20_04 | 23 - docs/build_on_linux.md | 2 - docs/build_on_windows.md | 10 +- docs/build_options.md | 7 - .../windows/Notes_Inno_Script_Github.iss | 40 - snap/snapcraft.yaml | 1 - src/aboutwindow.cpp | 3 - src/dbmanager.cpp | 8 - src/fontloader.cpp | 8 - src/fontloader.h | 6 - src/framelesswindow.cpp | 12 +- src/framelesswindow.h | 4 - src/main.cpp | 4 - src/mainwindow.cpp | 25 +- src/nodepath.cpp | 4 - src/noteeditorlogic.cpp | 8 - src/notelistdelegate.cpp | 8 - src/notelistdelegateeditor.cpp | 4 - src/notelistdelegateeditor.h | 4 - src/notelistview.cpp | 21 - src/qml.qrc | 1 - src/qml/EditorSettingsQt512.qml | 945 ------------------ src/updaterwindow.cpp | 7 - 28 files changed, 68 insertions(+), 1432 deletions(-) delete mode 100644 Dockerfiles/appimage-qt5 delete mode 100644 Dockerfiles/ubuntu-20_04 delete mode 100644 src/qml/EditorSettingsQt512.qml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1cfa3179b..1305966b7 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,7 +9,7 @@ env: jobs: deb: - name: deb (${{ matrix.build-type }}, Qt ${{ matrix.qt-version-major }}, ${{ matrix.image }}) + name: deb (${{ matrix.build-type }}, Qt 6, ${{ matrix.image }}) runs-on: ubuntu-latest permissions: contents: read @@ -18,20 +18,12 @@ jobs: fail-fast: false matrix: include: - # Ubuntu's release cycle: https://wiki.ubuntu.com/Releases - - image: ubuntu-20_04 - build-script: ubuntu_deb_entrypoint.sh - qt-version-major: 5 - build-type: release - - image: ubuntu-22_04 build-script: ubuntu_deb_entrypoint.sh - qt-version-major: 6 build-type: release - image: ubuntu-23_10 build-script: ubuntu_deb_entrypoint.sh - qt-version-major: 6 build-type: release steps: - name: Checkout code @@ -75,7 +67,7 @@ jobs: uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: ${{ steps.build.outputs.deb_name }}-qt${{ matrix.qt-version-major }}-${{ steps.build.outputs.distro_name }}-${{ matrix.build-type }} + name: ${{ steps.build.outputs.deb_name }}-qt6-${{ steps.build.outputs.distro_name }}-${{ matrix.build-type }} path: ${{ steps.build.outputs.deb_path }} - name: Login to GitHub Container Registry @@ -104,7 +96,7 @@ jobs: tags: ${{ env.REGISTRY }}/nuttyartist/notes:${{ matrix.image }} rpm: - name: rpm (${{ matrix.build-type }}, Qt ${{ matrix.qt-version-major }}, ${{ matrix.image }}) + name: rpm (${{ matrix.build-type }}, Qt 6, ${{ matrix.image }}) runs-on: ubuntu-latest strategy: fail-fast: false @@ -113,13 +105,11 @@ jobs: # Fedora's release cycle: https://endoflife.date/fedora - image: fedora-38 build-script: rpm_entrypoint.sh - qt-version-major: 6 build-type: release # openSUSE's release cycle: https://endoflife.date/opensuse - image: opensuse-15_5 build-script: rpm_entrypoint.sh - qt-version-major: 6 build-type: release steps: - name: Checkout code @@ -163,7 +153,7 @@ jobs: uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: ${{ steps.build.outputs.rpm_name }}-qt${{ matrix.qt-version-major }}-${{ steps.build.outputs.distro_name }}-${{ matrix.build-type }} + name: ${{ steps.build.outputs.rpm_name }}-qt6-${{ steps.build.outputs.distro_name }}-${{ matrix.build-type }} path: ${{ steps.build.outputs.rpm_path }} - name: Login to GitHub Container Registry @@ -192,20 +182,14 @@ jobs: tags: ${{ env.REGISTRY }}/nuttyartist/notes:${{ matrix.image }} appimage: - name: AppImage (${{ matrix.build-type }}, Qt ${{ matrix.qt-version-major }}, ${{ matrix.image }}) + name: AppImage (${{ matrix.build-type }}, Qt 6, ${{ matrix.image }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - - image: appimage-qt5 - build-script: appimage_entrypoint.sh - qt-version-major: 5 - build-type: release - - image: appimage-qt6 build-script: appimage_entrypoint.sh - qt-version-major: 6 build-type: release steps: - name: Checkout code @@ -246,7 +230,6 @@ jobs: run: docker run --rm -v "${GITHUB_OUTPUT}:/GITHUB_OUTPUT" -v "$(pwd):/src" -t '${{ env.REGISTRY }}/nuttyartist/notes:${{ matrix.image }}' -t ${{ matrix.build-type }} ${{ github.ref_type == 'tag' && '-n' || ' ' }} - name: (FIXME) Run qmllint - if: endsWith(matrix.image, 'qt6') run: docker run --rm -v "$(pwd):/src" --entrypoint '' -t '${{ env.REGISTRY }}/nuttyartist/notes:${{ matrix.image }}' cmake --build build --target all_qmllint || true - name: Upload AppImage artifact diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index fd777f443..0c7eaf941 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -9,18 +9,13 @@ jobs: # So it doesn't make much sense to have different build types other than 'debug' here. # The release dmg is built using aqtinstall instead (the job below this one). build-homebrew: - name: Build (${{ matrix.build-type }}, homebrew (qt${{ matrix.qt-version-major }}), ${{ matrix.os }}) + name: Build (${{ matrix.build-type }}, homebrew (qt6), ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: macos-13 - qt-version-major: 5 - build-type: debug - - - os: macos-13 - qt-version-major: 6 build-type: debug steps: - name: Checkout code @@ -28,19 +23,9 @@ jobs: with: submodules: recursive - - name: Install Qt ${{ matrix.qt-version-major }} (homebrew) - run: | - brew install ninja qt@${{ matrix.qt-version-major }} - - - name: Configure Qt ${{ matrix.qt-version-major }} (homebrew) - if: matrix.qt-version-major == 5 + - name: Install Qt 6 (homebrew) run: | - brew link qt@${{ matrix.qt-version-major }} - cat << EOF - LDFLAGS="-L/usr/local/opt/qt@${{ matrix.qt-version-major }}/lib" - export CPPFLAGS="-I/usr/local/opt/qt@${{ matrix.qt-version-major }}/include" - export PATH="/usr/local/opt/qt@${{ matrix.qt-version-major }}/bin:$PATH" - EOF >> ~/.bashrc + brew install ninja qt@6 - name: Setup CLang problem matcher # Technically, this action only supports GCC, but it seems to work well for Clang too. @@ -55,13 +40,10 @@ jobs: cmake . --warn-uninitialized --warn-unused-vars \ -G Ninja -B build \ -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ - -DCMAKE_PREFIX_PATH="$(brew --prefix qt@${{ matrix.qt-version-major }})" \ + -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6)" \ -DPRO_VERSION=OFF cmake --build build - # Build the dmg disk image using the official Qt 5 release downloaded by aqtinstall. - # This is also done for Linux and Windows, just to make sure we use the exact same Qt version across all three OSes. - # # NOTE: This job uses a fixed Qt version (set in the 'qt-version' key below)! # So, remember to keep it updated whenever a new Qt version is available on aqtinstall. dmg-aqtinstall: @@ -71,10 +53,6 @@ jobs: fail-fast: false matrix: include: - - os: macos-13 - qt-version: 5.15.2 - build-type: release - - os: macos-13 qt-version: 6.5.2 build-type: release @@ -98,11 +76,7 @@ jobs: then version="${version}+g${GITHUB_SHA::7}" fi - arches='x86_64' - if [[ '${{ matrix.qt-version }}' == 6.* ]] - then - arches+='-arm64' - fi + arches='x86_64-arm64' artifact_name="Notes_${version}-Qt${{ matrix.qt-version }}-${arches}" if [ '${{ matrix.build-type }}' == 'debug' ] then @@ -126,23 +100,20 @@ jobs: - name: Build (${{ matrix.build-type }}) env: - # Only commercial Qt 5 supports targeting Apple Silicon at the moment: - # https://www.qt.io/blog/qt-on-apple-silicon - TARGET_ARCH: ${{ startsWith(matrix.qt-version, '6.') && 'x86_64;arm64' || 'x86_64' }} + TARGET_ARCH: x86_64;arm64 VERBOSE: 1 run: | export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu) cmake . --warn-uninitialized --warn-unused-vars \ -B build -G Ninja \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ startsWith(matrix.qt-version, '6.') && '11.0' || '10.15' }} \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \ -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ -DGIT_REVISION=${{ github.ref_type != 'tag' && 'ON' || 'OFF' }} \ - -DCMAKE_OSX_ARCHITECTURES="${{ env.TARGET_ARCH }}" \ + -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64' \ -DPRO_VERSION=OFF cmake --build build - name: (FIXME) Run qmllint - if: startsWith(matrix.qt-version, '6.') run: | cmake --build build --target all_qmllint || true @@ -158,17 +129,6 @@ jobs: mv Notes.app 'Notes Better.app' macdeployqt 'Notes Better.app' -qmldir=../src/qml -appstore-compliant - - name: Remove unnecessary Qt plugins and libraries - run: | - set -x - set -e - cd 'build/Notes Better.app' - if [[ '${{ matrix.qt-version }}' == 5.* ]] - then - # The bearer plugin has caused problems for us in the past. Plus, it was removed altogether in Qt 6. - rm -rv Contents/PlugIns/bearer - fi - - name: Import signing certificate if: github.repository == 'nuttyartist/notes' && github.event_name != 'pull_request' run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c1446d04e..bfdc55345 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,24 +8,13 @@ jobs: # NOTE: This job uses a fixed Qt version (set in the 'qt-version' key below)! # So, remember to keep it updated whenever a new Qt version is available on aqtinstall. build-aqtinstall: - name: Build (${{ matrix.arch }}, ${{ matrix.build-type }}, Qt ${{ matrix.qt-version }}, ${{ matrix.os }}) + name: Build (${{ matrix.build-type }}, Qt ${{ matrix.qt-version }}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: windows-2019 - arch: x64 - qt-version: 5.15.2 - build-type: release - - - os: windows-2019 - arch: x86 - qt-version: 5.15.2 - build-type: release - - - os: windows-2019 - arch: x64 qt-version: 6.4.3 build-type: release outputs: @@ -46,26 +35,26 @@ jobs: if ('${{ github.ref_type }}' -ne 'tag') { $version += "+g$($env:GITHUB_SHA.Substring(0,7))" } - $artifact_name = "Notes_$version-Qt${{ matrix.qt-version }}-${{ matrix.arch }}" + $artifact_name = "Notes_$version-Qt${{ matrix.qt-version }}-x64" Write-Output "version=$version" >> $env:GITHUB_OUTPUT Write-Output "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT - - name: Setup MSVC (${{ matrix.arch }}) + - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 with: - arch: ${{ matrix.arch }} + arch: x64 - - name: Install Qt ${{ matrix.qt-version }} (aqtinstall, ${{ matrix.arch }}) + - name: Install Qt ${{ matrix.qt-version }} (aqtinstall) uses: jurplel/install-qt-action@v4 with: version: ${{ matrix.qt-version }} cache: true - arch: ${{ matrix.arch == 'x86' && 'win32_msvc2019' || 'win64_msvc2019_64' }} + arch: win64_msvc2019_64 # Details about this OpenSSL build: https://kb.firedaemon.com/support/solutions/articles/4000121705 # TODO: Remove/tweak this step if/when we get rid of the x86 build or upgrade to Qt 6.5+. - name: Download OpenSSL 1.x binaries from FireDaemon - if: ${{ startsWith(matrix.qt-version, '5.') || startsWith(matrix.qt-version, '6.4.') }} + if: startsWith(matrix.qt-version, '6.4.') run: | $out_file = "openssl-1.1.1w.zip" Invoke-WebRequest -Uri https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip -OutFile $env:Temp\$out_file @@ -75,7 +64,7 @@ jobs: - name: Setup MSVC problem matcher uses: ammaraskar/msvc-problem-matcher@0.3.0 - - name: Build (${{ matrix.build-type }}, ${{ matrix.arch }}) + - name: Build (${{ matrix.build-type }}) env: VERBOSE: 1 run: | @@ -88,49 +77,38 @@ jobs: cmake --build build - name: (FIXME) Run qmllint - if: startsWith(matrix.qt-version, '6.') run: | cmake --build build --target all_qmllint || $(exit 0) - - name: Install (${{ matrix.build-type }}, ${{ matrix.arch }}) + - name: Install (${{ matrix.build-type }}) run: | cmake --install build --prefix build - - name: Deploy (${{ matrix.build-type }}, ${{ matrix.arch }}) + - name: Deploy (${{ matrix.build-type }}) run: | - windeployqt ${{ startsWith(matrix.qt-version, '5.') && '--no-qmltooling' || ' ' }} --qmldir src\qml build\bin + windeployqt --qmldir src\qml build\bin - name: Remove unnecessary Qt plugins and libraries run: | Set-Location build\bin # We ship all required runtime DLLs individually. Remove-Item -Verbose vc_redist.*.exe - if ('${{ matrix.qt-version }}'.StartsWith('5.')) { - # The bearer plugin has caused problems for us in the past. Plus, it was removed altogether in Qt 6. - Remove-Item -Verbose -Recurse bearer - } # We only use the SQLite Qt driver, so it's fine to delete others. Remove-Item -Verbose sqldrivers\qsqlodbc.dll Remove-Item -Verbose sqldrivers\qsqlpsql.dll - - name: Include required runtime libraries (${{ matrix.build-type }}, ${{ matrix.arch }}) + - name: Include required runtime libraries (${{ matrix.build-type }}) run: | Set-Location build\bin - if ('${{ matrix.arch }}' -ieq 'x64') { - $openssl_lib_suffix = '-x64' - } else { - $openssl_lib_suffix = '' - } - # Include OpenSSL libraries. - Copy-Item $env:Temp\OpenSSL\${{ matrix.arch }}\bin\libcrypto-1_1$openssl_lib_suffix.dll - Copy-Item $env:Temp\OpenSSL\${{ matrix.arch }}\bin\libssl-1_1$openssl_lib_suffix.dll + Copy-Item $env:Temp\OpenSSL\x64\bin\libcrypto-1_1-x64.dll + Copy-Item $env:Temp\OpenSSL\x64\bin\libssl-1_1-x64.dll # Also include OpenSSL debug symbols (when building Notes in debug mode). if ('${{ matrix.build-type }}' -ieq 'debug') { - Copy-Item $env:Temp\OpenSSL\${{ matrix.arch }}\bin\libcrypto-1_1$openssl_lib_suffix.pdb - Copy-Item $env:Temp\OpenSSL\${{ matrix.arch }}\bin\libssl-1_1$openssl_lib_suffix.pdb + Copy-Item $env:Temp\OpenSSL\x64\bin\libcrypto-1_1-x64.pdb + Copy-Item $env:Temp\OpenSSL\x64\bin\libssl-1_1-x64.pdb } # Include MSVC 2019 runtime libraries. @@ -139,33 +117,25 @@ jobs: # XXX: Hack to work around this issue: https://github.com/actions/runner-images/issues/10819 $env:VCToolsRedistDir = -join ($env:VCINSTALLDIR, "Redist\MSVC\", $env:VCToolsVersion, "\") } - Copy-Item $env:VCToolsRedistDir\${{ matrix.arch }}\Microsoft.VC142.CRT\msvcp140.dll - Copy-Item $env:VCToolsRedistDir\${{ matrix.arch }}\Microsoft.VC142.CRT\msvcp140_1.dll - - # Only Qt 6 builds also need msvcp140_2.dll - if ('${{ matrix.qt-version }}'.StartsWith('6')) { - Copy-Item $env:VCToolsRedistDir\${{ matrix.arch }}\Microsoft.VC142.CRT\msvcp140_2.dll - } - - Copy-Item $env:VCToolsRedistDir\${{ matrix.arch }}\Microsoft.VC142.CRT\vcruntime140.dll - if ('${{ matrix.arch }}' -ieq 'x64') { - # Only 64-bit builds also need 'vcruntime140_1.dll' (tested on Windows 7) - Copy-Item $env:VCToolsRedistDir\${{ matrix.arch }}\Microsoft.VC142.CRT\vcruntime140_1.dll - } + Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC142.CRT\msvcp140.dll + Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC142.CRT\msvcp140_1.dll + Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC142.CRT\msvcp140_2.dll + Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC142.CRT\vcruntime140.dll + Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC142.CRT\vcruntime140_1.dll } else { # On debug builds, the libraries above are included automatically, so we only need 'urtcbased.dll'. - Copy-Item $env:WindowsSdkBinPath\${{ matrix.arch }}\ucrt\ucrtbased.dll + Copy-Item $env:WindowsSdkBinPath\x64\ucrt\ucrtbased.dll } - - name: Upload artifacts (${{ matrix.build-type }}, ${{ matrix.arch }}) + - name: Upload artifacts (${{ matrix.build-type }}) uses: actions/upload-artifact@v4 with: if-no-files-found: error name: ${{ steps.vars.outputs.artifact_name }}-${{ runner.os }}-${{ matrix.build-type }} path: build\bin - unified-installer: - name: Unified x64-x86 Installer + installer: + name: Installer needs: build-aqtinstall runs-on: windows-2019 steps: @@ -178,29 +148,18 @@ jobs: path: artifacts pattern: '*Windows*' - - name: Ensure a 64-bit Qt 6 build is present + - name: Ensure a x64 Qt 6 build is present run: | Set-Location artifacts $x64_build = Get-ChildItem -Filter '*Qt6*-x64-Windows-release' -Attributes Directory | Sort-Object -Property @{Expression = "Name"; Descending = $true} | Select-Object -First 1 if (!$x64_build) { - Throw 'Could not find a 64-bit Qt 6 build.' + Throw 'Could not find a x64 Qt 6 build.' } Move-Item $x64_build Notes64 - - name: Ensure a 32-bit Qt 5 build is present - run: | - Set-Location artifacts - $x86_build = Get-ChildItem -Filter '*Qt5*-x86-Windows-release' -Attributes Directory | - Sort-Object -Property @{Expression = "Name"; Descending = $true} | - Select-Object -First 1 - if (!$x86_build) { - Throw 'Could not find a 32-bit Qt 5 build.' - } - Move-Item $x86_build Notes32 - - - name: Create unified installer + - name: Create installer run: | Set-Location artifacts Copy-Item ..\packaging\windows\Notes_Inno_Script_Github.iss @@ -214,7 +173,7 @@ jobs: run: | Set-Location artifacts $inno_setup_manifest = ".\installer\Setup-Manifest.txt" - $windeployqt_paths = @(".\Notes32", ".\Notes64") + $windeployqt_paths = @(".\Notes64") $inno_setup_files = @() Get-Content -LiteralPath $inno_setup_manifest -ErrorAction Stop | Select-Object -Skip 1 | Foreach-Object { @@ -244,7 +203,7 @@ jobs: } Write-Host "SUCCESS: List of files in the installer matches the ones copied by windeployqt." - - name: Upload unified installer artifact + - name: Upload installer artifact uses: actions/upload-artifact@v4 with: if-no-files-found: error diff --git a/CMakeLists.txt b/CMakeLists.txt index 4380d39ef..e2c7ad190 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,6 @@ string(TIMESTAMP CURRENT_YEAR "%Y") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum macOS version to target for deployment") -set(USE_QT_VERSION - "" - CACHE STRING "Use a specific version of Qt to build the app") option(GIT_REVISION "Append the current git revision to the app's version string" OFF) option(UPDATE_CHECKER @@ -56,44 +53,15 @@ set(QT_COMPONENTS Widgets Quick) -# No Qt version was specified, try to use either Qt 6 (preferred) or Qt 5. -if(USE_QT_VERSION STREQUAL "") - # This can probably be simplified once the following bug gets resolved: - # https://gitlab.kitware.com/cmake/cmake/-/issues/23575 - message(STATUS "Trying to find Qt 6...") +message(STATUS "Trying to find Qt 6...") +find_package(QT NAMES Qt6 QUIET) - find_package(QT NAMES Qt6 QUIET) - - if(NOT DEFINED QT_VERSION_MAJOR) - message(STATUS "Could not find Qt 6, will try Qt 5 next...") - - find_package(QT NAMES Qt5 QUIET) - - if(NOT DEFINED QT_VERSION_MAJOR) - message(FATAL_ERROR "Could not find Qt 5, aborting compilation.") - endif() - endif() - - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_COMPONENTS}) -else() - if(NOT USE_QT_VERSION STREQUAL "5" AND NOT USE_QT_VERSION STREQUAL "6") - message( - FATAL_ERROR - "An unsupported version of Qt was specified: '${USE_QT_VERSION}'. Valid values are: 5 or 6." - ) - endif() - message(STATUS "Trying to find Qt ${USE_QT_VERSION} (manually specified)...") - - find_package(QT NAMES Qt${USE_QT_VERSION} QUIET) - - if(NOT DEFINED QT_VERSION_MAJOR) - message( - FATAL_ERROR "Could not find Qt ${USE_QT_VERSION}, aborting compilation.") - endif() - - find_package(Qt${USE_QT_VERSION} REQUIRED COMPONENTS ${QT_COMPONENTS}) +if(NOT DEFINED QT_VERSION_MAJOR OR QT_VERSION_MAJOR LESS 6) + message(STATUS "Could not find Qt 6, aborting compilation.") endif() +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_COMPONENTS}) + message(STATUS "Success! Configuration details:") message(STATUS "App name: ${PROJECT_NAME}") message(STATUS "App version: ${PROJECT_VERSION}") @@ -211,10 +179,6 @@ set(SOURCES ${PROJECT_SOURCE_DIR}/src/images.qrc ${PROJECT_SOURCE_DIR}/src/styles.qrc) -if(QT_VERSION VERSION_LESS 6.0) - list(APPEND SOURCES ${PROJECT_SOURCE_DIR}/src/qml.qrc) -endif() - # Third-party source files. set(SOURCES_3RD_PARTY ${PROJECT_SOURCE_DIR}/3rdParty/qautostart/src/qautostart.cpp @@ -490,16 +454,10 @@ elseif(UNIX) # deb-specific set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) - if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "qt6-qpa-plugins") - if(QT_VERSION_MINOR VERSION_GREATER_EQUAL 2) - set(CPACK_DEBIAN_PACKAGE_DEPENDS - "${CPACK_DEBIAN_PACKAGE_DEPENDS}, qml6-module-qtqml-workerscript, qml6-module-qtquick-controls, qml6-module-qtquick-layouts, qml6-module-qtquick-particles, qml6-module-qtquick-templates, qml6-module-qtquick-window" - ) - endif() - elseif(QT_VERSION_MAJOR VERSION_EQUAL 5) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "qt6-qpa-plugins") + if(QT_VERSION_MINOR VERSION_GREATER_EQUAL 2) set(CPACK_DEBIAN_PACKAGE_DEPENDS - "qml-module-qtquick2, qml-module-qtquick-controls2, qml-module-qtquick-window2" + "${CPACK_DEBIAN_PACKAGE_DEPENDS}, qml6-module-qtqml-workerscript, qml6-module-qtquick-controls, qml6-module-qtquick-layouts, qml6-module-qtquick-particles, qml6-module-qtquick-templates, qml6-module-qtquick-window" ) endif() set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) @@ -508,16 +466,14 @@ elseif(UNIX) # rpm-specific set(CPACK_RPM_FILE_NAME RPM-DEFAULT) - if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) - if(UNIX - AND NOT APPLE - AND EXISTS /etc/os-release) - file(READ /etc/os-release DISTRO_INFO) - if(DISTRO_INFO MATCHES "SUSE") - # Note: Different from Fedora 36, the SQLite library we need is not a dependency - # of the base Qt 6 package on openSUSE Leap 15.4, so we have to manually include it here. - set(CPACK_RPM_PACKAGE_REQUIRES "qt6-sql-sqlite") - endif() + if(UNIX + AND NOT APPLE + AND EXISTS /etc/os-release) + file(READ /etc/os-release DISTRO_INFO) + if(DISTRO_INFO MATCHES "SUSE") + # Note: Different from Fedora 36, the SQLite library we need is not a dependency + # of the base Qt 6 package on openSUSE Leap 15.4, so we have to manually include it here. + set(CPACK_RPM_PACKAGE_REQUIRES "qt6-sql-sqlite") endif() endif() set(CPACK_RPM_PACKAGE_LICENSE MPL-2.0) diff --git a/Dockerfiles/appimage-qt5 b/Dockerfiles/appimage-qt5 deleted file mode 100644 index 155191f60..000000000 --- a/Dockerfiles/appimage-qt5 +++ /dev/null @@ -1,83 +0,0 @@ -# vim: set syntax=dockerfile: -FROM ubuntu:20.04 - -LABEL org.opencontainers.image.description="Base image used to build Notes with Qt 5 and AppImage-package it" - -ENV QT_VERSION=5.15.2 -ENV QT_ARCHITECTURE=gcc_64 - -# Prevent tzdata from asking for input. -ARG DEBIAN_FRONTEND=noninteractive - -# Install all required dependencies: -# -# - appstream: Used to validate the AppStream metadata file. -# - cmake: Used to help build the application. -# - desktop-file-utils: Used to validate the desktop file. -# - file: Required by linuxdeploy. -# - git: Used to clone this repository. -# - g++: Used to compile the application. -# - libdbus-1-3: libQt5DBus links against this library. -# - libegl1: Used as dependency of the resulting AppImage. -# - libfontconfig1: Used as dependency of the resulting AppImage. -# - libglib2.0-0: The iuc binary included with Qt 5 links against this library. -# - libgl-dev: OpenGL headers needed at build time by Qt 6. -# - libxcb-icccm4: Used as dependency of the resulting AppImage. -# - libxcb-image0: Used as dependency of the resulting AppImage. -# - libxcb-keysyms1: Used as dependency of the resulting AppImage. -# - libxcb-randr0: Used as dependency of the resulting AppImage. -# - libxcb-render-util0: Used as dependency of the resulting AppImage. -# - libxcb-shape0: Used as dependency of the resulting AppImage. -# - libxcb-xinerama0: Used as dependency of the resulting AppImage. -# - libxcb-xkb1: Used as dependency of the resulting AppImage. -# - libxkbcommon-x11-0: Used as dependency of the resulting AppImage. -# - make: Used to help build the application. -# - python3/python3-dev/python3-pip: Used to install and run aqtinstall. -RUN apt-get update && \ - apt-get install -y --no-install-recommends appstream cmake desktop-file-utils file git g++ libdbus-1-3 \ - libegl1 libfontconfig1 libglib2.0-0 libgl-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ - libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 make python3 python3-dev python3-pip && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists - -# Install Qt using aqtinstall. -RUN python3 -m pip install aqtinstall && \ - rm -rf ~/.cache - -# Download the specified Qt version using aqtinstall. -RUN python3 -m aqt install-qt --outputdir /Qt linux desktop "$QT_VERSION" "$QT_ARCHITECTURE" && \ - rm -f aqtinstall.log - -# Qt 5 ships with a variety of SQL drivers, but we only need the SQLite one, so here we symlink all -# the other drivers to it, in order to avoid having to install their dependencies for no reason. -# This is a workaround for: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/153 -RUN for driver in libqsqlodbc libqsqlpsql; do \ - ln -fsv libqsqlite.so "/Qt/$QT_VERSION/$QT_ARCHITECTURE/plugins/sqldrivers/$driver.so"; \ - done - -# Download linuxdeploy and its Qt plugin: -ADD --chmod=755 https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage /usr/bin/linuxdeploy -ADD --chmod=755 https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage /usr/bin/linuxdeploy-plugin-qt - -# Note's app ID on Linux. -ENV APP_ID="io.github.nuttyartist.notes" -# Other environment variables expected by CMake and linuxdeploy. -ENV APPIMAGE_EXTRACT_AND_RUN=1 -ENV DISABLE_COPYRIGHT_FILES_DEPLOYMENT=1 -ENV LD_LIBRARY_PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/lib" -ENV PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/bin:$PATH" -ENV PKG_CONFIG_PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/lib/pkgconfig" -ENV QML2_IMPORT_PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/qml" -ENV QML_SOURCES_PATHS="/src/src/qml" -ENV Qt5_DIR="/Qt/$QT_VERSION/$QT_ARCHITECTURE" -ENV QT_PLUGIN_PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/plugins" - -# Prevent a fatal error from git: "detected dubious ownership in repository at '/src'". -RUN git config --global --add safe.directory /src - -# Don't forget to mount the current git tree to /src, i.e.: -# docker run -v $(pwd):/src -it --rm ... -WORKDIR /src - -ADD --chmod=755 ./Dockerfiles/appimage_entrypoint.sh /usr/bin/entrypoint.sh -ENTRYPOINT ["entrypoint.sh"] diff --git a/Dockerfiles/ubuntu-20_04 b/Dockerfiles/ubuntu-20_04 deleted file mode 100644 index b37662dba..000000000 --- a/Dockerfiles/ubuntu-20_04 +++ /dev/null @@ -1,23 +0,0 @@ -# vim: set syntax=dockerfile: -FROM ubuntu:20.04 - -LABEL org.opencontainers.image.description="Base image used to build and DEB-package Notes on Ubuntu 20.04" - -# Prevent tzdata from asking for input. -ENV DEBIAN_FRONTEND=noninteractive - -# Install dependencies. -RUN apt-get update && \ - apt-get install -y --no-install-recommends cmake git g++ lintian make qtbase5-private-dev qtdeclarative5-dev && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists - -# Prevent a fatal error from git: "detected dubious ownership in repository at '/src'". -RUN git config --global --add safe.directory /src - -# Don't forget to mount the current git tree to /src, i.e.: -# docker run -v $(pwd):/src -it --rm ... -WORKDIR /src - -ADD --chmod=755 ./Dockerfiles/ubuntu_deb_entrypoint.sh /usr/bin/entrypoint.sh -ENTRYPOINT ["entrypoint.sh"] diff --git a/docs/build_on_linux.md b/docs/build_on_linux.md index f24cab0d1..a78ca7b4d 100644 --- a/docs/build_on_linux.md +++ b/docs/build_on_linux.md @@ -9,14 +9,12 @@ It's impossible to create a guide that will work for all Linux distros out there | Arch Linux[^3] | `cmake` `gcc` `git` `qt6-base` `qt6-declarative` | `hicolor-icon-theme` `qt6-base` `qt6-declarative` | | Fedora 37 - 39 | `cmake` `gcc` `git` `libxkbcommon-devel` `qt6-qtbase-private-devel` `qt6-qtdeclarative-devel` | `qt6-qtbase-gui` `qt6-qtdeclarative` | | openSUSE Leap 15[^4] | `cmake` `gcc` `git` `qt6-base-private-devel` `qt6-declarative-devel` | `libQt6Concurrent6` `libQt6Gui6` `qt6-sql-sqlite` | -| Ubuntu 20.04[^5] | `cmake` `g++` `git` `qtbase5-private-dev` `qt5qtdeclarative5-dev` | `libqt5network5` `libqt5sql5` `libqt5widgets5` `qml-module-qtquick2` `qml-module-qtquick-controls2` `qml-module-qtquick-window2` | | Ubuntu 22.04 - 23.04 | `cmake` `g++` `git` `qt6-base-private-dev` `qt6-declarative-dev` `libgl-dev` | `libqt6network6` `libqt6sql6` `libqt6widgets6` `qml6-module-qtqml-workerscript` `qml6-module-qtquick-controls` `qml6-module-qtquick-layouts` `qml6-module-qtquick-particles` `qml6-module-qtquick-templates` `qml6-module-qtquick-window` `qt6-qpa-plugins` | [^1]: These packages are only required to build Notes, meaning you can remove all of them (or some of them) afterward. [^2]: These packages are required to actually run Notes. [^3]: We recommend building and installing through the [official AUR package](https://aur.archlinux.org/packages/notes). [^4]: You may need to tell `cmake` to use use GCC 8 (or newer), e.g. run `export CXX=g++-10` before you invoke `cmake`. -[^5]: This distro can only build Notes with Qt 5. ### Build options diff --git a/docs/build_on_windows.md b/docs/build_on_windows.md index 42e67eadd..63e270237 100644 --- a/docs/build_on_windows.md +++ b/docs/build_on_windows.md @@ -2,13 +2,13 @@ These are common steps to build Notes from source on Windows. ### Requirements -Windows 7 (or newer) is required to build Notes. +Windows 10 21H2 (1809 or later) is required to build Notes. Additionally, you need to install the following tools/components: - [Git](https://gitforwindows.org/) - [Microsoft Visual C++](https://visualstudio.microsoft.com/downloads) `>= 2017` *(only the build tools are required)* -- [Qt](https://www.qt.io/download-qt-installer) `>= 5.12` *(using the latest version is recommended)* +- [Qt](https://www.qt.io/download-qt-installer) `>= 6.0` *(using the latest version is recommended)* - [CMake](https://cmake.org/download/) *(can be installed via the Qt installer)* - [Ninja](https://ninja-build.org/) *(can be installed via the Qt installer)* @@ -29,7 +29,7 @@ git clone https://github.com/nuttyartist/notes.git --recurse-submodules cd notes ``` -Now, let's configure our build environment. In this example, we will be using Microsoft Visual C++ 2017 and Qt 5.15.2 (the MSVC 2019 build), targeting a 64-bit system. +Now, let's configure our build environment. In this example, we will be using Microsoft Visual C++ 2017 and Qt 6.4.3 (the MSVC 2019 build), targeting a 64-bit system. Depending on what versions of these applications you have installed, you may need to make some path adjustments in the following steps. @@ -44,8 +44,8 @@ Now, we need to add CMake, Ninja, Qt sources and tools to our `Path` environment ```shell set Path=C:\Qt\Tools\CMake_64\bin;%Path% set Path=C:\Qt\Tools\Ninja;%Path% -set Path=C:\Qt\5.15.2\msvc2019_64;%Path% -set Path=C:\Qt\5.15.2\msvc2019_64\bin;%Path% +set Path=C:\Qt\6.4.3\msvc2019_64;%Path% +set Path=C:\Qt\6.4.3\msvc2019_64\bin;%Path% ``` Optionally, if you want to dedicate all cores of your CPU to build Notes much faster, set this environment variable: diff --git a/docs/build_options.md b/docs/build_options.md index fa7097ec2..bc8cfda7f 100644 --- a/docs/build_options.md +++ b/docs/build_options.md @@ -7,7 +7,6 @@ You should set those while invoking CMake to build the project. See the [example | Name | Default value | Supported values | Description | | ------------------------------------------ | ------------- | ------------------- | ----------------------------------------------------------- | | `CMAKE_OSX_DEPLOYMENT_TARGET` (macOS-only) | `10.15` | (any macOS version) | Minimum macOS version to target for deployment | -| `USE_QT_VERSION` | (unset) | `5` / `6` | Use a specific version of Qt to build the app | | `GIT_REVISION` | `OFF` | `ON` / `OFF` | Append the current git revision to the app's version string | | `UPDATE_CHECKER` | `ON` | `ON` / `OFF` | Enable or disable both the update checker and auto-updater | | `PRO_VERSION` | `ON` | `ON` / `OFF` | Enable or disable Notes Pro features | @@ -20,12 +19,6 @@ To build Notes without any update-checking feature: cmake -B build -DUPDATE_CHECKER=OFF ``` -To force CMake to use Qt 5 (useful when you also have Qt 6 installed, which will be chosen by default, if present): - -``` -cmake -B build -USE_QT_VERSION=5 -``` - To build Notes in `Release` mode (for other modes, check the [CMake documentation](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html)): ``` diff --git a/packaging/windows/Notes_Inno_Script_Github.iss b/packaging/windows/Notes_Inno_Script_Github.iss index bb7eae59c..e5b903ed7 100644 --- a/packaging/windows/Notes_Inno_Script_Github.iss +++ b/packaging/windows/Notes_Inno_Script_Github.iss @@ -188,46 +188,6 @@ Source: "{#SourcePath}\Notes64\Qt6Widgets.dll"; DestDir: "{app}"; Flags: ignorev Source: "{#SourcePath}\Notes64\vcruntime140.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsWin64; MinVersion: 10.0.17763 Source: "{#SourcePath}\Notes64\vcruntime140_1.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsWin64; MinVersion: 10.0.17763 -; Qt 5 build (32-bit) -; Minimum supported OS: -; - Windows 7 (x86 and x86_64) -; Source: https://doc.qt.io/qt-5/supported-platforms.html#windows -Source: "{#SourcePath}\Notes32\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\QtGraphicalEffects\*"; DestDir: "{app}\QtGraphicalEffects"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\QtQml\*"; DestDir: "{app}\QtQml"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\QtQuick\*"; DestDir: "{app}\QtQuick"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\QtQuick.2\*"; DestDir: "{app}\QtQuick.2"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\scenegraph\*"; DestDir: "{app}\scenegraph"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\sqldrivers\*"; DestDir: "{app}\sqldrivers"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\styles\*"; DestDir: "{app}\styles"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\d3dcompiler_47.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\libcrypto-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\libssl-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\msvcp140.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\msvcp140_1.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Notes.exe"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\opengl32sw.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Network.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Qml.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5QmlModels.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5QmlWorkerScript.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Quick.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5QuickControls2.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5QuickParticles.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5QuickTemplates2.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5RemoteObjects.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Sql.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Svg.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 -Source: "{#SourcePath}\Notes32\vcruntime140.dll"; DestDir: "{app}"; Flags: ignoreversion; MinVersion: 6.1; OnlyBelowVersion: 10.0.17763 - [Icons] Name: "{group}\Notes"; Filename: "{app}\Notes.exe" Name: "{group}\{cm:UninstallProgram,Notes}"; Filename: "{uninstallexe}" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4bd175347..8654eead4 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -113,7 +113,6 @@ parts: - -DGIT_REVISION=ON - -DPRO_VERSION=OFF # Note: You may want to remove this option if you're building the snap yourself. - -DUPDATE_CHECKER=OFF - - -DUSE_QT_VERSION=6 parse-info: - usr/share/metainfo/io.github.nuttyartist.notes.metainfo.xml build-packages: diff --git a/src/aboutwindow.cpp b/src/aboutwindow.cpp index 7bfbcf4b6..c77694522 100644 --- a/src/aboutwindow.cpp +++ b/src/aboutwindow.cpp @@ -15,9 +15,6 @@ AboutWindow::AboutWindow(QWidget *parent) : QDialog(parent), m_ui(new Ui::AboutWindow), m_isProVersion(false) { m_ui->setupUi(this); -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - setWindowFlag(Qt::WindowContextHelpButtonHint, false); -#endif setWindowTitle(tr("About") + " " + QCoreApplication::applicationName()); setAboutText(); diff --git a/src/dbmanager.cpp b/src/dbmanager.cpp index 6249ee8b8..bb92ea16e 100644 --- a/src/dbmanager.cpp +++ b/src/dbmanager.cpp @@ -2436,11 +2436,7 @@ void DBManager::exportNotes(const QString &baseExportPath, const QString &extens if (folder.id() != SpecialNodeID::RootFolder) { // Skip root folder QStringList folderNames; QString currentPath = folder.absolutePath(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QStringList pathParts = currentPath.split(QDir::separator(), Qt::SkipEmptyParts); -#else - QStringList pathParts = currentPath.split(QDir::separator(), QString::SkipEmptyParts); -#endif for (const auto &part : pathParts) { int id = part.toInt(); if (id == SpecialNodeID::RootFolder) @@ -2475,9 +2471,7 @@ void DBManager::exportNotes(const QString &baseExportPath, const QString &extens } // Export each note as a .txt file in its corresponding directory -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QTextDocument doc; -#endif while (query.next()) { // int noteId = query.value(0).toInt(); QString title = query.value(1).toString(); @@ -2489,11 +2483,9 @@ void DBManager::exportNotes(const QString &baseExportPath, const QString &extens if (safeTitle.contains("
")) safeTitle = safeTitle.section("
", 0, 0, QString::SectionSkipEmpty); safeTitle = safeTitle.simplified(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) // Convert Markdown to plain text, only available in Qt 5.14+ doc.setMarkdown(safeTitle); safeTitle = doc.toPlainText(); -#endif safeTitle.replace(QRegularExpression(R"([\/\\:*?"<>|])"), "_"); // Make the title filesystem-safe QString filePath = notePath + QDir::separator() + safeTitle + extension; diff --git a/src/fontloader.cpp b/src/fontloader.cpp index cd16a2732..ba22f4411 100644 --- a/src/fontloader.cpp +++ b/src/fontloader.cpp @@ -1,14 +1,6 @@ #include "fontloader.h" -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -FontLoader::FontLoader() : m_fontDatabase() { } -#endif - QFont FontLoader::loadFont(const QString &family, const QString &style, int pointSize) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - return m_fontDatabase.font(family, style, pointSize); -#else return QFontDatabase::font(family, style, pointSize); -#endif } diff --git a/src/fontloader.h b/src/fontloader.h index 577a07824..b73b4a330 100644 --- a/src/fontloader.h +++ b/src/fontloader.h @@ -7,13 +7,7 @@ class FontLoader { public: -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QFontDatabase m_fontDatabase; - FontLoader(); -#else FontLoader() = default; -#endif - ~FontLoader() = default; static FontLoader &getInstance() diff --git a/src/framelesswindow.cpp b/src/framelesswindow.cpp index e4a998a5e..fbc863288 100644 --- a/src/framelesswindow.cpp +++ b/src/framelesswindow.cpp @@ -97,19 +97,11 @@ void CFramelessWindow::addIgnoreWidget(QWidget *widget) m_whiteList.append(widget); } -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool CFramelessWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) -# else -bool CFramelessWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) -# endif { -// Workaround for known bug -> check Qt forum : -// https://forum.qt.io/topic/93141/qtablewidget-itemselectionchanged/13 -# if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1)) - MSG *msg = *reinterpret_cast(message); -# else + // Workaround for known bug -> check Qt forum : + // https://forum.qt.io/topic/93141/qtablewidget-itemselectionchanged/13 MSG *msg = reinterpret_cast(message); -# endif switch (msg->message) { case WM_NCCALCSIZE: { diff --git a/src/framelesswindow.h b/src/framelesswindow.h index 60a8c3761..ff2d0fade 100644 --- a/src/framelesswindow.h +++ b/src/framelesswindow.h @@ -44,11 +44,7 @@ class CFramelessWindow : public QMainWindow // this by add "label1" to a ignorelist, just call addIgnoreWidget(label1) void addIgnoreWidget(QWidget *widget); -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); -# else - bool nativeEvent(const QByteArray &eventType, void *message, long *result); -# endif private slots: void onTitleBarDestroyed(); diff --git a/src/main.cpp b/src/main.cpp index bfcf36b64..d4cd081e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,10 +20,6 @@ int main(int argc, char *argv[]) app.setDesktopFileName(APP_ID); #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - app.setAttribute(Qt::AA_DisableWindowContextHelpButton); -#endif - if (QFontDatabase::addApplicationFont(":/fonts/fontawesome/fa-solid-900.ttf") < 0) qWarning() << "FontAwesome Solid cannot be loaded !"; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7c84be029..87373d9f1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -204,11 +204,7 @@ void MainWindow::InitData() setButtonsAndFieldsEnabled(true); }); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture migration = QtConcurrent::run(&MainWindow::migrateFromV0_9_0, this); -#else - QFuture migration = QtConcurrent::run(this, &MainWindow::migrateFromV0_9_0); -#endif watcher->setFuture(migration); } /// Check if it is running with an argument (ex. hide) @@ -1040,10 +1036,8 @@ void MainWindow::setupEditorSettings() #if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) QUrl source("qrc:/qt/qml/EditorSettings.qml"); -#elif QT_VERSION > QT_VERSION_CHECK(5, 12, 8) - QUrl source("qrc:/qml/EditorSettings.qml"); #else - QUrl source("qrc:/qml/EditorSettingsQt512.qml"); + QUrl source("qrc:/qml/EditorSettings.qml"); #endif m_editorSettingsQuickView.rootContext()->setContextProperty("mainWindow", this); @@ -1138,11 +1132,7 @@ void MainWindow::setCurrentFontBasedOnTypeface(FontTypeface::Value selectedFontT // Set tab width QFontMetrics currentFontMetrics(m_currentSelectedFont); -#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) - m_textEdit->setTabStopWidth(4 * currentFontMetrics.width(' ')); -#else m_textEdit->setTabStopDistance(4 * currentFontMetrics.horizontalAdvance(QLatin1Char(' '))); -#endif alignTextEditText(); @@ -1212,11 +1202,7 @@ void MainWindow::alignTextEditText() QString("The quick brown fox jumps over the lazy dog the quick brown fox jumps over " "the lazy dog the quick brown fox jumps over the lazy dog"); limitingStringSample.truncate(m_textEdit->lineWrapColumnOrWidth()); -#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) - qreal textSamplePixelsWidth = fm.width(limitingStringSample); -#else qreal textSamplePixelsWidth = fm.horizontalAdvance(limitingStringSample); -#endif m_noteEditorLogic->setCurrentAdaptableEditorPadding( (m_textEdit->width() - textSamplePixelsWidth) / 2 - 10); @@ -3186,11 +3172,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event) if (event->buttons() == Qt::LeftButton) { if (isTitleBar(m_mousePressX, m_mousePressY)) { -# if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) m_canMoveWindow = !window()->windowHandle()->startSystemMove(); -# else - m_canMoveWindow = true; -# endif # ifndef __APPLE__ } else if (!isMaximized() && !isFullScreen()) { @@ -3439,12 +3421,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event) if (event->button() == Qt::LeftButton) { if (isTitleBar(event->position().toPoint().x(), event->position().toPoint().y())) { - -# if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) m_canMoveWindow = !window()->windowHandle()->startSystemMove(); -# else - m_canMoveWindow = true; -# endif m_mousePressX = event->position().toPoint().x(); m_mousePressY = event->position().toPoint().y(); } diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 91e0a884f..f96115456 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -5,11 +5,7 @@ NodePath::NodePath(const QString &path) : m_path(path) { } QStringList NodePath::separate() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - return m_path.split(PATH_SEPARATOR, QString::SkipEmptyParts); -#else return m_path.split(PATH_SEPARATOR, Qt::SkipEmptyParts); -#endif } QString NodePath::path() const diff --git a/src/noteeditorlogic.cpp b/src/noteeditorlogic.cpp index efc396874..af2c903e3 100644 --- a/src/noteeditorlogic.cpp +++ b/src/noteeditorlogic.cpp @@ -786,7 +786,6 @@ QString NoteEditorLogic::getNthLine(const QString &str, int targetLineNumber) QString line = str.mid(previousLineBreakIndex + 1, i - previousLineBreakIndex - 1); line = line.trimmed(); if (!line.isEmpty() && !line.startsWith("---") && !line.startsWith("```")) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QTextDocument doc; doc.setMarkdown(line); QString text = doc.toPlainText(); @@ -798,13 +797,6 @@ QString NoteEditorLogic::getNthLine(const QString &str, int targetLineNumber) } QTextStream ts(&text); return ts.readLine(FIRST_LINE_MAX); -#else - if (line.isEmpty()) { - return tr("No additional text"); - } - QTextStream ts(&line); - return ts.readLine(FIRST_LINE_MAX); -#endif } } previousLineBreakIndex = i; diff --git a/src/notelistdelegate.cpp b/src/notelistdelegate.cpp index aaa1a5506..84c050ce5 100644 --- a/src/notelistdelegate.cpp +++ b/src/notelistdelegate.cpp @@ -167,12 +167,8 @@ QSize NoteListDelegate::sizeHint(const QStyleOptionViewItem &option, const QMode const auto ¬e = model->getNote(index); auto id = note.id(); bool isHaveTags = note.tagIds().size() > 0; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - if ((!m_animatedIndexes.contains(index)) && isHaveTags) { -#else if (m_view->isPersistentEditorOpen(index) && (!m_animatedIndexes.contains(index)) && isHaveTags) { -#endif if (szMap.contains(id)) { result.setHeight(szMap[id].height()); return result; @@ -249,12 +245,8 @@ QSize NoteListDelegate::bufferSizeHint(const QStyleOptionViewItem &option, result.setWidth(option.rect.width()); auto id = index.data(NoteListModel::NoteID).toInt(); bool isHaveTags = index.data(NoteListModel::NoteTagsList).value>().size() > 0; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - if (!m_animatedIndexes.contains(index) && isHaveTags) { -#else if (m_view->isPersistentEditorOpen(index) && (!m_animatedIndexes.contains(index)) && isHaveTags) { -#endif if (szMap.contains(id)) { result.setHeight(szMap[id].height()); return result; diff --git a/src/notelistdelegateeditor.cpp b/src/notelistdelegateeditor.cpp index bcdc6f9ee..0b0a767c8 100644 --- a/src/notelistdelegateeditor.cpp +++ b/src/notelistdelegateeditor.cpp @@ -518,11 +518,7 @@ void NoteListDelegateEditor::dragLeaveEvent(QDragLeaveEvent *event) Q_UNUSED(event); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void NoteListDelegateEditor::enterEvent(QEnterEvent *event) -#else -void NoteListDelegateEditor::enterEvent(QEvent *event) -#endif { m_containsMouse = true; QWidget::enterEvent(event); diff --git a/src/notelistdelegateeditor.h b/src/notelistdelegateeditor.h index 3871aa6d6..d87229160 100644 --- a/src/notelistdelegateeditor.h +++ b/src/notelistdelegateeditor.h @@ -98,11 +98,7 @@ public slots: virtual void resizeEvent(QResizeEvent *event) override; virtual void dragEnterEvent(QDragEnterEvent *event) override; virtual void dragLeaveEvent(QDragLeaveEvent *event) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) virtual void enterEvent(QEnterEvent *event) override; -#else - virtual void enterEvent(QEvent *event) override; -#endif virtual void leaveEvent(QEvent *event) override; virtual void dropEvent(QDropEvent *event) override; diff --git a/src/notelistview.cpp b/src/notelistview.cpp index 71e12d007..db8df9d66 100644 --- a/src/notelistview.cpp +++ b/src/notelistview.cpp @@ -534,9 +534,7 @@ void NoteListView::startDrag(Qt::DropActions supportedActions) drag->deleteLater(); mimeData->deleteLater(); } -#if QT_VERSION > QT_VERSION_CHECK(5, 15, 0) d->dropEventMoved = false; -#endif m_isDragging = false; // Reset the drop indicator d->dropIndicatorRect = QRect(); @@ -881,19 +879,8 @@ QPixmap NoteListViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRec QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r); if (paintPairs.isEmpty()) return QPixmap(); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - qreal scale = 1.0f; - Q_Q(const QAbstractItemView); - QWidget *window = q->window(); - if (window) { - QWindow *windowHandle = window->windowHandle(); - if (windowHandle) - scale = windowHandle->devicePixelRatio(); - } -#else QWindow *window = windowHandle(WindowHandleMode::Closest); const qreal scale = window ? window->devicePixelRatio() : qreal(1); -#endif QPixmap pixmap(r->size() * scale); pixmap.setDevicePixelRatio(scale); @@ -905,13 +892,9 @@ QPixmap NoteListViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRec for (int j = 0; j < paintPairs.count(); ++j) { option.rect = paintPairs.at(j).rect.translated(-r->topLeft()); const QModelIndex ¤t = paintPairs.at(j).index; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) Q_Q(const QAbstractItemView); adjustViewOptionsForIndex(&option, current); q->itemDelegateForIndex(current)->paint(&painter, option, current); -#else - delegateForIndex(current)->paint(&painter, option, current); -#endif } return pixmap; } @@ -919,11 +902,7 @@ QPixmap NoteListViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRec QStyleOptionViewItem NoteListViewPrivate::viewOptionsV1() const { Q_Q(const NoteListView); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QStyleOptionViewItem option; q->initViewItemOption(&option); return option; -#else - return q->viewOptions(); -#endif } diff --git a/src/qml.qrc b/src/qml.qrc index e33605e2d..5a120acd3 100644 --- a/src/qml.qrc +++ b/src/qml.qrc @@ -17,7 +17,6 @@ qml/TodoColumnDelegate.qml qml/TodoTaskDelegate.qml qml/ViewChooserButton.qml - qml/EditorSettingsQt512.qml qml/SubscriptionWindow.qml qml/CustomTextField.qml qml/Utilities.js diff --git a/src/qml/EditorSettingsQt512.qml b/src/qml/EditorSettingsQt512.qml deleted file mode 100644 index 742afa859..000000000 --- a/src/qml/EditorSettingsQt512.qml +++ /dev/null @@ -1,945 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import nuttyartist.notes 1.0 -//import notes - -Item { - id: settingsContainer - property int extraWidthForQWidgets: platform === "Apple" ? 60 : 0 - property int extraHeightForQWidgets: platform === "Apple" ? 40 : 0 - width: settingsPane.width + extraWidthForQWidgets - height: settingsPane.height + extraHeightForQWidgets - property var themeData: {{theme: "Light"}} - property string displayFontFamily: "Roboto" - property string platform: "" - property string categoriesFontColor: settingsContainer.themeData.theme === "Dark" ? "#868686" : "#7d7c78" - property string mainFontColor: settingsContainer.themeData.theme === "Dark" ? "#d6d6d6" : "#37352e" - property string highlightBackgroundColor: settingsContainer.themeData.theme === "Dark" ? "#313131" : "#efefef" - property string pressedBackgroundColor: settingsContainer.themeData.theme === "Dark" ? "#2c2c2c" : "#dfdfde" - property string separatorLineColors: settingsContainer.themeData.theme === "Dark" ? "#3a3a3a" : "#ededec" - property string mainBackgroundColor: settingsContainer.themeData.theme === "Dark" ? "#252525" : "white" - signal themeChanged - property int paddingRightLeft: 12 - property var listOfSansSerifFonts: [] - property var listOfSerifFonts: [] - property var listOfMonoFonts: [] - property int chosenSansSerifFontIndex: 0 - property int chosenSerifFontIndex: 0 - property int chosenMonoFontIndex: 0 - property string currentFontTypeface - property real latestScrollBarPosition: 0.0 - property int pointSizeOffset: -4 - property int qtVersion: 6 - property string currentlySelectedView: "TextView" // "KanbanView" - -// signal changeFontType(fontType : EditorSettingsOptions) // TODO: It's better to use signal & slots for calling C++ functions -// to change the editor settings rather than calling public slots directly. But I couldn't make it work between QML and C++ -// (QObject::connect: Error: No such signal EditorSettings_QMLTYPE_45::changeFontType(int)) -// So, currently following this: -// https://scythe-studio.com/en/blog/how-to-integrate-c-and-qml-registering-enums - - Connections { - target: mainWindow - - onEditorSettingsShowed: (data) => { - var settingsPaneHeightByParentWindow = 0.80 * data.parentWindowHeight; // 80 percent of the parent window's height - settingsPane.height = scrollViewControl.contentHeight > settingsPaneHeightByParentWindow ? settingsPaneHeightByParentWindow : scrollViewControl.contentHeight; - revealSettingsAnimation.start(); - settingsContainer.upadteScrollBarPosition(); - } - - onMainWindowResized: (data) => { - var settingsPaneHeightByParentWindow = 0.80 * data.parentWindowHeight; // 80 percent of the parent window's height - settingsPane.height = scrollViewControl.contentHeight > settingsPaneHeightByParentWindow ? settingsPaneHeightByParentWindow : scrollViewControl.contentHeight; - } - - onDisplayFontSet: (data) => { - settingsContainer.displayFontFamily = data.displayFont; - } - - onPlatformSet: (data) => { - settingsContainer.platform = data; - } - - onQtVersionSet: (data) => { - settingsContainer.qtVersion = data; - } - - onThemeChanged: (data) => { - settingsContainer.themeData = data; - themeChanged(); - } - - onEditorSettingsScrollBarPositionChanged: (data) => { - settingsContainer.latestScrollBarPosition = data; - } - - onSettingsChanged: (data) => { - if (data.currentFontTypeface === "SansSerif") { - fontChooserSans.checked = true; - fontChooserSerif.checked = false; - fontChooserMono.checked = false; - } else if (data.currentFontTypeface === "Serif") { - fontChooserSerif.checked = true; - fontChooserSans.checked = false; - fontChooserMono.checked = false; - } else if (data.currentFontTypeface === "Mono") { - fontChooserMono.checked = true; - fontChooserSans.checked = false; - fontChooserSerif.checked = false; - } - - if (data.currentTheme === "Light") { - lightThemeChooserButton.themeSelected(true); - darkThemeChooserButton.themeSelected(false); - sepiaThemeChooserButton.themeSelected(false); - } else if (data.currentTheme === "Dark") { - darkThemeChooserButton.themeSelected(true); - sepiaThemeChooserButton.themeSelected(false); - lightThemeChooserButton.themeSelected(false); - } else if (data.currentTheme === "Sepia") { - sepiaThemeChooserButton.themeSelected(true); - darkThemeChooserButton.themeSelected(false); - lightThemeChooserButton.themeSelected(false); - } - - focusModeOption.setOptionSelected(!data.isTextFullWidth); - - if (data.currentView === "TextView") { - settingsContainer.currentlySelectedView = "TextView"; - textView.viewSelected(); - } else if (data.currentView === "KanbanView") { - settingsContainer.currentlySelectedView = "KanbanView"; - kanbanView.viewSelected(); - } - - notesListCollapsedOption.setOptionSelected(!data.isNoteListCollapsed); - foldersTreeCollapsedOption.setOptionSelected(!data.isFoldersTreeCollapsed); - markdownEnabledOption.setOptionSelected(!data.isMarkdownDisabled); - stayOnTopOption.setOptionSelected(data.isStayOnTop); - } - - onFontsChanged: (data) => { - settingsContainer.listOfSansSerifFonts = data.listOfSansSerifFonts; - settingsContainer.listOfSerifFonts = data.listOfSerifFonts; - settingsContainer.listOfMonoFonts = data.listOfMonoFonts; - settingsContainer.chosenSansSerifFontIndex = data.chosenSansSerifFontIndex; - settingsContainer.chosenSerifFontIndex = data.chosenSerifFontIndex; - settingsContainer.chosenMonoFontIndex = data.chosenMonoFontIndex; - settingsContainer.currentFontTypeface = data.currentFontTypeface; - } - } - - Connections { - target: noteEditorLogic - - onTextShown: { - textView.viewSelected(); - kanbanView.viewUnclicked(); - } - - onKanbanShown: { - kanbanView.viewSelected(); - textView.viewUnclicked(); - } - } - - FontIconLoader { - id: fontIconLoader - } - - PropertyAnimation { - id: revealSettingsAnimation - target: settingsContainer - property: "opacity" - from: 0.3 - to: 1.0 - duration: 100 - easing.type: Easing.InOutQuad - } - - function upadteScrollBarPosition () { - editorSettingsVerticalScrollBar.position = settingsContainer.latestScrollBarPosition; - } - - Pane { - id: settingsPane - visible: true - padding: 0 - width: 240 - height: 500 - contentWidth: 240 - Material.elevation: 10 - Material.background: settingsContainer.mainBackgroundColor -// Material.roundedScale: Material.MediumScale - x: settingsContainer.extraWidthForQWidgets === 0 ? 0 : 20 - y: settingsContainer.extraHeightForQWidgets === 0 ? 0 : 20 - - Rectangle { - visible: settingsContainer.qtVersion < 6 - anchors.fill: parent - color: settingsContainer.mainBackgroundColor - } - - ScrollView { - id: scrollViewControl - anchors.fill: parent - clip: true - - ScrollBar.vertical: CustomVerticalScrollBar { - id: editorSettingsVerticalScrollBar - themeData: settingsContainer.themeData - isDarkGray: false - showBackground: true - - onPositionChanged: { - mainWindow.setEditorSettingsScrollBarPosition(editorSettingsVerticalScrollBar.position); - - } - } - - Column { - Item { - width: 1 - height: settingsContainer.paddingRightLeft - } - - Text { - text: qsTr("Style") - color: settingsContainer.categoriesFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 12 : 12 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - x: settingsContainer.paddingRightLeft - } - - Item { - width: 1 - height: 5 - } - - Row { - x: settingsContainer.paddingRightLeft - FontChooserButton { - id: fontChooserSans - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - categoriesFontColor: settingsContainer.categoriesFontColor - fontTypeface: "Sans" - fontsModel: settingsContainer.listOfSansSerifFonts - currentlyChosenFontIndex: settingsContainer.chosenSansSerifFontIndex - qtVersion: settingsContainer.qtVersion - mainBackgroundColor: settingsContainer.mainBackgroundColor - - onClicked: (chosenFontIndex) => { - if (chosenFontIndex === -1) { - if (settingsContainer.currentFontTypeface === "SansSerif") { - chosenFontIndex = currentlyChosenFontIndex < fontsModel.length - 1 ? currentlyChosenFontIndex + 1 : 0; - } else { - chosenFontIndex = currentlyChosenFontIndex; - } - } - mainWindow.changeEditorFontTypeFromStyleButtons(FontTypeface.SansSerif, chosenFontIndex); - fontChooserSerif.checked = false; - fontChooserMono.checked = false; - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - fontChooserSans.themeChanged(); - } - } - } - - FontChooserButton { - id: fontChooserSerif - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - categoriesFontColor: settingsContainer.categoriesFontColor - fontTypeface: "Serif" - fontsModel: settingsContainer.listOfSerifFonts - currentlyChosenFontIndex: settingsContainer.chosenSerifFontIndex - qtVersion: settingsContainer.qtVersion - mainBackgroundColor: settingsContainer.mainBackgroundColor - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: (chosenFontIndex) => { - if (chosenFontIndex === -1) { - if (settingsContainer.currentFontTypeface === "Serif") { - chosenFontIndex = currentlyChosenFontIndex < fontsModel.length - 1 ? currentlyChosenFontIndex + 1 : 0; - } else { - chosenFontIndex = currentlyChosenFontIndex; - } - } - mainWindow.changeEditorFontTypeFromStyleButtons(FontTypeface.Serif, chosenFontIndex); - fontChooserSans.checked = false; - fontChooserMono.checked = false; - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - fontChooserSerif.themeChanged(); - } - } - } - - FontChooserButton { - id: fontChooserMono - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - categoriesFontColor: settingsContainer.categoriesFontColor - fontTypeface: "Mono" - fontsModel: settingsContainer.listOfMonoFonts - currentlyChosenFontIndex: settingsContainer.chosenMonoFontIndex - qtVersion: settingsContainer.qtVersion - mainBackgroundColor: settingsContainer.mainBackgroundColor - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: (chosenFontIndex) => { - if (chosenFontIndex === -1) { - if (settingsContainer.currentFontTypeface === "Mono") { - chosenFontIndex = currentlyChosenFontIndex < fontsModel.length - 1 ? currentlyChosenFontIndex + 1 : 0; - } else { - chosenFontIndex = currentlyChosenFontIndex; - } - } - mainWindow.changeEditorFontTypeFromStyleButtons(FontTypeface.Mono, chosenFontIndex); - fontChooserSans.checked = false; - fontChooserSerif.checked = false; - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - fontChooserMono.themeChanged(); - } - } - } - } - - Item { - width: 1 - height: 10 - } - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - - Column { - id: textSettingsGroup - visible: settingsContainer.currentlySelectedView === "TextView" - - Item { - width: 1 - height: 10 - } - - Text { - text: qsTr("Text") - color: settingsContainer.categoriesFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 12 : 12 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - x: settingsContainer.paddingRightLeft - } - - Item { - width: 1 - height: 10 - } - - // Font size - Row { - id: fontSizeRow - x: settingsContainer.paddingRightLeft + 10 - Text { - id: fontSizeText - x: 20 - text: qsTr("Font size") - color: settingsContainer.mainFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 14 : 14 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - opacity: settingsContainer.currentlySelectedView === "TextView" ? 1.0 : 0.2 - } - - Item { - width: settingsPane.contentWidth - fontSizePlusButton.width - fontSizeText.width - fontSizeMinusButton.width - 20 - fontSizeRow.x - height: 1 - } - - IconButton { - id: fontSizeMinusButton - icon: fontIconLoader.icons.fa_minus - anchors.verticalCenter: fontSizeText.verticalCenter - themeData: settingsContainer.themeData - platform: settingsContainer.platform - iconPointSizeOffset: -4 - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: { - mainWindow.changeEditorFontSizeFromStyleButtons(FontSizeAction.FontSizeDecrease); - } - } - - Item { - width: 10 - height: 1 - } - - IconButton { - id: fontSizePlusButton - icon: fontIconLoader.icons.fa_plus - anchors.verticalCenter: fontSizeText.verticalCenter - themeData: settingsContainer.themeData - platform: settingsContainer.platform - iconPointSizeOffset: -4 - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: { - mainWindow.changeEditorFontSizeFromStyleButtons(FontSizeAction.FontSizeIncrease); - } - } - } - - // Full width - OptionItemButton { - id: focusModeOption - x: settingsContainer.paddingRightLeft - contentWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - displayText: qsTr("Focus mode") - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - enabled: settingsContainer.currentlySelectedView === "TextView" - - onSwitched: { - mainWindow.changeEditorTextWidthFromStyleButtons(EditorTextWidth.TextWidthFullWidth) - } - - onUnswitched: { - mainWindow.changeEditorTextWidthFromStyleButtons(EditorTextWidth.TextWidthFullWidth) - } - } - - Item { - visible: settingsContainer.currentlySelectedView === "TextView" && focusModeOption.checked - width: 1 - height: 10 - } - - // Text width - Row { - id: textWidthRow - x: settingsContainer.paddingRightLeft + 10 - visible: settingsContainer.currentlySelectedView === "TextView" && focusModeOption.checked - Text { - id: textWidthText - text: qsTr("Text width") - color: settingsContainer.mainFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 14 : 14 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - opacity: settingsContainer.currentlySelectedView === "TextView" ? 1.0 : 0.2 - } - - Item { - width: settingsPane.contentWidth - textWidthPlusButton.width - textWidthText.width - textWidthMinusButton.width - 20 - textWidthRow.x - height: 1 - } - - IconButton { - id: textWidthMinusButton - icon: fontIconLoader.icons.fa_minus - anchors.verticalCenter: textWidthText.verticalCenter - themeData: settingsContainer.themeData - platform: settingsContainer.platform - iconPointSizeOffset: -4 - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: { - mainWindow.changeEditorTextWidthFromStyleButtons(EditorTextWidth.TextWidthDecrease) - } - } - - Item { - width: 10 - height: 1 - } - - IconButton { - id: textWidthPlusButton - icon: fontIconLoader.icons.fa_plus - anchors.verticalCenter: textWidthText.verticalCenter - themeData: settingsContainer.themeData - platform: settingsContainer.platform - iconPointSizeOffset: -4 - enabled: settingsContainer.currentlySelectedView === "TextView" - - onClicked: { - mainWindow.changeEditorTextWidthFromStyleButtons(EditorTextWidth.TextWidthIncrease) - } - } - } - - Item { - width: 1 - height: 7 - } - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - } - - - - Item { - width: 1 - height: 10 - } - - Text { - text: qsTr("Theme") - x: settingsContainer.paddingRightLeft - color: settingsContainer.categoriesFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 12 : 12 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - } - - Item { - width: 1 - height: 5 - } - - // Theme buttons - Row { - x: settingsContainer.paddingRightLeft - ThemeChooserButton { - id: lightThemeChooserButton - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeColor: "#f7f7f7" - themeName: "Light" - themeData: settingsContainer.themeData - qtVersion: settingsContainer.qtVersion - - onClicked: { - mainWindow.setTheme(Theme.Light); - darkThemeChooserButton.unclicked(); - sepiaThemeChooserButton.unclicked(); - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - lightThemeChooserButton.themeChanged(); - } - } - } - - ThemeChooserButton { - id: darkThemeChooserButton - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeColor: "#191919" - themeName: "Dark" - themeData: settingsContainer.themeData - qtVersion: settingsContainer.qtVersion - - onClicked: { - mainWindow.setTheme(Theme.Dark); - lightThemeChooserButton.unclicked(); - sepiaThemeChooserButton.unclicked(); - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - darkThemeChooserButton.themeChanged(); - } - } - } - - ThemeChooserButton { - id: sepiaThemeChooserButton - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeColor: "#f7cc6f" - themeName: "Sepia" - themeData: settingsContainer.themeData - qtVersion: settingsContainer.qtVersion - - onClicked: { - mainWindow.setTheme(Theme.Sepia); - lightThemeChooserButton.unclicked(); - darkThemeChooserButton.unclicked(); - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - sepiaThemeChooserButton.themeChanged(); - } - } - } - } - - Item { - width: 1 - height: 15 - } - - Column { - id: viewSettingContainer - visible: settingsContainer.qtVersion > 5 - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - - Item { - width: 1 - height: 10 - } - - Text { - text: qsTr("View") - x: settingsContainer.paddingRightLeft - color: settingsContainer.categoriesFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 12 : 12 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - } - - Item { - width: 1 - height: 10 - } - - Row { - x: settingsContainer.paddingRightLeft - ViewChooserButton { - id: textView - currentViewType: ViewChooserButton.ViewType.Text - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - - onViewClicked: { - mainWindow.setKanbanVisibility(false); - kanbanView.viewUnclicked(); - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - textView.themeChanged(); - } - } - } - - Column { - ViewChooserButton { - id: kanbanView - currentViewType: ViewChooserButton.ViewType.Kanban - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - - onViewClicked: { - mainWindow.setKanbanVisibility(true); - textView.viewUnclicked(); - } - - Connections { - target: settingsContainer - - function onThemeChanged () { - kanbanView.themeChanged(); - } - } - } - - Rectangle { - // anchors.horizontalCenter: kanbanView.horizontalCenter - x: kanbanView.x + kanbanView.width/2 - width/2 - 7 - width: 35 - height: 25 - radius: 5 - color: settingsContainer.themeData.theme === "Dark" ? "#342a3a" : "#f0f0f0" - - Text { - anchors.centerIn: parent - text: "PRO" - color: settingsContainer.themeData.theme === "Dark" ? "#a6a6a6" : "#787878" - font.pointSize: settingsContainer.platform === "Apple" ? 13 : 13 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - } - } - } - } - - Item { - width: 1 - height: 15 - } - } - - - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - - Item { - width: 1 - height: 10 - } - - Text { - text: qsTr("Options") - x: settingsContainer.paddingRightLeft - color: settingsContainer.categoriesFontColor - font.pointSize: settingsContainer.platform === "Apple" ? 12 : 12 + settingsContainer.pointSizeOffset - font.family: settingsContainer.displayFontFamily - } - - Item { - width: 1 - height: 10 - } - - Column { - x: settingsContainer.paddingRightLeft - OptionItemButton { - id: notesListCollapsedOption - contentWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - displayText: qsTr("Show notes list") - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - - onSwitched: { - mainWindow.expandNoteList(); - } - - onUnswitched: { - mainWindow.collapseNoteList(); - } - } - - OptionItemButton { - id: foldersTreeCollapsedOption - contentWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - displayText: qsTr("Show folders tree") - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - - onSwitched: { - mainWindow.expandFolderTree(); - } - - onUnswitched: { - mainWindow.collapseFolderTree(); - } - } - - OptionItemButton { - id: markdownEnabledOption - visible: settingsContainer.currentlySelectedView === "TextView" - contentWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - displayText: qsTr("Markdown enabled") - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - enabled: settingsContainer.currentlySelectedView === "TextView" - - onSwitched: { - mainWindow.setMarkdownEnabled(true); - } - - onUnswitched: { - mainWindow.setMarkdownEnabled(false); - } - } - - OptionItemButton { - id: stayOnTopOption - visible: settingsContainer.platform === "Apple" - contentWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - displayText: qsTr("Always stay on top") - displayFontFamily: settingsContainer.displayFontFamily - platform: settingsContainer.platform - mainFontColor: settingsContainer.mainFontColor - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - themeData: settingsContainer.themeData - - onSwitched: { - mainWindow.stayOnTop(true); - } - - onUnswitched: { - mainWindow.stayOnTop(false); - } - } - } - - Item { - width: 1 - height: 15 - } - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - - Item { - width: 1 - height: 10 - } - - TextButton { - id: deleteNoteButton - text: qsTr("Move to Trash") - icon: fontIconLoader.icons.fa_trash - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - backgroundWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - mainFontColorDefault: settingsContainer.mainFontColor - platform: settingsContainer.platform - displayFontFamily: settingsContainer.displayFontFamily - x: settingsContainer.paddingRightLeft - - onClicked: { - mainWindow.moveCurrentNoteToTrash(); - } - } - - Item { - width: 1 - height: 10 - } - - Rectangle { - height: 1 - width: settingsPane.contentWidth - color: settingsContainer.separatorLineColors - } - - Item { - width: 1 - height: 10 - } - - TextButton { - id: resetButton - text: qsTr("Reset all settings") - icon: fontIconLoader.icons.fa_undo_alt - highlightBackgroundColor: settingsContainer.highlightBackgroundColor - pressedBackgroundColor: settingsContainer.pressedBackgroundColor - backgroundWidth: settingsPane.contentWidth - settingsContainer.paddingRightLeft*2 - mainFontColorDefault: settingsContainer.mainFontColor - platform: settingsContainer.platform - displayFontFamily: settingsContainer.displayFontFamily - x: settingsContainer.paddingRightLeft - - onClicked: { - resetEditorSettingsDialog.visible = true - } - } - - Item { - width: 1 - height: 10 - } - } - } - } - - Dialog { - id: resetEditorSettingsDialog - visible: false - title: qsTr("Reset settings?") - standardButtons: Dialog.Yes | Dialog.Cancel - Material.accent: "#2383e2"; - Material.theme: settingsContainer.themeData.theme === "Dark" ? Material.Dark : Material.Light -// Material.roundedScale: Material.SmallScale - width: settingsPane.contentWidth - x: settingsContainer.extraWidthForQWidgets === 0 ? 0 : 25 - y: settingsPane.height - height/2 - 100 - font.family: settingsContainer.displayFontFamily - - Text { - width: settingsPane.contentWidth - 20 - wrapMode: Text.WordWrap - text: qsTr("Reset all editor settings to their defaults? This will not affect your data, only the app appearance.") - font.family: settingsContainer.displayFontFamily - color: settingsContainer.mainFontColor - } - - onAccepted: { - mainWindow.resetEditorSettings(); - } - onRejected: { - } - onDiscarded: { - } - } -} - diff --git a/src/updaterwindow.cpp b/src/updaterwindow.cpp index 1af4ba45d..9a0ea0459 100644 --- a/src/updaterwindow.cpp +++ b/src/updaterwindow.cpp @@ -62,9 +62,6 @@ UpdaterWindow::UpdaterWindow(QWidget *parent) /* Initialize the UI */ m_ui->setupUi(this); -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - setWindowFlag(Qt::WindowContextHelpButtonHint, false); -#endif setWindowTitle(qApp->applicationName() + " " + tr("Updater")); /* Change fonts */ @@ -557,11 +554,7 @@ void UpdaterWindow::mousePressEvent(QMouseEvent *event) if (event->position().x() < width() - 5 && event->position().x() > 5 && event->position().toPoint().y() < height() - 5 && event->position().toPoint().y() > 5) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) m_canMoveWindow = !window()->windowHandle()->startSystemMove(); -#else - m_canMoveWindow = true; -#endif m_mousePressX = event->position().toPoint().x(); m_mousePressY = event->position().toPoint().y(); }