调整主题配置为白名单,默认包括部分需要支持的kiran桌面环境进程名
This commit is contained in:
parent
86e1d00a8b
commit
fffd6559ae
@ -1,7 +1,8 @@
|
||||
From eae79d3e1836ed1aa31a92e32235f33515e4e584 Mon Sep 17 00:00:00 2001
|
||||
From 60547666dc4cafad4d65485c9830ced06a2e4d15 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Tue, 8 Nov 2022 17:41:39 +0800
|
||||
Subject: [PATCH] fix(Memory leak): Fix the memory leak
|
||||
Date: Tue, 8 Nov 2022 16:37:10 +0800
|
||||
Subject: [PATCH 1/4] fix(Memory leak): Fix the memory leak of allocating
|
||||
QPalette when switching themes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -9,8 +10,7 @@ Content-Transfer-Encoding: 8bit
|
||||
修复切换主题时分配QPalette的内存泄漏
|
||||
---
|
||||
platformtheme/kiran-theme.cpp | 8 ++++++++
|
||||
style/src/render-helper.cpp | 3 ++-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/platformtheme/kiran-theme.cpp b/platformtheme/kiran-theme.cpp
|
||||
index 1955fc4..bf48006 100644
|
||||
@ -40,25 +40,6 @@ index 1955fc4..bf48006 100644
|
||||
// 该接口原本用于windows通知窗口主题变化时使用,现用来通知调用QGuiApplicationPrivate::notifyThemeChanged
|
||||
QGuiApplicationPrivate::processThemeChanged(&event);
|
||||
emit qApp->paletteChanged(*palette(SystemPalette));
|
||||
diff --git a/style/src/render-helper.cpp b/style/src/render-helper.cpp
|
||||
index 60f66e3..1a48998 100644
|
||||
--- a/style/src/render-helper.cpp
|
||||
+++ b/style/src/render-helper.cpp
|
||||
@@ -313,6 +313,7 @@ QPixmap RenderHelper::changeSVGFillColor(const QString &svgFile, const QColor &f
|
||||
tinyDoc->draw(&tempPainter);
|
||||
tempPainter.end();
|
||||
|
||||
+ delete tinyDoc;
|
||||
return tempPixmap;
|
||||
}
|
||||
|
||||
@@ -381,4 +382,4 @@ void RenderHelper::renderTabBarTab(QPainter *painter,
|
||||
painter->drawPath(painterPath);
|
||||
}
|
||||
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From fdb75046726d3134ea4af3616385eae10f92df5d Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Fri, 7 Apr 2023 09:26:09 +0800
|
||||
Subject: [PATCH 1/2] fix(arrow): Adjust the theme drawing arrow
|
||||
Subject: [PATCH 2/4] fix(arrow): Adjust the theme drawing arrow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
32
0003-build-qt5.11.1-Adaptation-Qt5.11.1.patch
Normal file
32
0003-build-qt5.11.1-Adaptation-Qt5.11.1.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From b4a50383201b332bc13c90033f1d9821b2e0e0f7 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Fri, 7 Apr 2023 09:27:04 +0800
|
||||
Subject: [PATCH 3/4] build(qt5.11.1): Adaptation Qt5.11.1
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配Qt5.11.1,通过宏区分调用Qt5.11.1的接口
|
||||
---
|
||||
style-helper/src/font-size-manager-private.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/style-helper/src/font-size-manager-private.h b/style-helper/src/font-size-manager-private.h
|
||||
index a7a5577..eccf04b 100644
|
||||
--- a/style-helper/src/font-size-manager-private.h
|
||||
+++ b/style-helper/src/font-size-manager-private.h
|
||||
@@ -26,7 +26,11 @@ public:
|
||||
void init()
|
||||
{
|
||||
connect(qGuiApp, &QGuiApplication::fontChanged, this, &FontSizeManagerPrivate::handleGuiAppFontChanged);
|
||||
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
connect(&m_destorySignalMapper, &QSignalMapper::mappedWidget, this, &FontSizeManagerPrivate::handleBindWidgetDestroyed);
|
||||
+#else
|
||||
+ connect(&m_destorySignalMapper, QOverload<QWidget *>::of(&QSignalMapper::mapped), this, &FontSizeManagerPrivate::handleBindWidgetDestroyed);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void updateWidgetFont()
|
||||
--
|
||||
2.33.0
|
||||
|
||||
158
0004-feat-style-app-Adjust-the-topic-configuration-to-whi.patch
Normal file
158
0004-feat-style-app-Adjust-the-topic-configuration-to-whi.patch
Normal file
@ -0,0 +1,158 @@
|
||||
From 71223161f8c103846079ce5987ecce6a59f04a62 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Mon, 5 Jun 2023 15:40:41 +0800
|
||||
Subject: [PATCH 4/4] feat(style app): Adjust the topic configuration to
|
||||
whitelist
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 调整主题配置为白名单,默认包括部分需要支持的kiran桌面环境进程名
|
||||
---
|
||||
common/data/kiran-qt5-integration.ini | 5 +++--
|
||||
common/src/kiran-integration-settings.cpp | 26 +++++++++++++++++++----
|
||||
common/src/kiran-integration-settings.h | 16 ++++++++++++--
|
||||
platformtheme/kiran-theme.cpp | 4 ++--
|
||||
style/src/kiran-style-plugin.cpp | 8 +++----
|
||||
5 files changed, 45 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/common/data/kiran-qt5-integration.ini b/common/data/kiran-qt5-integration.ini
|
||||
index 478b608..d0fd969 100644
|
||||
--- a/common/data/kiran-qt5-integration.ini
|
||||
+++ b/common/data/kiran-qt5-integration.ini
|
||||
@@ -1,2 +1,3 @@
|
||||
-#[Style]
|
||||
-#disable-kiran-style-apps=Do not load kiranstyle applications, eg: assistant-qt5,qdbusviewer
|
||||
\ No newline at end of file
|
||||
+[Style]
|
||||
+#启用kiran style的应用列表,已内置部分kiran桌面环境的组件,eg: kiran-*,kiran-panel
|
||||
+kiran-style-apps=
|
||||
\ No newline at end of file
|
||||
diff --git a/common/src/kiran-integration-settings.cpp b/common/src/kiran-integration-settings.cpp
|
||||
index 7726fad..a781fd3 100644
|
||||
--- a/common/src/kiran-integration-settings.cpp
|
||||
+++ b/common/src/kiran-integration-settings.cpp
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QScopedPointer>
|
||||
#include <QSettings>
|
||||
+#include <QRegExp>
|
||||
|
||||
KiranIntegrationSettings::KiranIntegrationSettings()
|
||||
{
|
||||
@@ -18,8 +19,8 @@ KiranIntegrationSettings::~KiranIntegrationSettings()
|
||||
void KiranIntegrationSettings::init()
|
||||
{
|
||||
QSettings settings("/etc/kiran-qt5-integration/kiran-qt5-integration.ini",QSettings::IniFormat);
|
||||
- QStringList disableStyleApps = settings.value("Style/disable-kiran-style-apps","").toStringList();
|
||||
- m_disableKiranStyleApps.append(disableStyleApps);
|
||||
+ QStringList kiranStyleApps = settings.value("Style/kiran-style-apps","").toStringList();
|
||||
+ m_kiranStyleApps.unite(kiranStyleApps.toSet());
|
||||
}
|
||||
|
||||
KiranIntegrationSettings* KiranIntegrationSettings::instance()
|
||||
@@ -39,7 +40,24 @@ KiranIntegrationSettings* KiranIntegrationSettings::instance()
|
||||
return pInst.data();
|
||||
}
|
||||
|
||||
-QStringList KiranIntegrationSettings::getDisableKiranStyleApps()
|
||||
+QSet<QString> KiranIntegrationSettings::getKiranStyleApps()
|
||||
{
|
||||
- return m_disableKiranStyleApps;
|
||||
+ return m_kiranStyleApps;
|
||||
}
|
||||
+
|
||||
+bool KiranIntegrationSettings::appKiranStyleAvailable(const QString& app)
|
||||
+{
|
||||
+ bool matched = false;
|
||||
+ QRegExp regExp("",Qt::CaseSensitive,QRegExp::Wildcard);
|
||||
+
|
||||
+ auto set = KiranIntegrationSettings::instance()->getKiranStyleApps();
|
||||
+ foreach(auto pattern,set)
|
||||
+ {
|
||||
+ regExp.setPattern(pattern);
|
||||
+ matched = regExp.exactMatch(app);
|
||||
+ if( matched )
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return matched;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/common/src/kiran-integration-settings.h b/common/src/kiran-integration-settings.h
|
||||
index e43c1b6..ff99929 100644
|
||||
--- a/common/src/kiran-integration-settings.h
|
||||
+++ b/common/src/kiran-integration-settings.h
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QStringList>
|
||||
+#include <QSet>
|
||||
|
||||
class KiranIntegrationSettings
|
||||
{
|
||||
@@ -8,12 +9,23 @@ public:
|
||||
static KiranIntegrationSettings* instance();
|
||||
~KiranIntegrationSettings();
|
||||
|
||||
- QStringList getDisableKiranStyleApps();
|
||||
+ QSet<QString> getKiranStyleApps();
|
||||
+ static bool appKiranStyleAvailable(const QString& app);
|
||||
|
||||
private:
|
||||
KiranIntegrationSettings();
|
||||
void init();
|
||||
|
||||
private:
|
||||
- QStringList m_disableKiranStyleApps = {"lightdm-kiran-greeter","kiran-screensaver"};
|
||||
+ QSet<QString> m_kiranStyleApps = {
|
||||
+ "kiran-control-panel",
|
||||
+ "kiran-cpanel-*",
|
||||
+ "kiran-polkit-agent",
|
||||
+ "kiran-avatar-editor",
|
||||
+ "kiran-calculator",
|
||||
+ "kiran-power-status-icon",
|
||||
+ "kiran-network-status-icon",
|
||||
+ "kiran-audio-status-icon",
|
||||
+ "kiran-flameshot"
|
||||
+ };
|
||||
};
|
||||
\ No newline at end of file
|
||||
diff --git a/platformtheme/kiran-theme.cpp b/platformtheme/kiran-theme.cpp
|
||||
index bf48006..9fec043 100644
|
||||
--- a/platformtheme/kiran-theme.cpp
|
||||
+++ b/platformtheme/kiran-theme.cpp
|
||||
@@ -100,8 +100,8 @@ const QPalette* KiranTheme::palette(QPlatformTheme::Palette type) const
|
||||
return QGenericUnixTheme::palette(type);
|
||||
}
|
||||
|
||||
- QStringList blackapps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
|
||||
- if( blackapps.contains(qAppName()) )
|
||||
+ bool enable = KiranIntegrationSettings::appKiranStyleAvailable(qAppName());
|
||||
+ if( !enable )
|
||||
{
|
||||
return QGenericUnixTheme::palette(type);
|
||||
}
|
||||
diff --git a/style/src/kiran-style-plugin.cpp b/style/src/kiran-style-plugin.cpp
|
||||
index aefbabc..08eaae2 100644
|
||||
--- a/style/src/kiran-style-plugin.cpp
|
||||
+++ b/style/src/kiran-style-plugin.cpp
|
||||
@@ -28,11 +28,11 @@ QStyle *KiranStylePlugin::create(const QString & key)
|
||||
{
|
||||
if( key.compare("kiran",Qt::CaseInsensitive) == 0 )
|
||||
{
|
||||
- QStringList disableApps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
|
||||
- QString processName = qAppName();
|
||||
- if( disableApps.contains(processName) )
|
||||
+ auto processName = qAppName();
|
||||
+ bool enable = KiranIntegrationSettings::appKiranStyleAvailable(processName);
|
||||
+ if( !enable )
|
||||
{
|
||||
- qDebug("%s in black list,create fusion style for it.",processName.toStdString().c_str());
|
||||
+ qDebug("%s not enable kiran style,create fusion style for it.",processName.toStdString().c_str());
|
||||
return QStyleFactory::create("fusion");
|
||||
}
|
||||
else
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
Name: kiran-qt5-integration
|
||||
Version: 2.4.0
|
||||
Release: 3
|
||||
Release: 6
|
||||
Summary: Kiran desktop platform integration plugin.
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Patch0001: 0001-fix-Memory-leak-Fix-the-memory-leak.patch
|
||||
Patch0002: 0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch
|
||||
Patch0003: 0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch
|
||||
|
||||
Patch0001: 0001-fix-Memory-leak-Fix-the-memory-leak-of-allocating-QP.patch
|
||||
Patch0002: 0002-fix-arrow-Adjust-the-theme-drawing-arrow.patch
|
||||
Patch0003: 0003-build-qt5.11.1-Adaptation-Qt5.11.1.patch
|
||||
Patch0004: 0004-feat-style-app-Adjust-the-topic-configuration-to-whi.patch
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
BuildRequires: gcc-c++
|
||||
@ -63,6 +65,15 @@ make %{?_smp_mflags}
|
||||
%{_libdir}/pkgconfig/kiran-style-helper.pc
|
||||
|
||||
%changelog
|
||||
* Mon Jun 05 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.4.0-6
|
||||
- KYOS-F: Adjust the topic configuration to whitelist
|
||||
|
||||
* Wed Apr 12 2023 kpkg <kpkg.kylinsec.com.cn> - 2.4.0-5
|
||||
- rebuild for KY3.4-5-GC-KiranUI-2.5
|
||||
|
||||
* Fri Apr 07 2023 kpkg <kpkg.kylinsec.com.cn> - 2.4.0-4
|
||||
- rebuild for KiranUI-2.5-next
|
||||
|
||||
* Fri Apr 07 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.4.0-3
|
||||
- KYOS-F: Adaptation Qt5.11.1,Adjust the theme drawing arrow
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user