diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index 3c2a494be04a5..e6205207f93c1 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -9,14 +9,14 @@ on: jobs: clang-tidy: runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-6.8.1-2 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 2 - name: Prepare compile_commands.json run: | - cmake -G Ninja -B build -DCMAKE_PREFIX_PATH=/opt/qt -DQT_MAJOR_VERSION=6 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DOPENSSL_ROOT_DIR=/usr/local/lib64 + cmake -G Ninja -B build -DQT_MAJOR_VERSION=6 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 cd build && ninja - name: Create results directory run: | @@ -24,10 +24,11 @@ jobs: - name: Analyze run: | /usr/bin/git config --global --add safe.directory "$GITHUB_WORKSPACE" - /usr/bin/git diff -U0 HEAD^ | clang-tidy-diff-15.py -checks='-*,modernize-use-auto,modernize-use-using,modernize-use-nodiscard,modernize-use-nullptr,modernize-use-override,cppcoreguidelines-pro-type-static-cast-downcast' -p1 -path build -export-fixes clang-tidy-result/fixes.yml + /usr/bin/git diff -U0 HEAD^ | clang-tidy-diff-21.py -checks='-*,modernize-use-auto,modernize-use-using,modernize-use-nodiscard,modernize-use-nullptr,modernize-use-override,cppcoreguidelines-pro-type-static-cast-downcast' -p1 -path build -export-fixes clang-tidy-result/fixes.yml - name: Run clang-tidy-pr-comments action uses: platisd/clang-tidy-pr-comments@28cfb84edafa771c044bde7e4a2a3fae57463818 # v1.6.1 # >1.4.3 switches to composite method w/ a forced python version and breaks things: https://github.com/actions/setup-python/issues/871 with: + python_path: "/usr/bin/python3" # The GitHub token (or a personal access token) github_token: ${{ secrets.GITHUB_TOKEN }} # The path to the clang-tidy fixes generated previously diff --git a/.github/workflows/linux-appimage.yml b/.github/workflows/linux-appimage.yml index 1d2b09df9cbdc..53e4c1ba2cd15 100644 --- a/.github/workflows/linux-appimage.yml +++ b/.github/workflows/linux-appimage.yml @@ -9,7 +9,7 @@ jobs: build: name: Linux Appimage Package runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-appimage-qt6:client-appimage-el8-6.9.3-2 + container: ghcr.io/nextcloud/continuous-integration-client-appimage-qt6:client-appimage-el8-6.10.1-1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/linux-clang-compile-tests.yml b/.github/workflows/linux-clang-compile-tests.yml index 94b6aa72a7c8f..ce963b813e47b 100644 --- a/.github/workflows/linux-clang-compile-tests.yml +++ b/.github/workflows/linux-clang-compile-tests.yml @@ -8,7 +8,7 @@ jobs: build: name: Linux Clang compilation and tests runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-1 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/linux-gcc-compile-tests.yml b/.github/workflows/linux-gcc-compile-tests.yml index 4334216e11dc8..7beb6022f30f5 100644 --- a/.github/workflows/linux-gcc-compile-tests.yml +++ b/.github/workflows/linux-gcc-compile-tests.yml @@ -8,7 +8,7 @@ jobs: build: name: Linux GCC compilation and tests runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-1 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/macos-craft-ci.yml b/.github/workflows/macos-craft-ci.yml index 4e97a2842dbfd..2c39ea98fa9e3 100644 --- a/.github/workflows/macos-craft-ci.yml +++ b/.github/workflows/macos-craft-ci.yml @@ -66,8 +66,8 @@ jobs: - name: Add required blueprint repositories if: steps.cache-craft-restore.outputs.cache-hit != 'true' run: | - python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|next|" - python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|next|" + python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|master|" + python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|master|" - name: Setup Craft if: steps.cache-craft-restore.outputs.cache-hit != 'true' diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0c80f335ec696..bb11cec923a04 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -8,7 +8,7 @@ jobs: build: name: SonarCloud analysis runs-on: [ubuntu-latest, self-hosted] - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-6.8.1-2 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 env: SONAR_SERVER_URL: "https://sonarcloud.io" BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed @@ -27,7 +27,7 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_PREFIX_PATH=/opt/qt -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DQT_MAJOR_VERSION=6 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + cmake .. -G Ninja -DCMAKE_PREFIX_PATH=/opt/qt -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DQT_MAJOR_VERSION=6 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja - name: Run tests run: | diff --git a/.github/workflows/windows-build-and-test.yml b/.github/workflows/windows-build-and-test.yml index 403e31a8dcdbb..119497e584909 100644 --- a/.github/workflows/windows-build-and-test.yml +++ b/.github/workflows/windows-build-and-test.yml @@ -31,8 +31,8 @@ jobs: if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE} } - craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|stable-4.0|" - craft --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|stable-4.0|" + craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|master|" + craft --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|master|" craft craft craft --install-deps nextcloud-client diff --git a/CMakeLists.txt b/CMakeLists.txt index c4ad9e37d4293..fb4c3c5b747e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,8 @@ if(BUILD_CLIENT) find_package(ZLIB REQUIRED) find_package(SQLite3 3.9.0 REQUIRED) + find_package(KDSingleApplication-qt6 REQUIRED) + if(NOT WIN32 AND NOT APPLE) find_package(PkgConfig REQUIRED) pkg_check_modules(CLOUDPROVIDERS cloudproviders IMPORTED_TARGET) diff --git a/craftmaster.ini b/craftmaster.ini index 032f4717b937e..6c1dbbffd7cf9 100644 --- a/craftmaster.ini +++ b/craftmaster.ini @@ -3,7 +3,7 @@ [General] Branch = master # CraftUrl = https://github.com/allexzander/craft.git -CraftRevision = 05fc0f0e7cb6cb5e8ee7eccba400ad4a2b590657 +CraftRevision = 7b73acd32984b67d7e1054c9a02e3d86eca9a030 ShallowClone = False # Variables defined here override the default value @@ -28,7 +28,7 @@ ShortPath/Enabled = False ShortPath/EnableJunctions = False Packager/RepositoryUrl = https://download.nextcloud.com/desktop/development/craftCache/ -Packager/CacheVersion = stable-4.0-qt-6.9.3 +Packager/CacheVersion = master-qt-6.10.1 ContinuousIntegration/Enabled = True Packager/UseCache = ${Variables:UseCache} @@ -38,8 +38,8 @@ Packager/CacheDir = ${Variables:Root}\cache [BlueprintSettings] nextcloud-client.buildTests = True binary/mysql.useMariaDB = False -libs/qt6.version = 6.9.3 -craft/craft-blueprints-kde.revision = stable-4.0 +libs/qt6.version = 6.10.1 +craft/craft-blueprints-kde.revision = master [windows-msvc2022_64-cl] Packager/PackageType = NullsoftInstallerPackager diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 0b9097cb152a7..7479e884573bf 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -549,6 +549,7 @@ target_link_libraries(nextcloudCore Qt::QuickControls2 Qt::QuickWidgets KF6::Archive + KDAB::kdsingleapplication ) if(KF6GuiAddons_FOUND) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index f509fd5440c2e..a2412b1175cd6 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -6,9 +6,6 @@ #include "application.h" -#include -#include - #include "account.h" #include "accountmanager.h" #include "accountsetupcommandlinemanager.h" @@ -23,11 +20,8 @@ #include "folderman.h" #include "logger.h" #include "pushnotifications.h" -#include "shellextensionsserver.h" #include "socketapi/socketapi.h" -#include "sslerrordialog.h" #include "theme.h" -#include "updatechannel.h" #if defined(BUILD_UPDATER) #include "updater/ocupdater.h" @@ -42,6 +36,7 @@ #if defined(Q_OS_WIN) #include +#include "shellextensionsserver.h" #elif defined(Q_OS_MACOS) #include "macOS/fileprovider.h" #endif @@ -56,6 +51,11 @@ #include #include #include +#include +#include +#include + +#include class QSocket; @@ -216,7 +216,7 @@ ownCloudGui *Application::gui() const } Application::Application(int &argc, char **argv) - : SharedTools::QtSingleApplication(Theme::instance()->appName(), argc, argv) + : QApplication{argc, argv} , _gui(nullptr) , _theme(Theme::instance()) { @@ -317,7 +317,7 @@ Application::Application(int &argc, char **argv) return; } - if (isRunning()) { + if (!_singleApp.isPrimaryInstance()) { return; } @@ -386,7 +386,7 @@ Application::Application(int &argc, char **argv) _shellExtensionsServer.reset(new ShellExtensionsServer); #endif - connect(this, &SharedTools::QtSingleApplication::messageReceived, this, &Application::slotParseMessage); + connect(&_singleApp, &KDSingleApplication::messageReceived, this, &Application::slotParseMessage); // create accounts and folders from a legacy desktop client or from the current config file setupAccountsAndFolders(); @@ -753,11 +753,12 @@ void Application::setupLogging() qCInfo(lcApplication) << "Arguments:" << qApp->arguments(); } -void Application::slotParseMessage(const QString &msg, QObject *) +void Application::slotParseMessage(const QByteArray &message) { + const auto msg = QString::fromLatin1(message); if (msg.startsWith(QLatin1String("MSG_PARSEOPTIONS:"))) { const int lengthOfMsgPrefix = 17; - QStringList options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char('|')); + const auto options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char{'|'}); _showLogWindow = false; parseOptions(options); setupLogging(); @@ -962,6 +963,16 @@ void Application::showVersion() displayHelpText(Theme::instance()->versionSwitchOutput()); } +bool Application::isRunning() const +{ + return !_singleApp.isPrimaryInstance(); +} + +bool Application::sendMessage(const QString &message) +{ + return _singleApp.sendMessage(message.toLatin1()); +} + void Application::showHint(std::string errorHint) { static QString binName = QFileInfo(QCoreApplication::applicationFilePath()).fileName(); @@ -1156,7 +1167,7 @@ bool Application::event(QEvent *event) qCInfo(lcApplication) << "application palette changed"; emit systemPaletteChanged(); } - return SharedTools::QtSingleApplication::event(event); + return QGuiApplication::event(event); } } // namespace OCC diff --git a/src/gui/application.h b/src/gui/application.h index caba9df0e893f..cd5386b73503a 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -7,6 +7,13 @@ #ifndef APPLICATION_H #define APPLICATION_H +#include "owncloudgui.h" +#include "progressdispatcher.h" +#include "clientproxy.h" +#include "folderman.h" + +#include + #include #include #include @@ -14,16 +21,6 @@ #include #include -#include "qtsingleapplication.h" - -#include "syncresult.h" -#include "logbrowser.h" -#include "owncloudgui.h" -#include "connectionvalidator.h" -#include "progressdispatcher.h" -#include "clientproxy.h" -#include "folderman.h" - class QMessageBox; class QSystemTrayIcon; class QSocket; @@ -41,7 +38,7 @@ class SslErrorDialog; * @brief The Application class * @ingroup gui */ -class Application : public SharedTools::QtSingleApplication +class Application : public QApplication { Q_OBJECT public: @@ -56,6 +53,10 @@ class Application : public SharedTools::QtSingleApplication bool versionOnly(); // only display the version? void showVersion(); + [[nodiscard]] bool isRunning() const; + + bool sendMessage(const QString &message); + void showMainDialog(); [[nodiscard]] ownCloudGui *gui() const; @@ -87,7 +88,7 @@ public slots: void systemPaletteChanged(); protected slots: - void slotParseMessage(const QString &, QObject *); + void slotParseMessage(const QByteArray &msg); void slotCheckConnection(); void slotCleanup(); void slotAccountStateAdded(OCC::AccountState *accountState); @@ -112,6 +113,8 @@ protected slots: QPointer _gui; + KDSingleApplication _singleApp; + Theme *_theme; bool _helpOnly = false; diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp index 83f4af87fb962..f14b25e014a72 100644 --- a/src/gui/networksettings.cpp +++ b/src/gui/networksettings.cpp @@ -14,6 +14,7 @@ #include "folderman.h" #include "theme.h" +#include #include #include #include