diff --git a/.github/actions/qt-setup-taskcluster/action.yml b/.github/actions/qt-setup-taskcluster/action.yml index 404df52688..7f08303801 100644 --- a/.github/actions/qt-setup-taskcluster/action.yml +++ b/.github/actions/qt-setup-taskcluster/action.yml @@ -4,29 +4,22 @@ inputs: toolchain-alias: description: 'Taskcluster toolchain alias' required: false - default: ${{ runner.os == 'Windows' && 'qt-windows-x86_64-6.10' || 'qt-macos-6.10' }} + default: ${{ case(runner.os == 'Windows', 'qt-windows-x86_64-6.10', + runner.os == 'macOS', 'qt-macos-6.10', + 'qt-linux') }} cache: description: 'Cache Qt toolchain artifacts' required: false default: ${{ runner.os == 'Windows' }} - cmake-env: - description: 'Add cmake environment variables' - required: false - default: true outputs: - cmake-prefix-path: - description: 'Path to Qt CMake files for CMAKE_PREFIX_PATH' - value: ${{ steps.get-cmake-path.outputs.cmake-prefix-path }} + path: + description: 'Qt toolchain installation path' + value: ${{ steps.resolve.outputs.toolchain-path }} runs: using: "composite" steps: - - name: Set destination path - id: set-dest - shell: bash - run: echo "path=${GITHUB_WORKSPACE}/3rdparty" >> $GITHUB_OUTPUT - - name: Resolve artifact task id: resolve shell: bash @@ -48,40 +41,34 @@ runs: # contents. Lucky for us, tar is a streamable format so this kinda works # even though the archive is truncated. curl -sSL -r0-4096 "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/${TASKID}/artifacts/${NAME}" -o qt-toolchain-head.tar.xz - echo "toolchain-path=$(xzcat qt-toolchain-head.tar.xz 2>/dev/null | tar t 2>/dev/null | head -1 | grep -o '^[^/]*')" >> $GITHUB_OUTPUT + TARBALL_PATH=$((xzcat qt-toolchain-head.tar.xz | tar t | head -1 | grep -o '^[^/]*') 2>/dev/null || true) + echo "toolchain-path=${GITHUB_WORKSPACE}/3rdparty/${TARBALL_PATH}" >> $GITHUB_OUTPUT - name: Cache Qt toolchain uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 id: qt-toolchain-cache if: ${{ inputs.cache == 'true' }} with: - path: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }} + path: ${{ steps.resolve.outputs.toolchain-path }} key: qt-toolchain-${{ steps.resolve.outputs.taskid }} enableCrossOsArchive: true - name: Install Qt toolchain if: ${{ inputs.cache != 'true' || steps.qt-toolchain-cache.outputs.cache-hit != 'true' }} id: qt-toolchain-install - working-directory: ${{ steps.set-dest.outputs.path }} + working-directory: ${{ runner.temp }} shell: bash env: QT6_TOOLCHAIN_URL: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/${{ steps.resolve.outputs.taskid }}/artifacts/${{ steps.resolve.outputs.filename }} run: | FILENAME=$(basename "${QT6_TOOLCHAIN_URL}") curl -sSL "${QT6_TOOLCHAIN_URL}" -o ${FILENAME} - tar -xf ${FILENAME} - - - name: Get CMake prefix path - if: ${{ inputs.cmake-env == 'true' }} - id: get-cmake-path - working-directory: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }} - shell: bash - run: echo "cmake-prefix-path=$(pwd)/lib/cmake" >> $GITHUB_OUTPUT + tar -C ${GITHUB_WORKSPACE}/3rdparty/ -xf ${FILENAME} - name: Save Qt toolchain uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 if: ${{ inputs.cache == 'true' && github.event_name == 'push' && steps.qt-toolchain-cache.outputs.cache-hit != 'true'}} with: - path: ${{ steps.set-dest.outputs.path }}/${{ steps.resolve.outputs.toolchain-path }} + path: ${{ steps.resolve.outputs.toolchain-path }} key: qt-toolchain-${{ steps.resolve.outputs.taskid }} enableCrossOsArchive: true diff --git a/.github/workflows/linux_tests.yaml b/.github/workflows/linux_tests.yaml index 72425e60a2..9e38652618 100644 --- a/.github/workflows/linux_tests.yaml +++ b/.github/workflows/linux_tests.yaml @@ -36,7 +36,11 @@ jobs: persist-credentials: false - run: | sudo apt-get update - sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control) ccache + sudo apt-get install -y $(./scripts/linux/getdeps.py --build --no-qt) ccache + + - name: Setup Qt for Linux + id: setup-qt + uses: ./.github/actions/qt-setup-taskcluster - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: @@ -60,6 +64,8 @@ jobs: - name: Compile test client shell: bash + env: + CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake run: | mkdir -p build-${{ runner.os }} cmake -S $(pwd) -B build-${{ runner.os }} -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -122,7 +128,7 @@ jobs: - name: Install test dependecies run: | sudo apt-get update - sudo apt-get install -y $(./scripts/linux/getdeps.py -r linux/debian/control) + sudo apt-get install -y $(./scripts/linux/getdeps.py --runtime --no-qt) sudo apt install --no-upgrade firefox xvfb -y chmod +x build-${{ runner.os }}/src/mozillavpn diff --git a/.github/workflows/macos_tests.yaml b/.github/workflows/macos_tests.yaml index fe4a26a43d..898c031f74 100644 --- a/.github/workflows/macos_tests.yaml +++ b/.github/workflows/macos_tests.yaml @@ -75,17 +75,18 @@ jobs: - name: Setup Qt for macOS id: setup-qt uses: ./.github/actions/qt-setup-taskcluster + with: + toolchain-alias: qt-macos-6.10 - name: Setup Qt host tools uses: ./.github/actions/qt-setup-taskcluster with: toolchain-alias: qt-tools-6.10 - cmake-env: false - name: Compile test client env: SDKROOT: ${{ steps.set-sdkroot.outputs.SDKROOT }} - CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.cmake-prefix-path }} + CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake run: | mkdir -p build/cmake cmake -S $(pwd) -B build/cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ diff --git a/.github/workflows/test_unit.yaml b/.github/workflows/test_unit.yaml index bdffdd57db..bed9fc4b51 100644 --- a/.github/workflows/test_unit.yaml +++ b/.github/workflows/test_unit.yaml @@ -29,7 +29,11 @@ jobs: - name: Install dependences run: | sudo apt-get update - sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control) + sudo apt-get install -y $(./scripts/linux/getdeps.py --all --no-qt) + + - name: Setup Qt for Linux + id: setup-qt + uses: ./.github/actions/qt-setup-taskcluster - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: @@ -39,6 +43,8 @@ jobs: - name: Building tests shell: bash + env: + CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake run: | mkdir -p build cmake -S $(pwd) -B build -GNinja @@ -83,7 +89,7 @@ jobs: - name: Building tests env: - CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.cmake-prefix-path }} + CMAKE_PREFIX_PATH: ${{ steps.setup-qt.outputs.path }}/lib/cmake run: | export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) mkdir -p build @@ -149,7 +155,7 @@ jobs: env: CC: ${{ steps.set-compiler.outputs.CC }} CXX: ${{ steps.set-compiler.outputs.CXX }} - CMAKE_PREFIX_PATH: ${{ steps.setup-qt-win.outputs.cmake-prefix-path }} + CMAKE_PREFIX_PATH: ${{ steps.setup-qt-win.outputs.path }}/lib/cmake run: | mkdir ./build-win diff --git a/CMakeLists.txt b/CMakeLists.txt index c247d831e0..c12ba2bd3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,9 @@ find_package(Qt6 REQUIRED COMPONENTS Xml Svg ) -include("scripts/cmake/check_qt_breakage.cmake") +if(Qt6_VERSION VERSION_LESS 6.9.0) + message(FATAL_ERROR "Qt 6.9.0 or higher is required. You are building with version ${Qt6_VERSION}") +endif() if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android") @@ -161,13 +163,8 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" AND ) endif() -if(QT_KNOWN_POLICY_QTP0001) - qt_policy(SET QTP0001 NEW) -endif() - -if(QT_KNOWN_POLICY_QTP0004) - qt_policy(SET QTP0004 OLD) -endif() +qt_policy(SET QTP0001 NEW) +qt_policy(SET QTP0004 OLD) message("Using Qt version ${Qt6_VERSION}") add_definitions(-DQT_DEPRECATED_WARNINGS) diff --git a/linux/debian/control b/linux/debian/control index 6c4f138ce2..2ae15f1d9d 100644 --- a/linux/debian/control +++ b/linux/debian/control @@ -14,15 +14,38 @@ Build-Depends: debhelper (>= 13), python3-yaml:native, python3-jinja2:native, python3-click:native, + libdbus-1-dev, libgcrypt20-dev, libgl-dev, + libgles-dev, + libfontconfig1-dev, + libfreetype6-dev, libopengl-dev (>= 1.3.0~), libpolkit-gobject-1-dev, libqt6core5compat6-dev (>=6.2.0~), libqt6networkauth6-dev (>=6.2.0~), libqt6opengl6-dev (>=6.2.0~), libqt6svg6-dev (>=6.2.0~), + libx11-dev, + libx11-xcb-dev, + libxcb1-dev, + libxcb-cursor-dev, + libxcb-glx0-dev, + libxcb-keysyms1-dev, + libxcb-image0-dev, + libxcb-shm0-dev, + libxcb-icccm4-dev, + libxcb-sync-dev, + libxcb-xfixes0-dev, + libxcb-shape0-dev, + libxcb-randr0-dev, + libxcb-render-util0-dev, + libxcb-util-dev, + libxcb-xinerama0-dev, + libxcb-xkb-dev, libxkbcommon-dev, + libxkbcommon-x11-dev, + libwayland-dev, ninja-build, qmake6 (>=6.2.0~), qt6-base-dev (>=6.2.0~), @@ -41,7 +64,6 @@ Vcs-Git: https://github.com/mozilla-mobile/mozilla-vpn-client Package: mozillavpn Architecture: any Depends: wireguard (>=1.0.20200319), - wireguard-tools (>=1.0.20200319), libfreetype6, libfontconfig1, libegl1, diff --git a/scripts/cmake/check_qt_breakage.cmake b/scripts/cmake/check_qt_breakage.cmake deleted file mode 100644 index 25800c2544..0000000000 --- a/scripts/cmake/check_qt_breakage.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This File Prints a warning if someone tries to compile Qt with a version -# that we know the VPN will break with. - -if( ${Qt6_VERSION} VERSION_EQUAL 6.8.0) - message(AUTHOR_WARNING - "******************* WARNING ********************** \n" - "Qt 6.8.0 is known to be broken and will fail to load Mozila VPN \n" - "Please consider upgrading to at least Qt 6.8.1 \n" - "See: https://bugreports.qt.io/browse/QTBUG-129500 \n" - "****************************************************" - ) -endif() - - -if( ${Qt6_VERSION} VERSION_LESS_EQUAL 6.8.0 AND ANDROID) - message(FATAL_ERROR - "******************* ERROR ********************** \n" - "Qt 6.9.0 is required to build Mozila VPN for Android \n" - "Please consider upgrading to at least Qt 6.9 \n" - "****************************************************" - ) -endif() diff --git a/scripts/linux/getdeps.py b/scripts/linux/getdeps.py index 1728475350..0cd6279911 100755 --- a/scripts/linux/getdeps.py +++ b/scripts/linux/getdeps.py @@ -13,6 +13,8 @@ help='List packages from the Depends paragraph') parser.add_argument('-a', '--all', action='store_true', help='List all packages dependencies') +parser.add_argument('-n', '--no-qt', action='store_true', + help='Ignore Qt package dependencies') args = parser.parse_args() ## If no control file was provided, assume control.qt6 from the source checkout. @@ -32,9 +34,21 @@ # Parse the control file to dump the package dependencies. def dump(depends): for dep in depends.split(','): - if dep.startswith('$'): + pkg = dep.split()[0] + if pkg.startswith('$'): continue - print(dep.split()[0]) + + if args.no_qt: + if pkg.startswith('qml6'): + continue + if pkg.startswith('qt6'): + continue + if pkg.startswith('libqt6'): + continue + if pkg.startswith('qmake'): + continue + + print(pkg) for p in Deb822.iter_paragraphs(open(args.control)): for item in p.items(): diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 03f44746e8..ea4ac1833c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,6 +11,7 @@ mz_target_handle_warnings(mozillavpn) find_package(Qt6 REQUIRED COMPONENTS Svg) if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0) + set(QT_NO_PRIVATE_MODULE_WARNING ON) find_package(Qt6 REQUIRED COMPONENTS GuiPrivate QmlPrivate) endif() diff --git a/src/cmake/android.cmake b/src/cmake/android.cmake index c81d02739e..09191ac94e 100644 --- a/src/cmake/android.cmake +++ b/src/cmake/android.cmake @@ -67,12 +67,10 @@ set_property(TARGET mozillavpn PROPERTY QT_ANDROID_EXTRA_LIBS APPEND) -if( ${Qt6_VERSION} VERSION_GREATER_EQUAL 6.4.0) - set_property(TARGET mozillavpn PROPERTY QT_ANDROID_EXTRA_LIBS +set_property(TARGET mozillavpn APPEND PROPERTY + QT_ANDROID_EXTRA_LIBS ${OPENSSL_LIBS_DIR}/libcrypto_3.so - ${OPENSSL_LIBS_DIR}/libssl_3.so - APPEND) -endif() + ${OPENSSL_LIBS_DIR}/libssl_3.so) option(MZ_ANDROID_FOSS_BUILD "Build apk without google play services" OFF) diff --git a/src/cmake/linux.cmake b/src/cmake/linux.cmake index eba217b7dc..daff46bda3 100644 --- a/src/cmake/linux.cmake +++ b/src/cmake/linux.cmake @@ -43,25 +43,23 @@ target_sources(mozillavpn PRIVATE ) # Resolving the parent window handle for the XDG desktop portal on Wayland -# needs the Gui internal header files on Qt 6.5.0 and later. Otherwise it -# only works for X11. -if(Qt6_VERSION VERSION_GREATER_EQUAL 6.5.0) - target_link_libraries(mozillavpn PRIVATE Qt6::GuiPrivate) -endif() +# needs the Gui internal header files on Qt 6.5.0 and later. +target_link_libraries(mozillavpn PRIVATE Qt6::GuiPrivate) if(NOT BUILD_FLATPAK) # Link to polkit find_package(PkgConfig REQUIRED) pkg_check_modules(polkit REQUIRED IMPORTED_TARGET polkit-gobject-1) + target_link_libraries(mozillavpn PRIVATE PkgConfig::polkit) if (QT_FEATURE_static) find_package(Qt6 REQUIRED COMPONENTS WaylandClientPrivate) qt_import_plugins(mozillavpn INCLUDE Qt6::QWaylandIntegrationPlugin) qt_import_plugins(mozillavpn INCLUDE Qt6::QWaylandAdwaitaDecorationPlugin) target_link_libraries(mozillavpn PRIVATE Qt6::WaylandClientPrivate) - endif() - target_link_libraries(mozillavpn PRIVATE PkgConfig::polkit) + qt_import_plugins(mozillavpn INCLUDE Qt6::QOffscreenIntegrationPlugin) + endif() target_sources(mozillavpn PRIVATE ${CMAKE_SOURCE_DIR}/src/platforms/linux/linuxcontroller.cpp diff --git a/src/commands/commandui.cpp b/src/commands/commandui.cpp index 8fecb7609f..44655a9eed 100644 --- a/src/commands/commandui.cpp +++ b/src/commands/commandui.cpp @@ -246,12 +246,6 @@ int CommandUI::run(QStringList& tokens) { vpn->initialize(); logger.debug() << "VPN initialized"; - // Prior to Qt 6.5, there was no default QML import path. We must set one. -#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) - engine->addImportPath("qrc:/"); - engine->addImportPath("qrc:/qt/qml"); - logger.debug() << "Added QML import paths"; -#endif QQuickImageProvider* provider = ImageProviderFactory::create(qApp); if (provider) { engine->addImageProvider(QString("app"), provider); @@ -268,13 +262,8 @@ int CommandUI::run(QStringList& tokens) { I18nStrings::instance()); logger.debug() << "Registered I18nStrings"; -#if MZ_IOS && QT_VERSION < 0x060300 - QObject::connect(qApp, &QCoreApplication::aboutToQuit, vpn, - &MozillaVPN::quit); -#else QObject::connect(qApp, &QCoreApplication::aboutToQuit, vpn, [] { MozillaVPN::instance()->aboutToQuit(); }); -#endif QObject::connect( qApp, &QGuiApplication::commitDataRequest, vpn, diff --git a/src/mozillavpn.cpp b/src/mozillavpn.cpp index a1868a5c4c..d752ef2533 100644 --- a/src/mozillavpn.cpp +++ b/src/mozillavpn.cpp @@ -148,15 +148,6 @@ void MozillaVPN::quit() { logger.debug() << "quit"; TaskScheduler::forceDeleteTasks(); -#if QT_VERSION < QT_VERSION_CHECK(6, 2, 4) - // Qt5Compat.GraphicalEffects makes the app crash on shutdown. Let's do a - // quick exit. See: https://bugreports.qt.io/browse/QTBUG-100687 - // it is unknown when exactly this was fixed but apparently 6.2.4 is fine. - - SettingsManager::instance()->sync(); - exit(0); -#endif - qApp->quit(); } diff --git a/src/networkrequest.cpp b/src/networkrequest.cpp index 691259e52e..275ac824d7 100644 --- a/src/networkrequest.cpp +++ b/src/networkrequest.cpp @@ -211,37 +211,6 @@ void NetworkRequest::replyFinished() { return; } -#if QT_VERSION < 0x060400 - if (m_reply->error() == QNetworkReply::HostNotFoundError && isRedirect()) { - QUrl brokenUrl = m_reply->url(); - - if (brokenUrl.host().isEmpty() && !m_redirectedUrl.isEmpty()) { - QUrl url = m_redirectedUrl.resolved(brokenUrl); - -# ifdef MZ_DEBUG - // See https://bugreports.qt.io/browse/QTBUG-100651 - logger.debug() - << "QT6 redirect bug! The current URL is broken because it's not " - "resolved using the latest HTTP redirection as base-URL"; - logger.debug() << "Broken URL:" << brokenUrl.toString(); - logger.debug() << "Latest redirected URL:" << m_redirectedUrl.toString(); - logger.debug() << "Final URL:" << url.toString(); -# endif - - m_request = QNetworkRequest(url); - m_request.setHeader(QNetworkRequest::ContentTypeHeader, - "application/json"); - m_request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, - QNetworkRequest::NoLessSafeRedirectPolicy); - - m_reply = nullptr; - m_timer.stop(); - getResource(); - return; - } - } -#endif - int status = statusCode(); logger.debug() << "Network reply received - status:" << status << "- expected:" << expectStatusString(); @@ -332,29 +301,7 @@ void NetworkRequest::handleHeaderReceived() { } void NetworkRequest::handleRedirect(const QUrl& redirectUrl) { -#if QT_VERSION < 0x060400 - if (redirectUrl.host().isEmpty()) { -# ifdef MZ_DEBUG - // See https://bugreports.qt.io/browse/QTBUG-100651 - logger.debug() - << "QT6 redirect bug! The redirected URL is broken because it's not " - "resolved using the previous HTTP redirection as base-URL"; - logger.debug() << "Broken URL:" << redirectUrl.toString(); - logger.debug() << "Latest redirected URL:" << m_redirectedUrl.toString(); -# endif - - if (m_redirectedUrl.isEmpty()) { - m_redirectedUrl = url().resolved(redirectUrl); - } else { - m_redirectedUrl = m_redirectedUrl.resolved(redirectUrl); - } - } else { - m_redirectedUrl = redirectUrl; - } - emit requestRedirected(this, m_redirectedUrl); -#else emit requestRedirected(this, redirectUrl); -#endif } void NetworkRequest::timeout() { diff --git a/src/networkwatcher.cpp b/src/networkwatcher.cpp index 4d61855c05..2882548e8b 100644 --- a/src/networkwatcher.cpp +++ b/src/networkwatcher.cpp @@ -91,12 +91,10 @@ void NetworkWatcher::initialize() { m_impl->start(); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) // This call creates an instance of QNetworkInformation which can be used // later on to check other network related attributes such as network type, or // whether or not the network is behind captive portal. QNetworkInformation::loadDefaultBackend(); -#endif connect(settingsHolder, &SettingsHolder::unsecuredNetworkAlertChanged, this, &NetworkWatcher::settingsChanged); diff --git a/src/platforms/linux/linuxutils.cpp b/src/platforms/linux/linuxutils.cpp index f9fb0246b3..bb2230dcdc 100644 --- a/src/platforms/linux/linuxutils.cpp +++ b/src/platforms/linux/linuxutils.cpp @@ -132,16 +132,5 @@ QString LinuxUtils::desktopFileId(const QString& path) { return path.mid(index).replace('/', '-'); } -// Workaround for QTBUG-108822 by manually registering QDBusObjectPath with the -// D-Bus meta-type system, otherwise we are unable to connect to some signals. -#if QT_VERSION < 0x060403 -class QtbugRegistrationProxy { - public: - QtbugRegistrationProxy() { qDBusRegisterMetaType(); } -}; - -static QtbugRegistrationProxy s_qtbugRegistrationProxy; -#endif - // Ensure that the D-Bus custom types are registered. static DBusMetatypeRegistrationProxy s_dbusMetatypeProxy; diff --git a/src/platforms/linux/xdgportal.cpp b/src/platforms/linux/xdgportal.cpp index d9e8ba9179..2f9326353c 100644 --- a/src/platforms/linux/xdgportal.cpp +++ b/src/platforms/linux/xdgportal.cpp @@ -4,6 +4,9 @@ #include "xdgportal.h" +#include +#include +#include #include #include @@ -11,19 +14,6 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) -# include -# include -# include -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) -# include -# include -# include -#else -# include -# include -#endif - #include "dbustypes.h" #include "leakdetector.h" #include "logger.h" @@ -116,24 +106,12 @@ QString XdgPortal::parentWindow() { if (!holder->hasWindow()) { return QString(""); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) + QDesktopUnixServices* services = dynamic_cast( QGuiApplicationPrivate::platformIntegration()->services()); if (services != nullptr) { return services->portalWindowIdentifier(holder->window()); } -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) - QGenericUnixServices* services = dynamic_cast( - QGuiApplicationPrivate::platformIntegration()->services()); - if (services != nullptr) { - return services->portalWindowIdentifier(holder->window()); - } -#else - // X11 is the only platform that we can get a window handle on prior to 6.5.0 - if (QGuiApplication::platformName() == "xcb") { - return "x11:" + QString::number(holder->window()->winId(), 16); - } -#endif // Otherwise, we don't support this windowing system. return QString(""); @@ -251,14 +229,14 @@ void XdgPortal::setupAppScope(const QString& appId) { // Qt 6.8 introduced a bug where using QDBusConnection::sessionBus() before // QCoreApplication is created will silently break D-Bus signal connections. // To workaround this, spin up a separate, standalone bus for these steps. -#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(6, 9, 2)) +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 2) QString busName = QString("%1-appid-scope-helper").arg(appId); QDBusConnection bus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, busName); auto guard = qScopeGuard([busName]() { QDBusConnection::disconnectFromBus(busName); }); #else + // If the XDG Registry portal exists, use it to advertise our application ID. // This is the right tool to use, but it's also very new. QDBusInterface xdgRegistry(XDG_PORTAL_SERVICE, XDG_PORTAL_PATH, diff --git a/src/settingslist.h b/src/settingslist.h index 3033f500e2..20f1891f29 100644 --- a/src/settingslist.h +++ b/src/settingslist.h @@ -545,24 +545,14 @@ SETTING_STRING(theme, // getter false // sensitive (do not log) ) -// This option is only supported for Qt 6.5 or later, with a special fallback -// for Linux users via the XDG settings portal. -// Without this, the Apperance screen will initially show no theme selected. -#if defined(MZ_LINUX) -# define USING_SYSTEM_THEME_DEFAULT_VALUE true -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) -# define USING_SYSTEM_THEME_DEFAULT_VALUE true -#else -# define USING_SYSTEM_THEME_DEFAULT_VALUE false -#endif -SETTING_BOOL(usingSystemTheme, // getter - setUsingSystemTheme, // setter - removeUsingSystemTheme, // remover - hasUsingSystemTheme, // has - "theme/usingSystemTheme", // key - USING_SYSTEM_THEME_DEFAULT_VALUE, // default value - true, // remove when reset - false // sensitive (do not log) +SETTING_BOOL(usingSystemTheme, // getter + setUsingSystemTheme, // setter + removeUsingSystemTheme, // remover + hasUsingSystemTheme, // has + "theme/usingSystemTheme", // key + true, // default value + true, // remove when reset + false // sensitive (do not log) ) SETTING_STRING(token, // getter diff --git a/src/theme.cpp b/src/theme.cpp index 3b2712f2ff..988617d1c9 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -5,11 +5,9 @@ #include "theme.h" #include +#include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) -# include -# include -#endif +#include #include "feature/features.h" #include "leakdetector.h" @@ -54,7 +52,7 @@ Theme::Theme(QObject* parent) : QAbstractListModel(parent) { setToSystemTheme(); } }); -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) +#else connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this]() { if (SettingsHolder::instance()->usingSystemTheme()) { @@ -259,16 +257,13 @@ QString Theme::currentSystemTheme() { } else { return "dark-mode"; } -#elif QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) +#else QStyleHints* styleHints = QGuiApplication::styleHints(); if (styleHints->colorScheme() != Qt::ColorScheme::Dark) { return "main"; } else { return "dark-mode"; } -#else - // Otherwise, we have no way to detect the system theme. - return "main"; #endif } diff --git a/src/utils/loghandler.cpp b/src/utils/loghandler.cpp index 9165d8cc7a..f7c635e313 100644 --- a/src/utils/loghandler.cpp +++ b/src/utils/loghandler.cpp @@ -310,15 +310,11 @@ bool LogHandler::makeLogDir(const QDir& dir) { } // Create the log directory. -#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0) QFileDevice::Permissions perms = QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner | QFileDevice::ReadGroup | QFileDevice::ExeGroup | QFileDevice::ReadOther | QFileDevice::ExeOther; return parent.mkdir(dir.dirName(), perms); -#else - return parent.mkdir(dir.dirName()); -#endif } void LogHandler::openLogFile(const QMutexLocker& proofOfLock) { diff --git a/taskcluster/docker/linux-qt6-build/Dockerfile b/taskcluster/docker/linux-qt6-build/Dockerfile index f12661388e..c961a54e1e 100644 --- a/taskcluster/docker/linux-qt6-build/Dockerfile +++ b/taskcluster/docker/linux-qt6-build/Dockerfile @@ -25,15 +25,19 @@ RUN apt-get update -q RUN apt-get -y install tzdata RUN apt-get -y install build-essential \ clang-16 \ + cmake \ curl \ debhelper \ devscripts \ equivs \ + golang \ libclang-16-dev \ + libdbus-1-3 \ libgl1-mesa-dev \ locales \ ninja-build \ patchelf \ + pkg-config \ sudo # Enable multiarch and add cross-compilation toolchain @@ -43,49 +47,9 @@ RUN if [ "$DEB_HOST_ARCH" != "amd64" ]; then \ crossbuild-essential-${DEB_HOST_ARCH} \ gcc-${DEB_HOST_GNU_CPU}-linux-gnu \ g++-${DEB_HOST_GNU_CPU}-linux-gnu \ - binutils-${DEB_HOST_GNU_CPU}-linux-gnu \ - pkg-config \ - cmake \ - golang; \ + binutils-${DEB_HOST_GNU_CPU}-linux-gnu; \ fi -## Install Qt6/X11 build dependencies -## From: https://doc.qt.io/qt-6/linux-requirements.html -RUN apt-get -y install libatspi2.0-dev:${DEB_HOST_ARCH} \ - libdbus-1-dev:${DEB_HOST_ARCH} \ - libfontconfig1-dev:${DEB_HOST_ARCH} \ - libfreetype6-dev:${DEB_HOST_ARCH} \ - libgles-dev:${DEB_HOST_ARCH} \ - libssl-dev:${DEB_HOST_ARCH} \ - libx11-dev:${DEB_HOST_ARCH} \ - libx11-xcb-dev:${DEB_HOST_ARCH} \ - libxext-dev:${DEB_HOST_ARCH} \ - libxfixes-dev:${DEB_HOST_ARCH} \ - libxi-dev:${DEB_HOST_ARCH} \ - libxrender-dev:${DEB_HOST_ARCH} \ - libxcb1-dev:${DEB_HOST_ARCH} \ - libxcb-cursor-dev:${DEB_HOST_ARCH} \ - libxcb-glx0-dev:${DEB_HOST_ARCH} \ - libxcb-keysyms1-dev:${DEB_HOST_ARCH} \ - libxcb-image0-dev:${DEB_HOST_ARCH} \ - libxcb-shm0-dev:${DEB_HOST_ARCH} \ - libxcb-icccm4-dev:${DEB_HOST_ARCH} \ - libxcb-sync-dev:${DEB_HOST_ARCH} \ - libxcb-xfixes0-dev:${DEB_HOST_ARCH} \ - libxcb-shape0-dev:${DEB_HOST_ARCH} \ - libxcb-randr0-dev:${DEB_HOST_ARCH} \ - libxcb-render-util0-dev:${DEB_HOST_ARCH} \ - libxcb-util-dev:${DEB_HOST_ARCH} \ - libxcb-xinerama0-dev:${DEB_HOST_ARCH} \ - libxcb-xkb-dev:${DEB_HOST_ARCH} \ - libxkbcommon-dev:${DEB_HOST_ARCH} \ - libxkbcommon-x11-dev:${DEB_HOST_ARCH} - -## Install wayland build dependencies -RUN apt -y install libwayland-dev:${DEB_HOST_ARCH} \ - libwayland-egl-backend-dev:${DEB_HOST_ARCH} \ - wayland-protocols - # Also pull in packages from build-depends as early as possible # %include linux/debian/control ADD topsrcdir/linux/debian/control /root/mozillavpn-dpkg-control diff --git a/taskcluster/kinds/build/linux.yml b/taskcluster/kinds/build/linux.yml index 23363fb94e..02bb1edebd 100644 --- a/taskcluster/kinds/build/linux.yml +++ b/taskcluster/kinds/build/linux.yml @@ -25,34 +25,14 @@ task-defaults: use-caches: [checkout, pip] command: /builds/worker/builder.sh -linux/jammy: - description: "Linux Build (Ubuntu/Jammy)" +linux/ubuntu: + description: "Linux Build (Ubuntu)" treeherder: - platform: linux/jammy + platform: linux/ubuntu worker: - docker-image: {in-tree: linux-build-jammy} + docker-image: {in-tree: linux-build-ubuntu} add-index-routes: - name: linux-jammy - type: build - -linux/noble: - description: "Linux Build (Ubuntu/Noble)" - treeherder: - platform: linux/noble - worker: - docker-image: {in-tree: linux-build-noble} - add-index-routes: - name: linux-noble - type: build - -linux/resolute: - description: "Linux Build (Ubuntu/Resolute)" - treeherder: - platform: linux/resolute - worker: - docker-image: {in-tree: linux-build-resolute} - add-index-routes: - name: linux-resolute + name: linux-ubuntu type: build linux/fedora: diff --git a/taskcluster/kinds/docker-image/kind.yml b/taskcluster/kinds/docker-image/kind.yml index 111c67d41b..7c03980986 100644 --- a/taskcluster/kinds/docker-image/kind.yml +++ b/taskcluster/kinds/docker-image/kind.yml @@ -41,21 +41,11 @@ tasks: parent: base symbol: I(linux-rpm-build) definition: linux-rpm-build - linux-build-jammy: - symbol: I(linux-jammy) + linux-build-ubuntu: + symbol: I(linux-ubuntu) definition: linux-dpkg-build args: - DOCKER_BASE_IMAGE: '{dockerhub:ubuntu:jammy}' - linux-build-noble: - symbol: I(linux-noble) - definition: linux-dpkg-build - args: - DOCKER_BASE_IMAGE: '{dockerhub:ubuntu:noble}' - linux-build-resolute: - symbol: I(linux-resolute) - definition: linux-dpkg-build - args: - DOCKER_BASE_IMAGE: '{dockerhub:ubuntu:resolute}' + DOCKER_BASE_IMAGE: '{dockerhub:ubuntu:latest}' linux-build-fedora: symbol: I(linux-fedora) definition: linux-rpm-build diff --git a/tests/qml/CMakeLists.txt b/tests/qml/CMakeLists.txt index 990c93d294..f0f9791db7 100644 --- a/tests/qml/CMakeLists.txt +++ b/tests/qml/CMakeLists.txt @@ -28,6 +28,9 @@ target_link_libraries(qml_tests PRIVATE Qt6::Svg ) +if (QT_FEATURE_static) + qt_import_plugins(qml_tests INCLUDE Qt6::QOffscreenIntegrationPlugin) +endif() target_link_libraries(qml_tests PRIVATE lottie mzutils nebula translations) target_compile_definitions(qml_tests PRIVATE QUICK_TEST_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 6cda403cc8..30275991ed 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -33,6 +33,9 @@ target_link_libraries(unit_tests PRIVATE target_compile_definitions(unit_tests PRIVATE UNIT_TEST) +if (QT_FEATURE_static) + qt_import_plugins(unit_tests INCLUDE Qt6::QOffscreenIntegrationPlugin) +endif() target_link_libraries(unit_tests PRIVATE lottie mzutils nebula translations) # VPN Client source files diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 75fd9b0a9e..741c2aa1f5 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -46,6 +46,10 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten" ) endif() +if (QT_FEATURE_static) + qt_import_plugins(app_unit_tests INCLUDE Qt6::QOffscreenIntegrationPlugin) +endif() + include(${CMAKE_SOURCE_DIR}/scripts/cmake/generate_translations_target.cmake) generate_translations_target(translations-unit-tests ${CMAKE_SOURCE_DIR}/tests/unit_tests/translations