From 41427039904815063f29c79d68ce4064cacb311e Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 10 Dec 2023 04:53:44 +0100 Subject: [PATCH 01/10] Try to make windows notifications prettier --- .ci/windows/build.bat | 2 +- CMakeLists.txt | 8 ++++---- src/notifications/Manager.h | 6 ++++-- src/notifications/ManagerLinux.cpp | 3 ++- src/notifications/ManagerWin.cpp | 28 ++++++++++++++++++++++++---- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.ci/windows/build.bat b/.ci/windows/build.bat index a79e2360..d74a2ea6 100644 --- a/.ci/windows/build.bat +++ b/.ci/windows/build.bat @@ -15,7 +15,7 @@ echo %DATE% call "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvarsall.bat" x64 -cmake -G "Visual Studio 17 2022" -A x64 -S. -Bbuild -DHUNTER_ROOT="C:\hunter" -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release +cmake -G "Visual Studio 17 2022" -A x64 -S. -Bbuild -DHUNTER_ROOT="C:\hunter" -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON -DKDSingleApplication_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release cmake --build build --config Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 525a3592..af50aff8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -647,14 +647,14 @@ if(APPLE) endif() elseif(WIN32) file(DOWNLOAD - "https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.cpp" + "https://raw.githubusercontent.com/mohabouje/WinToast/v1.3.0/src/wintoastlib.cpp" ${PROJECT_SOURCE_DIR}/src/wintoastlib.cpp - EXPECTED_HASH SHA256=1A1A7CE41C1052B12946798F4A6C67CE1FAD209C967F5ED4D720B173527E2073) + EXPECTED_HASH SHA256=1ddf8ee2604e1757d383a2f60d4d597c4f5d9496369e6a22586cedf4af77ca8f) file(DOWNLOAD - "https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.h" + "https://raw.githubusercontent.com/mohabouje/WinToast/v1.3.0/include/wintoastlib.h" ${PROJECT_SOURCE_DIR}/src/wintoastlib.h - EXPECTED_HASH SHA256=b4481023c5782733795838be22bf1a75f45d87458cd4d9a5a75f664a146eea11) + EXPECTED_HASH SHA256=08cb30d28db9c851d3d4259ae6108ce7dafa966957df6735a06cd55e0716fded) set(SRC_FILES ${SRC_FILES} src/notifications/ManagerWin.cpp src/wintoastlib.cpp src/wintoastlib.h) else() diff --git a/src/notifications/Manager.h b/src/notifications/Manager.h index fbebfcba..0efc9445 100644 --- a/src/notifications/Manager.h +++ b/src/notifications/Manager.h @@ -93,8 +93,10 @@ public: #if defined(Q_OS_WINDOWS) private: - void - systemPostNotification(const QString &line1, const QString &line2, const QString &iconPath); + void systemPostNotification(const QString &line1, + const QString &line2, + const QString &iconPath, + const QString &bodyImagePath); #endif // these slots are platform specific (D-Bus only) diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp index b181fdc3..11a7c1a1 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp @@ -114,7 +114,8 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if if (hasMarkup_) { if (hasImages_ && - mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image) { + (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image || + mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image)) { MxcImageProvider::download( QString::fromStdString(mtx::accessors::url(notification.event)) .remove(QStringLiteral("mxc://")), diff --git a/src/notifications/ManagerWin.cpp b/src/notifications/ManagerWin.cpp index 8d200abc..87c49e3c 100644 --- a/src/notifications/ManagerWin.cpp +++ b/src/notifications/ManagerWin.cpp @@ -13,6 +13,7 @@ #include "Cache.h" #include "EventAccessors.h" +#include "MxcImageProvider.h" #include "Utils.h" using namespace WinToastLib; @@ -34,9 +35,9 @@ init() { isInitialized = true; - WinToast::instance()->setAppName(L"Nheko"); WinToast::instance()->setAppUserModelId( WinToast::configureAUMI(L"NhekoReborn", L"in.nheko.Nheko")); + WinToast::instance()->setAppName(L"Nheko"); if (!WinToast::instance()->initialize()) std::wcout << "Your system is not compatible with toast notifications\n"; } @@ -61,20 +62,35 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if } return template_.arg(utils::stripReplyFallbacks(notification.event, {}, {}).quoted_body); - }; + }(); auto iconPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + room_name + "-room-avatar.png"; if (!icon.save(iconPath)) iconPath.clear(); - systemPostNotification(room_name, formatNotification(), iconPath); + if (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image || + mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image) { + MxcImageProvider::download( + QString::fromStdString(mtx::accessors::url(notification.event)) + .remove(QStringLiteral("mxc://")), + QSize(200, 80), + [this, room_name, formatNotification, iconPath](QString, QSize, QImage, QString imgPath) { + if (imgPath.isEmpty()) + systemPostNotification(room_name, formatNotification, iconPath, ""); + else + systemPostNotification(room_name, formatNotification, iconPath, imgPath); + }); + } else { + systemPostNotification(room_name, formatNotification, iconPath, ""); + } } void NotificationsManager::systemPostNotification(const QString &line1, const QString &line2, - const QString &iconPath) + const QString &iconPath, + const QString &bodyImagePath) { if (!isInitialized) init(); @@ -85,6 +101,10 @@ NotificationsManager::systemPostNotification(const QString &line1, if (!iconPath.isNull()) templ.setImagePath(iconPath.toStdWString()); + if (!bodyImagePath.isNull()) + templ.setHeroImagePath(bodyImagePath.toStdWString(), true); + + templ.setAudioPath(WinToastTemplate::IM); WinToast::instance()->showToast(templ, new CustomHandler()); } From 68114427a8e165db13d59bdc4ff289392ba93e3d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 12 Dec 2023 03:19:59 +0100 Subject: [PATCH 02/10] Remove background color in msix --- resources/AppxManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/AppxManifest.xml b/resources/AppxManifest.xml index 57c7188e..b9a090e1 100644 --- a/resources/AppxManifest.xml +++ b/resources/AppxManifest.xml @@ -26,7 +26,7 @@ uap10:RuntimeBehavior="packagedClassicApp" uap10:TrustLevel="mediumIL"> + Square44x44Logo="nheko.png" BackgroundColor="#ffffff00" /> From d116deedd79379c5ae683ab653d93d75348fa85e Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 12 Dec 2023 03:30:25 +0100 Subject: [PATCH 03/10] Allow clicking notifications on Windows --- .gitlab-ci.yml | 1 + resources/AppxManifest.xml | 2 +- src/notifications/Manager.h | 4 +++- src/notifications/ManagerWin.cpp | 32 +++++++++++++++++++++++++------- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c28efe23..43fd49fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ build-windows: variables: APPVEYOR_REPO_BRANCH: "${CI_COMMIT_REF_NAME}" APPVEYOR_REPO_COMMIT: "${CI_COMMIT_SHORT_SHA}" + CMAKE_BUILD_PARALLEL_LEVEL: 8 before_script: - mkdir -p hunter - Move-Item -Path hunter -Destination C:/hunter diff --git a/resources/AppxManifest.xml b/resources/AppxManifest.xml index b9a090e1..6951c3b7 100644 --- a/resources/AppxManifest.xml +++ b/resources/AppxManifest.xml @@ -26,7 +26,7 @@ uap10:RuntimeBehavior="packagedClassicApp" uap10:TrustLevel="mediumIL"> + Square44x44Logo="nheko.png" BackgroundColor="transparent" /> diff --git a/src/notifications/Manager.h b/src/notifications/Manager.h index 0efc9445..707a4fb3 100644 --- a/src/notifications/Manager.h +++ b/src/notifications/Manager.h @@ -93,7 +93,9 @@ public: #if defined(Q_OS_WINDOWS) private: - void systemPostNotification(const QString &line1, + void systemPostNotification(const QString &roomid, + const QString &eventid, + const QString &line1, const QString &line2, const QString &iconPath, const QString &bodyImagePath); diff --git a/src/notifications/ManagerWin.cpp b/src/notifications/ManagerWin.cpp index 87c49e3c..f1d3797b 100644 --- a/src/notifications/ManagerWin.cpp +++ b/src/notifications/ManagerWin.cpp @@ -21,10 +21,21 @@ using namespace WinToastLib; class CustomHandler : public IWinToastHandler { public: - void toastActivated() const {} + CustomHandler(NotificationsManager *manager_, const QString &roomid_, const QString &eventid_) + : manager(manager_) + , roomid(roomid_) + , eventid(eventid_) + { + } + + void toastActivated() const { manager->notificationClicked(roomid, eventid); } void toastActivated(int) const {} void toastFailed() const { std::wcout << L"Error showing current toast" << std::endl; } void toastDismissed(WinToastDismissalReason) const {} + + NotificationsManager *manager; + QString roomid; + QString eventid; }; namespace { @@ -53,6 +64,8 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if const QImage &icon) { const auto room_name = QString::fromStdString(cache::singleRoomInfo(notification.room_id).name); + auto roomid = QString::fromStdString(notification.room_id); + auto eventid = QString::fromStdString(mtx::accessors::event_id(notification.event)); auto formatNotification = [this, notification] { const auto template_ = getMessageTemplate(notification); @@ -75,19 +88,24 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if QString::fromStdString(mtx::accessors::url(notification.event)) .remove(QStringLiteral("mxc://")), QSize(200, 80), - [this, room_name, formatNotification, iconPath](QString, QSize, QImage, QString imgPath) { + [this, roomid, eventid, room_name, formatNotification, iconPath]( + QString, QSize, QImage, QString imgPath) { if (imgPath.isEmpty()) - systemPostNotification(room_name, formatNotification, iconPath, ""); + systemPostNotification( + roomid, eventid, room_name, formatNotification, iconPath, ""); else - systemPostNotification(room_name, formatNotification, iconPath, imgPath); + systemPostNotification( + roomid, eventid, room_name, formatNotification, iconPath, imgPath); }); } else { - systemPostNotification(room_name, formatNotification, iconPath, ""); + systemPostNotification(roomid, eventid, room_name, formatNotification, iconPath, ""); } } void -NotificationsManager::systemPostNotification(const QString &line1, +NotificationsManager::systemPostNotification(const QString &roomid, + const QString &eventid, + const QString &line1, const QString &line2, const QString &iconPath, const QString &bodyImagePath) @@ -106,7 +124,7 @@ NotificationsManager::systemPostNotification(const QString &line1, templ.setAudioPath(WinToastTemplate::IM); - WinToast::instance()->showToast(templ, new CustomHandler()); + WinToast::instance()->showToast(templ, new CustomHandler(this, roomid, eventid)); } // clang-format off From cfd4f45c3774585014a650339090c7d6d8aa0da5 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 12 Dec 2023 23:10:07 +0100 Subject: [PATCH 04/10] fix macos packages --- .ci/macos/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh index 34dee564..ea6da16d 100755 --- a/.ci/macos/build.sh +++ b/.ci/macos/build.sh @@ -20,7 +20,7 @@ cmake -GNinja -S. -Bbuild \ -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \ -DUSE_BUNDLED_OPENSSL=ON \ - -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON \ + -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON -DKDSingleApplication_STATIC=ON \ -DQt6_DIR=${QT_BASEPATH}/lib/cmake \ -DCI_BUILD=ON cmake --build build From 328613eb4b46cacf37db7608a4b75b0f9f9c9df3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 13 Dec 2023 08:11:31 +0100 Subject: [PATCH 05/10] Don't fail if cache exists --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43fd49fa..da3a4813 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ build-windows: APPVEYOR_REPO_COMMIT: "${CI_COMMIT_SHORT_SHA}" CMAKE_BUILD_PARALLEL_LEVEL: 8 before_script: - - mkdir -p hunter + - mkdir -p hunter -f - Move-Item -Path hunter -Destination C:/hunter script: - ./.ci/windows/build.bat From c67f301f8bb4f26566c442a646fb06d22c611b28 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 13 Dec 2023 14:59:55 +0100 Subject: [PATCH 06/10] Work around clazy claiming we connect a lambda --- .gitlab-ci.yml | 2 +- src/encryption/SelfVerificationStatus.cpp | 3 ++- src/timeline/RoomlistModel.cpp | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da3a4813..57c360e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ build-clazy: TRAVIS_OS_NAME: linux before_script: - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apk dependencies" - - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev clang16 + - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/lib/ccache:${PATH}" diff --git a/src/encryption/SelfVerificationStatus.cpp b/src/encryption/SelfVerificationStatus.cpp index 32e75c4f..b5549ca1 100644 --- a/src/encryption/SelfVerificationStatus.cpp +++ b/src/encryption/SelfVerificationStatus.cpp @@ -24,11 +24,12 @@ SelfVerificationStatus::SelfVerificationStatus(QObject *o) : QObject(o) { connect(ChatPage::instance(), &ChatPage::contentLoaded, this, [this] { + // We connect INSIDE a lambda, not A lambda... connect(cache::client(), &Cache::selfVerificationStatusChanged, this, &SelfVerificationStatus::invalidate, - Qt::UniqueConnection); + Qt::UniqueConnection); // clazy:exclude=lambda-unique-connection cache::client()->markUserKeysOutOfDate({http::client()->user_id().to_string()}); }); diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index cdaa02ec..da639843 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -271,11 +271,13 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification) { if (!models.contains(room_id)) { // ensure we get read status updates and are only connected once + // WORKAROUND(Nico): This is not a lambda, but clazy on alpine currently doesn't + // believe us... connect(cache::client(), &Cache::roomReadStatus, this, &RoomlistModel::updateReadStatus, - Qt::UniqueConnection); + Qt::UniqueConnection); // clazy:exclude=lambda-unique-connection QSharedPointer newRoom(new TimelineModel(manager, room_id)); newRoom->setDecryptDescription(ChatPage::instance()->userSettings()->decryptSidebar()); @@ -529,11 +531,13 @@ RoomlistModel::sync(const mtx::responses::Sync &sync_) addRoom(qroomid); const auto &room_model = models.value(qroomid); + // WORKAROUND(Nico): This is not a lambda, but clazy on alpine currently doesn't + // believe us connect(room_model.data(), &TimelineModel::newCallEvent, ChatPage::instance()->callManager(), &CallManager::syncEvent, - Qt::UniqueConnection); + Qt::UniqueConnection); // clazy:exclude=lambda-unique-connection room_model->sync(room); From 7426a0020041ba7a2a1f9227b44b008a2c9d508f Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 13 Dec 2023 17:37:47 +0100 Subject: [PATCH 07/10] Enable faster zip compression and automatic job sections --- .gitlab-ci.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57c360e7..b5790590 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,8 @@ variables: CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache" # prevent configure tzdata hanging apt install commands DEBIAN_FRONTEND: noninteractive + FF_SCRIPT_SECTIONS: 1 + FF_USE_FASTZIP: 1 build-windows: stage: build @@ -45,9 +47,7 @@ build-clazy: CLAZY_CHECKS: level0,level1,no-non-pod-global-static TRAVIS_OS_NAME: linux before_script: - - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apk dependencies" - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev - - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/lib/ccache:${PATH}" - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) @@ -74,7 +74,6 @@ build-clazy: variables: TRAVIS_OS_NAME: linux before_script: - - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apt dependencies" - apt-get update - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev @@ -85,7 +84,6 @@ build-clazy: - apt-get -y install wget - /usr/sbin/update-ccache-symlinks - rm -rf ../.hunter && mv .hunter ../.hunter || true - - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/lib/ccache:${PATH}" - cmake -GNinja -H. -Bbuild @@ -114,7 +112,6 @@ build-tw: variables: TRAVIS_OS_NAME: linux before_script: - - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apt dependencies" - > zypper --non-interactive install "appstream-glib" @@ -153,7 +150,6 @@ build-tw: "pkgconfig(xcb)" "pkgconfig(xcb-ewmh)" "time" - - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/lib64/ccache:${PATH}" - cmake -GNinja -H. -Bbuild @@ -236,9 +232,7 @@ build-flatpak: - ARCH: arm64 JOBS: 3 before_script: - - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apt dependencies" - apt-get update && apt-get -y install flatpak-builder git python3 curl python3-aiohttp python3-tenacity gir1.2-ostree-1.0 - - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo # see https://github.com/flatpak/flatpak-builder/issues/495 - git config --global protocol.file.allow always @@ -246,15 +240,11 @@ build-flatpak: - export VERSION=$(git describe) - mkdir -p build-flatpak - cd build-flatpak - - echo -e "\e[0Ksection_start:`date +%s`:build_flatpak[collapsed=true]\r\e[0K\e[1m\e[95mBuilding flatpak" - flatpak-builder --install-deps-from=flathub --user --disable-rofiles-fuse --ccache --repo=repo --default-branch=${CI_COMMIT_REF_NAME//\//_} --subject="Build of Nheko ${VERSION} `date` for ${ARCH}" app ../im.nheko.Nheko.yaml --jobs=$JOBS - - echo -e "\e[0Ksection_end:`date +%s`:build_flatpak\r\e[0K" - flatpak build-bundle repo nheko-${ARCH}.flatpak im.nheko.Nheko ${CI_COMMIT_REF_NAME//\//_} after_script: - - echo -e "\e[0Ksection_start:`date +%s`:upload_flatpak[collapsed=true]\r\e[0K\e[1m\e[95mUploading flatpak" - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-${ARCH}.flatpak - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || exit_code=$? - - echo -e "\e[0Ksection_end:`date +%s`:upload_flatpak\r\e[0K" rules: - if : '$CI_PIPELINE_TRIGGERED == null' cache: @@ -274,7 +264,6 @@ build-flatpak: tags: [docker] allow_failure: true before_script: - - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apt dependencies" # Installing the packages needed to download and install third-party tools - apt-get update && apt-get install -y software-properties-common git wget curl python3 python3-pip python3-setuptools @@ -306,7 +295,6 @@ build-flatpak: - /usr/sbin/update-ccache-symlinks - rm -rf ../.hunter && mv .hunter ../.hunter || true - - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/local/bin/:/usr/lib/ccache:${PATH}" From 199cea9b38364b0f25fa400a0db2d051594afed4 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 13 Dec 2023 20:10:09 +0100 Subject: [PATCH 08/10] Fix windows job rule --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5790590..c52402cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,8 @@ build-windows: stage: build image: win10-base tags: [libvirt,powershell] + rules: + - if : '$CI_PIPELINE_TRIGGERED == null' variables: APPVEYOR_REPO_BRANCH: "${CI_COMMIT_REF_NAME}" APPVEYOR_REPO_COMMIT: "${CI_COMMIT_SHORT_SHA}" From 021eed838829149037651211ce1dbfbbf91943ce Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 14 Dec 2023 01:41:17 +0100 Subject: [PATCH 09/10] Add windows code signing --- .ci/windows/sign.bat | 5 +++++ .gitlab-ci.yml | 22 ++++++++++++++++++++++ resources/AppxManifest.xml | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .ci/windows/sign.bat diff --git a/.ci/windows/sign.bat b/.ci/windows/sign.bat new file mode 100644 index 00000000..18cd4931 --- /dev/null +++ b/.ci/windows/sign.bat @@ -0,0 +1,5 @@ +@echo off + +call "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvarsall.bat" x64 + +@C:\smartcardtools\x64\scsigntool -pin %WINDOWS_SIGNING_KEY_PIN% sign /fd SHA256 /t http://timestamp.digicert.com /a /sha1 %WINDOWS_SIGNING_KEY_THUMBPRINT% nheko.msix >nul 2>&1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c52402cf..19ce069f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,6 +38,28 @@ build-windows: paths: - nheko.msix - nheko_win_64.zip + name: nheko-${CI_COMMIT_SHORT_SHA}-windows-unsigned + expose_as: 'windows-app-unsigned' + +codesign-windows: + stage: sign + image: win10-base + tags: [libvirt,powershell] + resource_group: windows_signingA + environment: + name: windows_signing + #variables: + # GIT_STRATEGY: none + script: + - Get-ChildItem -Path Cert:CurrentUser\My + - ./.ci/windows/sign.bat + needs: + - job: build-windows + rules: + - if : '$CI_COMMIT_REF_PROTECTED == "true"' + artifacts: + paths: + - nheko.msix name: nheko-${CI_COMMIT_SHORT_SHA}-windows expose_as: 'windows-app' diff --git a/resources/AppxManifest.xml b/resources/AppxManifest.xml index 6951c3b7..417d0229 100644 --- a/resources/AppxManifest.xml +++ b/resources/AppxManifest.xml @@ -4,7 +4,7 @@ xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"> - + Nheko Nheko-Reborn From d372158dde5161d1fa2ad1e8d8026f7906d369f3 Mon Sep 17 00:00:00 2001 From: q234rty Date: Sat, 16 Dec 2023 18:04:15 +0800 Subject: [PATCH 10/10] Trigger less QEvent::ApplicationPaletteChange The event seems to be very expensive on certain platform theme plugins. Fixes #1639 --- src/MainWindow.cpp | 5 +++++ src/MainWindow.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b7834cba..a4a0eff0 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -201,9 +201,14 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event) // reason?!? if (event->type() == QEvent::ChildAdded && obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) { + QSet newWindows; for (const auto window : QGuiApplication::topLevelWindows()) { + newWindows.insert(window); + if (m_postedWindows.contains(window)) + continue; QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange)); } + m_postedWindows.swap(newWindows); } return false; } diff --git a/src/MainWindow.h b/src/MainWindow.h index c493b5b2..928446aa 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -45,6 +45,9 @@ public: } bool eventFilter(QObject *obj, QEvent *event) override; + +private: + QSet m_postedWindows; }; class MainWindow : public QQuickView