commit:     e6d150f18dce6eec0f6de560fd8226b9bb1437d7
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 18:04:12 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 20:03:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6d150f1

kde-plasma/libksysguard: Pick 6.2 branch fixes

Arjen Hiemstra (2):
      faces/piechart: Use GraphicalEffects.Glow for rendering outline of 
compact text
      faces: Ensure the temporary dir for a preset remains until installed

KDE-bugs:
https://bugs.kde.org/show_bug.cgi?id=494495
https://bugs.kde.org/show_bug.cgi?id=485164

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../libksysguard-6.2.3-fix-piechart-text.patch     | 68 ++++++++++++++++++++++
 .../libksysguard-6.2.3-fix-saving-presets.patch    | 47 +++++++++++++++
 .../libksysguard/libksysguard-6.2.3-r1.ebuild      | 11 +++-
 3 files changed, 124 insertions(+), 2 deletions(-)

diff --git 
a/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-piechart-text.patch 
b/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-piechart-text.patch
new file mode 100644
index 000000000000..cad55fa104a7
--- /dev/null
+++ b/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-piechart-text.patch
@@ -0,0 +1,68 @@
+From 6e164d04743823fca6392ed9cce9e75acd537a0c Mon Sep 17 00:00:00 2001
+From: Arjen Hiemstra <[email protected]>
+Date: Wed, 6 Nov 2024 12:22:02 +0000
+Subject: [PATCH 1/4] faces/piechart: Use GraphicalEffects.Glow for rendering
+ outline of compact text
+
+Apparently using style Text.Outline leads to some pretty bad text
+rendering. So instead use Glow from GraphicalEffects to achieve a
+similar effect but one that's smoother. Unfortunately this uses
+deprecated API because MultiEffect turns out to be completely unusable.
+
+BUG: 494495
+
+
+(cherry picked from commit 69c7ad2122b1c5dd6fcc3edaa8be4ec597bdfda5)
+
+Co-authored-by: Arjen Hiemstra <[email protected]>
+---
+ .../piechart/contents/ui/UsedTotalDisplay.qml | 21 +++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/faces/facepackages/piechart/contents/ui/UsedTotalDisplay.qml 
b/faces/facepackages/piechart/contents/ui/UsedTotalDisplay.qml
+index 50242cfc..52cc787c 100644
+--- a/faces/facepackages/piechart/contents/ui/UsedTotalDisplay.qml
++++ b/faces/facepackages/piechart/contents/ui/UsedTotalDisplay.qml
+@@ -8,6 +8,8 @@ import QtQuick
+ import QtQuick.Controls
+ import QtQuick.Layouts
+ 
++import Qt5Compat.GraphicalEffects
++
+ import org.kde.kirigami as Kirigami
+ 
+ import org.kde.ksysguard.formatter as Formatter
+@@ -87,17 +89,24 @@ Item {
+             fontSizeMode: Text.HorizontalFit
+             minimumPointSize: Kirigami.Theme.smallFont.pointSize * 0.8
+ 
+-            // When we're small the text is allowed to flow over the 
underlying
+-            // pie chart, to improve contrast we render it with an outline 
using
+-            // the inverse text color.
+-            style: root.constrained ? Text.Outline : Text.Normal
+-            styleColor: Qt.rgba(1.0 - Kirigami.Theme.textColor.r, 1.0 - 
Kirigami.Theme.textColor.g, 1.0 - Kirigami.Theme.textColor.b, 1.0)
+-
+             // This slightly odd combination ensures that when the width 
becomes
+             // too small, the unit gets hidden because the text wraps but the
+             // wrapped part is hidden due to maximumLineCount.
+             wrapMode: Text.Wrap
+             maximumLineCount: 1
++
++            // When we're small we want to overlap the text onto the chart. To
++            // ensure the text remains readable, we want to have some sort of
++            // outline behind the text. Unfortunately, there is no way to
++            // achieve the visual effect we want here without using deprecated
++            // GraphicalEffects. MultiEffect is completely unusable and using
++            // `style: Text.Outline` makes the font rendering look pretty bad.
++            layer.enabled: root.constrained
++            layer.effect: Glow {
++                radius: 4
++                spread: 0.75
++                color: Kirigami.Theme.backgroundColor
++            }
+         }
+ 
+         Kirigami.Separator {
+-- 
+2.47.0
+

diff --git 
a/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-saving-presets.patch 
b/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-saving-presets.patch
new file mode 100644
index 000000000000..dfd4bd0dd936
--- /dev/null
+++ b/kde-plasma/libksysguard/files/libksysguard-6.2.3-fix-saving-presets.patch
@@ -0,0 +1,47 @@
+From 9ea3571c903db1ebe72d5091eefc052288af252f Mon Sep 17 00:00:00 2001
+From: Arjen Hiemstra <[email protected]>
+Date: Thu, 7 Nov 2024 11:54:35 +0100
+Subject: [PATCH 4/4] faces: Ensure the temporary dir for a preset remains
+ until installed
+
+QTemporaryDir deletes the temporary directory when it goes out of scope.
+However, installing the preset with KPackage is an asynchronous
+operation that can extend beyond the current scope. This can cause the
+preset data to be deleted while we're still installing. To ensure this
+doesn't happen, extend the lifetime of the QTemporaryDir into the lambda
+we use to handle the job finished, so that it lives at least as long as
+the job.
+
+BUG: 485164
+---
+ faces/SensorFaceController.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/faces/SensorFaceController.cpp b/faces/SensorFaceController.cpp
+index 06eda200..60e6a579 100644
+--- a/faces/SensorFaceController.cpp
++++ b/faces/SensorFaceController.cpp
+@@ -954,6 +954,11 @@ void SensorFaceController::savePreset()
+         pluginName += QString::number(suffix);
+     }
+ 
++    // Important! We need to ensure the directory remains valid as long as it 
has
++    // not been installed yet. Since the install is asynchronous, we need to 
make
++    // sure that the QTemporaryDir does not go out of scope until the install 
is
++    // finished, so this directory will be moved into the lambda connected to 
the
++    // job finished signal below to ensure it lives as long as the job.
+     QTemporaryDir dir;
+     if (!dir.isValid()) {
+         return;
+@@ -1013,7 +1018,7 @@ void SensorFaceController::savePreset()
+     configGroup.sync();
+ 
+     auto *job = 
KPackage::PackageJob::install(QStringLiteral("Plasma/Applet"), dir.path());
+-    connect(job, &KJob::finished, this, [this]() {
++    connect(job, &KJob::finished, this, [this, dir = std::move(dir)]() {
+         d->availablePresetsModel->reload();
+     });
+ }
+-- 
+2.47.0
+

diff --git a/kde-plasma/libksysguard/libksysguard-6.2.3-r1.ebuild 
b/kde-plasma/libksysguard/libksysguard-6.2.3-r1.ebuild
index 975ca0ee3c5c..2880a6b41ff2 100644
--- a/kde-plasma/libksysguard/libksysguard-6.2.3-r1.ebuild
+++ b/kde-plasma/libksysguard/libksysguard-6.2.3-r1.ebuild
@@ -15,7 +15,7 @@ SLOT="6/9"
 KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
 IUSE=""
 
-RDEPEND="
+DEPEND="
        dev-libs/libnl:3
        >=dev-qt/qtbase-${QTMIN}:6[dbus,gui,network,widgets]
        >=dev-qt/qtdeclarative-${QTMIN}:6
@@ -31,11 +31,18 @@ RDEPEND="
        sys-apps/lm-sensors:=
        sys-libs/zlib
 "
-DEPEND="${RDEPEND}"
+RDEPEND="${DEPEND}
+       >=dev-qt/qt5compat-${QTMIN}:6[qml]
+"
 
 # -m 0755 to avoid suid with USE="-filecaps"
 FILECAPS=( -m 0755 cap_sys_nice=ep usr/libexec/ksysguard/ksgrd_network_helper )
 
+PATCHES=(
+       "${FILESDIR}/${P}-fix-piechart-text.patch" # KDE-bug #494495
+       "${FILESDIR}/${P}-fix-saving-presets.patch" # KDE-bug #485164
+)
+
 src_configure() {
        local mycmakeargs=(
                -DCMAKE_DISABLE_FIND_PACKAGE_Libcap=ON

Reply via email to