!13 添加yaml文件,kiranui2.4调整颜色表支持色块设计

From: @liubuguiii 
Reviewed-by: @tangjie02 
Signed-off-by: @tangjie02
This commit is contained in:
openeuler-ci-bot 2022-10-31 05:41:26 +00:00 committed by Gitee
commit 9b3e26660d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 9 additions and 920 deletions

View File

@ -1,370 +0,0 @@
From ebe794510e8fef1be744778cd5ea366b6bf6b3f3 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Fri, 22 Jul 2022 15:25:15 +0800
Subject: [PATCH] feat(style): add window hover color
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增Window Hover颜色解决类似网络托盘背景等类似显示问题
---
style-helper/data/_functions.scss | 3 +
style-helper/data/color-scheme/dark.colors | 1 +
style-helper/data/color-scheme/light.colors | 1 +
style-helper/data/qt5.scss | 137 ++++++++------------
style/src/style.cpp | 2 +-
5 files changed, 58 insertions(+), 86 deletions(-)
diff --git a/style-helper/data/_functions.scss b/style-helper/data/_functions.scss
index be74dbb..dacdc7a 100644
--- a/style-helper/data/_functions.scss
+++ b/style-helper/data/_functions.scss
@@ -157,6 +157,9 @@
@if $c == background {
@return $WindowBackgroundNormal;
}
+ @if $c == background-hover {
+ @return $WindowBackgroundHover;
+ }
@if $c == foreground {
@return $WindowForegroundNormal;
}
diff --git a/style-helper/data/color-scheme/dark.colors b/style-helper/data/color-scheme/dark.colors
index 68aa236..abfb1f8 100644
--- a/style-helper/data/color-scheme/dark.colors
+++ b/style-helper/data/color-scheme/dark.colors
@@ -57,6 +57,7 @@ ForegroundChecked=Default::Selection
BackgroundNormal=Default::BackgroundNormal
ForegroundNormal=Default::ForegroundNormal
BorderNormal=Default::Border
+BackgroundHover=mix(Window::BackgroundNormal, Window::ForegroundNormal, 0.9)
[Colors:Selection]
BackgroundNormal=Default::Selection
diff --git a/style-helper/data/color-scheme/light.colors b/style-helper/data/color-scheme/light.colors
index e15e269..08b7604 100644
--- a/style-helper/data/color-scheme/light.colors
+++ b/style-helper/data/color-scheme/light.colors
@@ -57,6 +57,7 @@ ForegroundChecked=Default::Selection
BackgroundNormal=Default::BackgroundNormal
ForegroundNormal=Default::ForegroundNormal
BorderNormal=Default::Border
+BackgroundHover=mix(Window::BackgroundNormal, Window::ForegroundNormal, 0.9)
BackgroundAlternate=227,229,231
[Colors:Selection]
diff --git a/style-helper/data/qt5.scss b/style-helper/data/qt5.scss
index 39ad308..aa927d5 100644
--- a/style-helper/data/qt5.scss
+++ b/style-helper/data/qt5.scss
@@ -73,6 +73,7 @@ $bare_foreground_backdrop_insensitive: #{"" + internal_insensitive(internal_back
// window
$window_background_normal: #{"" + internal_window(background)};
+$window_background_hover: #{"" + internal_window(background-hover)};
$window_background_insensitive: #{"" + internal_insensitive(internal_window(background))};
$window_background_backdrop: #{"" + internal_backdrop(internal_window(background))};
$window_background_backdrop_insensitive: #{"" + internal_insensitive(internal_backdrop(internal_window(background)))};
@@ -194,6 +195,10 @@ Window {
Border: $window_border_normal;
}
+Window:hover {
+ Background: $window_background_hover;
+}
+
Window:disabled {
Background: $window_background_insensitive;
Foreground: $window_foreground_insensitive;
@@ -249,7 +254,7 @@ Widget:checked,
Widget:selected {
Background: $widget_background_checked;
Foreground: $widget_foreground_checked;
- Border: $widget_border_focus;
+ Border: $widget_border_focus;
}
Widget:disabled {
@@ -301,220 +306,182 @@ TitleBar:disabled {
/** --- 提供给KiranStyle直接使用的相关属性 --- **/
-Frame
-{
+Frame {
Background: $window_background_normal;
Border: $window_border_normal;
}
-Frame:disabled
-{
+Frame:disabled {
Background: $window_background_insensitive;
Border: $window_border_insensitive;
}
-Button
-{
+Button {
Background: $widget_background_normal;
Border: $widget_border_normal;
}
-Button:hover
-{
+Button:hover {
Background: $widget_background_hover;
}
-Button:pressed
-{
+Button:pressed {
Background: $widget_background_active;
}
-Button:disabled
-{
+Button:disabled {
Background: $widget_background_insensitive;
Border: $widget_border_insensitive;
}
-SpecialButton
-{
- DefaultBackground:$special_button_default_normal;
- WarnningBackground:$special_button_warnning_normal;
+SpecialButton {
+ DefaultBackground: $special_button_default_normal;
+ WarnningBackground: $special_button_warnning_normal;
}
-SpecialButton:hover
-{
- DefaultBackground:$special_button_default_hover;
- WarnningBackground:$special_button_warnning_hover;
+SpecialButton:hover {
+ DefaultBackground: $special_button_default_hover;
+ WarnningBackground: $special_button_warnning_hover;
}
-SpecialButton:pressed
-{
- DefaultBackground:$special_button_default_active;
- WarnningBackground:$special_button_warnning_active;
+SpecialButton:pressed {
+ DefaultBackground: $special_button_default_active;
+ WarnningBackground: $special_button_warnning_active;
}
-SpecialButton:disabled
-{
- DefaultBackground:$special_button_default_insensitive;
- WarnningBackground:$special_button_warnning_insensitive;
+SpecialButton:disabled {
+ DefaultBackground: $special_button_default_insensitive;
+ WarnningBackground: $special_button_warnning_insensitive;
}
-Edit
-{
+Edit {
Background: $view_background_normal;
Foreground: $view_foreground_normal;
Border: $view_border_normal;
}
-Edit:focus
-{
+Edit:focus {
Border: $view_border_focus;
}
-Edit:disabled
-{
+Edit:disabled {
Background: $view_background_insensitive;
Border: $view_border_insensitive;
}
-Indicator
-{
+Indicator {
Arrow: $widget_foreground_normal;
}
-Indicator:disabled
-{
+Indicator:disabled {
Arrow: $widget_foreground_insensitive;
}
-Combo
-{
+Combo {
Background: transparent;
Border: $widget_border_normal;
}
-Combo:hover
-{
+Combo:hover {
Background: $widget_background_hover;
}
-Combo:pressed
-{
+Combo:pressed {
Background: $widget_background_active;
}
-Combo:disabled
-{
+Combo:disabled {
Background: $widget_background_insensitive;
Border: $widget_border_insensitive;
}
-ItemView
-{
+ItemView {
Branch: $widget_border_normal;
}
-ItemView:disabled
-{
+ItemView:disabled {
Branch: $widget_border_insensitive;
}
-MenuBar
-{
+MenuBar {
ItemBackground: $window_background_normal;
EmptyAreaBackground: $window_background_normal;
}
-MenuBar:hover
-{
+MenuBar:hover {
ItemBackground: $widget_background_hover;
}
-MenuBar:pressed
-{
+MenuBar:pressed {
ItemBackground: $widget_background_active;
}
-MenuBar:disabled
-{
+MenuBar:disabled {
ItemBackground: $window_background_insensitive;
EmptyAreaBackground: $window_background_insensitive;
}
-Progress
-{
+Progress {
Groove: $bare_background_normal;
Content: $bare_foreground_checked;
}
-Progress:disabled
-{
+Progress:disabled {
Groove: $bare_background_insensitive;
Content: $bare_foreground_insensitive;
}
-Scroll
-{
+Scroll {
Slider: $bare_background_normal;
}
-Scroll:hover
-{
+Scroll:hover {
Slider: $bare_background_hover;
}
-Scroll:pressed
-{
+Scroll:pressed {
Slider: $bare_background_checked;
}
-Scroll:disabled
-{
+Scroll:disabled {
Slider: $bare_background_insensitive;
}
-Slider
-{
+Slider {
Groove: $bare_background_normal;
Content: $bare_foreground_checked;
HandleBorder: white;
HandleBackground: $bare_foreground_checked;
}
-Slider:pressed
-{
+Slider:pressed {
HandleBorder: white;
HandleBackground: white;
}
-Slider:disabled
-{
+Slider:disabled {
Groove: $bare_background_insensitive;
Content: $bare_foreground_insensitive;
HandleBorder: $bare_foreground_insensitive;
HandleBackground: $bare_foreground_insensitive;
}
-SpinBox
-{
+SpinBox {
Background: $widget_background_normal;
Border: $widget_border_normal;
SignColor: $widget_foreground_normal;
}
-SpinBox:hover
-{
+SpinBox:hover {
Background: $widget_background_hover;
Border: $widget_border_hover;
}
-SpinBox:pressed
-{
+SpinBox:pressed {
Background: $widget_background_active;
}
-SpinBox:disabled
-{
+SpinBox:disabled {
Background: $widget_background_insensitive;
Border: $widget_border_insensitive;
SignColor: $widget_foreground_insensitive;
diff --git a/style/src/style.cpp b/style/src/style.cpp
index fa0741b..01ca5e8 100644
--- a/style/src/style.cpp
+++ b/style/src/style.cpp
@@ -64,7 +64,7 @@ QDebug operator<<(QDebug dbg, const QColor &color)
using namespace Kiran;
-//FIXME:为什么加入namespace导致crash
+//FIXME:由于kiran-widgets-qt5之前包含的Kiran::Style重名导致现在暂时不能加入Kiran命名控件否则将引起崩溃
Style::Style()
: ParentStyle()
{
--
2.33.0

View File

@ -1,129 +0,0 @@
From 53a57618838cb9f816af5cce5906e9eec98db7df Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Fri, 8 Jul 2022 17:24:27 +0800
Subject: [PATCH 1/2] refactor(log): Reduce some log output levels
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 降低部分日志输出级别
---
common/src/kiran-appearance-monitor.cpp | 14 +++++++-------
platformtheme/kiran-theme.cpp | 4 ++--
style-helper/src/scheme-loader.cpp | 2 +-
style/src/kiran-style-plugin.cpp | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/common/src/kiran-appearance-monitor.cpp b/common/src/kiran-appearance-monitor.cpp
index 2046757..7af4f9d 100644
--- a/common/src/kiran-appearance-monitor.cpp
+++ b/common/src/kiran-appearance-monitor.cpp
@@ -57,7 +57,7 @@ KiranAppearanceMonitor::KiranAppearanceMonitor(QObject *parent)
}
else
{
- qWarning(kiranPlatformThemeCommon) << "parse titlebar font failed!";
+ qDebug(kiranPlatformThemeCommon) << "parse titlebar font failed!";
}
//icon theme
@@ -70,7 +70,7 @@ KiranAppearanceMonitor::KiranAppearanceMonitor(QObject *parent)
}
else
{
- qWarning(kiranPlatformThemeCommon) << "get icon theme failed," << themeReply.error();
+ qDebug(kiranPlatformThemeCommon) << "get icon theme failed," << themeReply.error();
}
//gtk theme
@@ -89,12 +89,12 @@ KiranAppearanceMonitor::KiranAppearanceMonitor(QObject *parent)
}
else
{
- qWarning(kiranPlatformThemeCommon) << "get gtk theme failed," << themeReply.error();
+ qDebug(kiranPlatformThemeCommon) << "get gtk theme failed," << themeReply.error();
}
}
else
{
- qCritical(kiranPlatformThemeCommon) << "kiran session daemon appearance service isn't registered!";
+ qDebug(kiranPlatformThemeCommon) << "kiran session daemon appearance service isn't registered!";
}
connect(m_appearanceIface, &KiranAppearanceProxy::FontChanged,
@@ -113,7 +113,7 @@ KiranAppearanceMonitor::KiranAppearanceMonitor(QObject *parent)
}
else
{
- qCritical(kiranPlatformThemeCommon) << "kiran session daemon display service isn't registered!";
+ qDebug(kiranPlatformThemeCommon) << "kiran session daemon display service isn't registered!";
}
connect(m_displayIface, &KiranDisplayProxy::window_scaling_factorChanged,
@@ -197,7 +197,7 @@ bool KiranAppearanceMonitor::parseFontValue(const QString &font, QString &fontNa
QFontDatabase fontDatabase;
if( !fontDatabase.hasFamily(fontName) )
{
- qInfo() << "font data base don't has this font:" << fontName;
+ qDebug(kiranPlatformThemeCommon) << "font data base don't has this font:" << fontName;
return false;
}
@@ -252,7 +252,7 @@ void KiranAppearanceMonitor::handleThemeSettingChanged(int type, const QString &
if(gtkTheme!=m_gtkThemeName)
{
- qInfo() << "gtk theme changed:" << themeName;
+ qDebug(kiranPlatformThemeCommon) << "gtk theme changed:" << themeName;
m_gtkThemeName = gtkTheme;
emit gtkThemeChanged(m_gtkThemeName);
}
diff --git a/platformtheme/kiran-theme.cpp b/platformtheme/kiran-theme.cpp
index 3a046e9..4636030 100644
--- a/platformtheme/kiran-theme.cpp
+++ b/platformtheme/kiran-theme.cpp
@@ -274,13 +274,13 @@ void KiranTheme::handleScaleFactorChanged(int factor)
}
else
{
- qWarning(kiranPlatformTheme) << "not support this factor:" << factor;
+ qDebug(kiranPlatformTheme) << "not support this factor:" << factor;
return;
}
}
else
{
- qWarning(kiranPlatformTheme) << "disable real time scaling,ignore scale factor changed!";
+ qDebug(kiranPlatformTheme) << "disable real time scaling,ignore scale factor changed!";
}
}
diff --git a/style-helper/src/scheme-loader.cpp b/style-helper/src/scheme-loader.cpp
index bd6ac05..2c71094 100644
--- a/style-helper/src/scheme-loader.cpp
+++ b/style-helper/src/scheme-loader.cpp
@@ -290,7 +290,7 @@ bool SchemeLoader::load(const QString& schemeFile)
}
m_isValid = true;
- qInfo() << "load" << schemeFile << "succeed!";
+ qDebug() << "load" << schemeFile << "succeed!";
return true;
}
diff --git a/style/src/kiran-style-plugin.cpp b/style/src/kiran-style-plugin.cpp
index ed7d965..bb3df1f 100644
--- a/style/src/kiran-style-plugin.cpp
+++ b/style/src/kiran-style-plugin.cpp
@@ -34,7 +34,7 @@ QStyle *KiranStylePlugin::create(const QString & key)
return QStyleFactory::create("fusion");
}
- qInfo("create style:%s",key.toStdString().c_str());
+ qDebug("create style:%s",key.toStdString().c_str());
if( key.compare("kiran",Qt::CaseInsensitive) == 0 )
{
return new Style();
--
2.33.0

View File

@ -1,151 +0,0 @@
From 8b29f13e09e2ed34541d63656d03da00d33dce38 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Mon, 8 Aug 2022 16:59:10 +0800
Subject: [PATCH 1/2] refactor(style): update painting effect of the scrolling
area
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 调整滚动区域绘制效果
---
style/src/draw-helper/draw-common-helper.cpp | 11 ++++-
style/src/render-helper.cpp | 6 +++
style/src/style.cpp | 46 +++++++++++++++-----
style/src/style.h | 2 +
4 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/style/src/draw-helper/draw-common-helper.cpp b/style/src/draw-helper/draw-common-helper.cpp
index 650ec94..ed94654 100644
--- a/style/src/draw-helper/draw-common-helper.cpp
+++ b/style/src/draw-helper/draw-common-helper.cpp
@@ -25,6 +25,7 @@
#include <QRect>
#include <QStyle>
#include <QStyleOption>
+#include <QAbstractScrollArea>
namespace Kiran
{
@@ -39,7 +40,15 @@ bool drawPEFrame(const QStyle *style,
background = schemeLoader->getColor(widget,option,SchemeLoader::Frame_Background);
border = schemeLoader->getColor(widget,option,SchemeLoader::Frame_Border);
- RenderHelper::renderFrame(painter, option->rect, 1, 0, background,border );
+ if( qobject_cast<const QAbstractScrollArea*>(widget) )
+ {
+ RenderHelper::renderFrame(painter, option->rect, 1, 0, Qt::transparent,border );
+ }
+ else
+ {
+ RenderHelper::renderFrame(painter, option->rect, 1, 0, background,border );
+ }
+
return true;
}
diff --git a/style/src/render-helper.cpp b/style/src/render-helper.cpp
index b8117ff..60f66e3 100644
--- a/style/src/render-helper.cpp
+++ b/style/src/render-helper.cpp
@@ -53,7 +53,13 @@ bool RenderHelper::drawTreeBranches()
bool RenderHelper::isQtQuickControl(const QStyleOption *option, const QWidget *widget)
{
+#if QT_VERSION >= 0x050000
return (widget == nullptr) && option && option->styleObject && option->styleObject->inherits("QQuickItem");
+#else
+ Q_UNUSED(widget);
+ Q_UNUSED(option);
+ return false;
+#endif
}
bool RenderHelper::isVerticalTab(const QTabBar::Shape &shape)
diff --git a/style/src/style.cpp b/style/src/style.cpp
index 01ca5e8..a2c4f12 100644
--- a/style/src/style.cpp
+++ b/style/src/style.cpp
@@ -564,6 +564,38 @@ void Style::drawControl(QStyle::ControlElement element, const QStyleOption *opti
painter->restore();
}
+void Style::polishScrollArea(QAbstractScrollArea* scrollArea)
+{
+ if (!scrollArea)
+ return;
+
+ // enable mouse over effect in sunken scrollareas that support focus
+ if (scrollArea->frameShadow() == QFrame::Sunken && scrollArea->focusPolicy() & Qt::StrongFocus) {
+ scrollArea->setAttribute(Qt::WA_Hover);
+ }
+
+ // disable autofill background for flat (== NoFrame) scrollareas, with QPalette::Window as a background
+ // this fixes flat scrollareas placed in a tinted widget, such as groupboxes, tabwidgets or framed dock-widgets
+ if (!(scrollArea->frameShape() == QFrame::NoFrame || scrollArea->backgroundRole() == QPalette::Window)) {
+ return;
+ }
+
+ // get viewport and check background role
+ QWidget *viewport(scrollArea->viewport());
+ if (!(viewport && viewport->backgroundRole() == QPalette::Window))
+ return;
+
+ // change viewport autoFill background.
+ // do the same for all children if the background role is QPalette::Window
+ viewport->setAutoFillBackground(false);
+ QList<QWidget *> children(viewport->findChildren<QWidget *>());
+ foreach (QWidget *child, children) {
+ if (child->parent() == viewport && child->backgroundRole() == QPalette::Window) {
+ child->setAutoFillBackground(false);
+ }
+ }
+}
+
void Style::polish(QWidget *widget)
{
if (!widget)
@@ -588,18 +620,8 @@ void Style::polish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover);
}
- if (qobject_cast<QAbstractScrollArea *>(widget))
- {
- auto scrollArea = qobject_cast<QAbstractScrollArea *>(widget);
- if (scrollArea->frameShadow() == QFrame::Sunken && scrollArea->focusPolicy() & Qt::StrongFocus)
- {
- scrollArea->setAttribute(Qt::WA_Hover);
- }
- // scrollArea->viewport()->setAutoFillBackground(false);
- // qInfo() << "viewport:" << scrollArea->viewport()->geometry();
- // qInfo() << "scroll area:" << scrollArea->geometry();
- }
-
+ polishScrollArea(qobject_cast<QAbstractScrollArea *>(widget));
+
if (QAbstractItemView *itemView = qobject_cast<QAbstractItemView *>(widget))
{
// enable mouse over effects in itemviews' viewport
diff --git a/style/src/style.h b/style/src/style.h
index aa454ea..7b3212c 100644
--- a/style/src/style.h
+++ b/style/src/style.h
@@ -27,6 +27,7 @@
#define ParentStyle QCommonStyle
#endif
+class QAbstractScrollArea;
class Style : public ParentStyle
{
public:
@@ -47,6 +48,7 @@ public:
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption* opt, const QWidget* widget) const override;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption* option, const QWidget* widget) const override;
+ void polishScrollArea(QAbstractScrollArea* scrollArea);
void polish(QWidget* widget) override;
void polish(QApplication* app) override;
void polish(QPalette& pal) override;
--
2.33.0

View File

@ -1,196 +0,0 @@
From 958fbdc5c0f94114485fccb8da34a0b5a6c73a05 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Mon, 11 Jul 2022 14:37:54 +0800
Subject: [PATCH 2/2] feat(style): new file interface that can disable Kiran
Style for specified applications
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增能针对指定应用禁用kiran-style的文件接口
---
common/CMakeLists.txt | 10 ++++-
common/data/kiran-qt5-integration.ini | 2 +
common/src/kiran-integration-settings.cpp | 45 +++++++++++++++++++++++
common/src/kiran-integration-settings.h | 19 ++++++++++
platformtheme/kiran-theme.cpp | 7 ++++
style/src/kiran-style-plugin.cpp | 9 ++---
6 files changed, 85 insertions(+), 7 deletions(-)
create mode 100644 common/data/kiran-qt5-integration.ini
create mode 100644 common/src/kiran-integration-settings.cpp
create mode 100644 common/src/kiran-integration-settings.h
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 1ee647d..db8b5ad 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -6,6 +6,7 @@ find_package(KiranDBusGenerate REQUIRED)
pkg_search_module(KIRAN_CC_DAEMON REQUIRED kiran-cc-daemon)
pkg_search_module(KLOG_QT5 REQUIRED klog-qt5)
+pkg_search_module(GSETTINGS_QT REQUIRED gsettings-qt)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@@ -38,12 +39,17 @@ add_library(${TARGET_NAME} STATIC ${ALL_FILES})
target_link_libraries(${TARGET_NAME}
Qt5::Gui
Qt5::DBus
- ${QGSETTINGS_LIBRARIES})
+ ${QGSETTINGS_LIBRARIES}
+ ${GSETTINGS_QT_LIBRARIES})
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${QGSETTINGS_INCLUDE_DIRS}
- ${KIRAN_CC_DAEMON_INCLUDE_DIRS})
+ ${KIRAN_CC_DAEMON_INCLUDE_DIRS}
+ ${GSETTINGS_QT_INCLUDE_DIRS})
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+install(FILES data/kiran-qt5-integration.ini
+ DESTINATION /${CMAKE_INSTALL_SYSCONFDIR}/kiran-qt5-integration/ )
\ No newline at end of file
diff --git a/common/data/kiran-qt5-integration.ini b/common/data/kiran-qt5-integration.ini
new file mode 100644
index 0000000..478b608
--- /dev/null
+++ b/common/data/kiran-qt5-integration.ini
@@ -0,0 +1,2 @@
+#[Style]
+#disable-kiran-style-apps=Do not load kiranstyle applications, eg: assistant-qt5,qdbusviewer
\ No newline at end of file
diff --git a/common/src/kiran-integration-settings.cpp b/common/src/kiran-integration-settings.cpp
new file mode 100644
index 0000000..7726fad
--- /dev/null
+++ b/common/src/kiran-integration-settings.cpp
@@ -0,0 +1,45 @@
+#include "kiran-integration-settings.h"
+
+#include <QMutex>
+#include <QMutexLocker>
+#include <QScopedPointer>
+#include <QSettings>
+
+KiranIntegrationSettings::KiranIntegrationSettings()
+{
+ init();
+}
+
+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);
+}
+
+KiranIntegrationSettings* KiranIntegrationSettings::instance()
+{
+ static QMutex mutex;
+ static QScopedPointer<KiranIntegrationSettings> pInst;
+
+ if (Q_UNLIKELY(!pInst))
+ {
+ QMutexLocker locker(&mutex);
+ if (pInst.isNull())
+ {
+ pInst.reset(new KiranIntegrationSettings);
+ }
+ }
+
+ return pInst.data();
+}
+
+QStringList KiranIntegrationSettings::getDisableKiranStyleApps()
+{
+ return m_disableKiranStyleApps;
+}
diff --git a/common/src/kiran-integration-settings.h b/common/src/kiran-integration-settings.h
new file mode 100644
index 0000000..e43c1b6
--- /dev/null
+++ b/common/src/kiran-integration-settings.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <QStringList>
+
+class KiranIntegrationSettings
+{
+public:
+ static KiranIntegrationSettings* instance();
+ ~KiranIntegrationSettings();
+
+ QStringList getDisableKiranStyleApps();
+
+private:
+ KiranIntegrationSettings();
+ void init();
+
+private:
+ QStringList m_disableKiranStyleApps = {"lightdm-kiran-greeter","kiran-screensaver"};
+};
\ No newline at end of file
diff --git a/platformtheme/kiran-theme.cpp b/platformtheme/kiran-theme.cpp
index 4636030..1955fc4 100644
--- a/platformtheme/kiran-theme.cpp
+++ b/platformtheme/kiran-theme.cpp
@@ -15,6 +15,7 @@
#include "kiran-theme.h"
#include "kiran-appearance-monitor.h"
#include "logging-category.h"
+#include "kiran-integration-settings.h"
#include <private/qguiapplication_p.h>
#include <private/qiconloader_p.h>
@@ -99,6 +100,12 @@ const QPalette* KiranTheme::palette(QPlatformTheme::Palette type) const
return QGenericUnixTheme::palette(type);
}
+ QStringList blackapps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
+ if( blackapps.contains(qAppName()) )
+ {
+ return QGenericUnixTheme::palette(type);
+ }
+
static QPalette kiranThemePalette;
StylePalette::instance()->polishPalette(&kiranThemePalette);
return &kiranThemePalette;
diff --git a/style/src/kiran-style-plugin.cpp b/style/src/kiran-style-plugin.cpp
index bb3df1f..ee5f33e 100644
--- a/style/src/kiran-style-plugin.cpp
+++ b/style/src/kiran-style-plugin.cpp
@@ -13,6 +13,7 @@
*/
#include "kiran-style-plugin.h"
#include "style.h"
+#include "kiran-integration-settings.h"
#include <QCoreApplication>
#include <QDebug>
@@ -25,11 +26,9 @@ KiranStylePlugin::KiranStylePlugin(QObject *parent) : QStylePlugin(parent)
QStyle *KiranStylePlugin::create(const QString & key)
{
- QList<QString> blackApps = {
- "kiran-screensaver",
- "lightdm-kiran-greeter"
- };
- if( blackApps.contains(qAppName()) )
+ QStringList disableApps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
+ QString processName = qAppName();
+ if( disableApps.contains(processName) )
{
return QStyleFactory::create("fusion");
}
--
2.33.0

View File

@ -1,66 +0,0 @@
From d3cb409336c622b078b3c03ef6266775b5717346 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Mon, 8 Aug 2022 17:02:11 +0800
Subject: [PATCH 2/2] refactor(log): update log output when creating theme and
style plug-ins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 更新创建主题和风格插件时的日志输出
---
platformtheme/kiran-theme-plugin.cpp | 2 +-
style/src/kiran-style-plugin.cpp | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/platformtheme/kiran-theme-plugin.cpp b/platformtheme/kiran-theme-plugin.cpp
index 20c0198..961b7b3 100644
--- a/platformtheme/kiran-theme-plugin.cpp
+++ b/platformtheme/kiran-theme-plugin.cpp
@@ -23,7 +23,7 @@ QPlatformTheme* KiranThemePlugin::create(const QString& key, const QStringList&
if(keySet.contains(key))
{
- qDebug(kiranPlatformTheme) << "create kiran style for" << QCoreApplication::applicationName();
+ qDebug(kiranPlatformTheme) << "create kiran platformtheme for" << QCoreApplication::applicationName();
return new KiranTheme(paramList);
}
diff --git a/style/src/kiran-style-plugin.cpp b/style/src/kiran-style-plugin.cpp
index ee5f33e..aefbabc 100644
--- a/style/src/kiran-style-plugin.cpp
+++ b/style/src/kiran-style-plugin.cpp
@@ -26,18 +26,20 @@ KiranStylePlugin::KiranStylePlugin(QObject *parent) : QStylePlugin(parent)
QStyle *KiranStylePlugin::create(const QString & key)
{
- QStringList disableApps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
- QString processName = qAppName();
- if( disableApps.contains(processName) )
- {
- return QStyleFactory::create("fusion");
- }
-
- qDebug("create style:%s",key.toStdString().c_str());
if( key.compare("kiran",Qt::CaseInsensitive) == 0 )
{
- return new Style();
+ QStringList disableApps = KiranIntegrationSettings::instance()->getDisableKiranStyleApps();
+ QString processName = qAppName();
+ if( disableApps.contains(processName) )
+ {
+ qDebug("%s in black list,create fusion style for it.",processName.toStdString().c_str());
+ return QStyleFactory::create("fusion");
+ }
+ else
+ {
+ qDebug("create style:%s",key.toStdString().c_str());
+ return new Style();
+ }
}
-
return nullptr;
}
--
2.33.0

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +1,11 @@
Name: kiran-qt5-integration
Version: 2.3.0
Release: 4
Version: 2.4.0
Release: 1
Summary: Kiran desktop platform integration plugin.
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-refactor-log-Reduce-some-log-output-levels.patch
Patch0002: 0002-feat-style-new-file-interface-that-can-disable-Kiran.patch
Patch0003: 0001-feat-style-add-window-hover-color.patch
Patch0004: 0001-refactor-style-update-painting-effect-of-the-scrolli.patch
Patch0005: 0002-refactor-log-update-log-output-when-creating-theme-a.patch
BuildRequires: cmake >= 3.2
BuildRequires: gcc-c++
BuildRequires: pkgconf
@ -66,6 +60,9 @@ make %{?_smp_mflags}
%{_libdir}/pkgconfig/kiran-style-helper.pc
%changelog
* Mon Oct 31 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.4.0-1
- KYOS-F: Modify the color table and add new color types, and support the 2.4 color block design of the control center
* Tue Aug 09 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.3.0-4
- KYOS-B: update painting effect of the scrolling area
- KYOS-F: update log output when creating theme and style plug-ins

View File

@ -0,0 +1,4 @@
version_control: gitee
src_repo: https://gitee.com/openeuler/kiran-qt5-integration.git
tag_prefix: "v"
seperator: "."