diff --git a/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch b/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch deleted file mode 100644 index da23be021bf62d882e2bc808eb01465c474469ed..0000000000000000000000000000000000000000 --- a/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b4a50383201b332bc13c90033f1d9821b2e0e0f7 Mon Sep 17 00:00:00 2001 -From: liuxinhao -Date: Fri, 7 Apr 2023 09:27:04 +0800 -Subject: [PATCH 2/2] 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::of(&QSignalMapper::mapped), this, &FontSizeManagerPrivate::handleBindWidgetDestroyed); -+#endif - } - - void updateWidgetFont() --- -2.33.0 - diff --git a/0014-fix-style-replace-ParentStyle-with-QProxyStyle-and-a.patch b/0014-fix-style-replace-ParentStyle-with-QProxyStyle-and-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..482bde1ac9c02412e4ce90980c11f4c94566b980 --- /dev/null +++ b/0014-fix-style-replace-ParentStyle-with-QProxyStyle-and-a.patch @@ -0,0 +1,194 @@ +From 59eb5fb199d7ab8f729f6784a958b4f6c11afae2 Mon Sep 17 00:00:00 2001 +From: youzhengcai +Date: Mon, 25 Mar 2024 20:09:15 +0800 +Subject: [PATCH 14/16] fix(style): replace ParentStyle with QProxyStyle and + adapt to QT5.9.7 version +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 将原 ParentStyle 替换为 QProxyStyle,以适配 Qt5.9.7 (Qt5.9.7中未导出 QFusionStyle) + +Fixed #32257 +--- + style/src/draw-helper/draw-slider-helper.cpp | 2 +- + style/src/style.cpp | 29 ++++++++++---------- + style/src/style.h | 11 ++------ + 3 files changed, 18 insertions(+), 24 deletions(-) + +diff --git a/style/src/draw-helper/draw-slider-helper.cpp b/style/src/draw-helper/draw-slider-helper.cpp +index 5aad6ec..7908f73 100644 +--- a/style/src/draw-helper/draw-slider-helper.cpp ++++ b/style/src/draw-helper/draw-slider-helper.cpp +@@ -299,7 +299,7 @@ bool sliderSubControlRect(const QStyle *style, const QStyleOptionComplex *opt, Q + + // get base class rect + // NOTE:该处直接调用父类的方法 +- QRect grooveRect = qobject_cast(style)->ParentStyle::subControlRect(QStyle::CC_Slider, opt, sc, widget); ++ QRect grooveRect = qobject_cast(style)->QProxyStyle::subControlRect(QStyle::CC_Slider, opt, sc, widget); + grooveRect = RenderHelper::insideMargin(grooveRect, style->pixelMetric(QStyle::PM_DefaultFrameWidth, opt, widget)); + + // centering +diff --git a/style/src/style.cpp b/style/src/style.cpp +index 2161c65..6fba993 100644 +--- a/style/src/style.cpp ++++ b/style/src/style.cpp +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + // TODO: 后期考虑再度整合到几个大类的源文件之中 + #include "draw-helper/draw-button-helper.h" +@@ -66,7 +67,7 @@ using namespace Kiran; + + // FIXME:由于kiran-widgets-qt5之前包含的Kiran::Style重名导致现在暂时不能加入Kiran命名控件,否则将引起崩溃 + Style::Style() +- : ParentStyle() ++ : QProxyStyle(QStyleFactory::create("fusion")) + { + } + +@@ -160,7 +161,7 @@ int Style::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const Q + case SH_Table_GridLineColor: + return StylePalette::instance()->color(StylePalette::Normal, StylePalette::Widget, StylePalette::Border).rgb(); + default: +- return ParentStyle::styleHint(hint, option, widget, returnData); ++ return QProxyStyle::styleHint(hint, option, widget, returnData); + } + } + +@@ -320,7 +321,7 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + default: // fallback + break; + } +- return ParentStyle::pixelMetric(metric, option, widget); ++ return QProxyStyle::pixelMetric(metric, option, widget); + } + + void Style::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +@@ -382,7 +383,7 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption * + PainterSaver painterSaver(painter); + if (!(func && (*func)(this, option, painter, widget))) + { +- ParentStyle::drawPrimitive(element, option, painter, widget); ++ QProxyStyle::drawPrimitive(element, option, painter, widget); + } + } + +@@ -410,7 +411,7 @@ void Style::drawComplexControl(QStyle::ComplexControl control, + painter->save(); + if (!(func && (*func)(this, option, painter, widget))) + { +- ParentStyle::drawComplexControl(control, option, painter, widget); ++ QProxyStyle::drawComplexControl(control, option, painter, widget); + } + painter->restore(); + } +@@ -445,7 +446,7 @@ QRect Style::subElementRect(QStyle::SubElement element, const QStyleOption *opti + break; + } + +- return ParentStyle::subElementRect(element, option, widget); ++ return QProxyStyle::subElementRect(element, option, widget); + } + + QRect Style::subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget) const +@@ -467,7 +468,7 @@ QRect Style::subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex + } + else + { +- return ParentStyle::subControlRect(cc, opt, sc, widget); ++ return QProxyStyle::subControlRect(cc, opt, sc, widget); + } + } + +@@ -526,7 +527,7 @@ QSize Style::sizeFromContents(QStyle::ContentsType type, const QStyleOption *opt + default: + break; + } +- return ParentStyle::sizeFromContents(type, option, contentSize, widget); ++ return QProxyStyle::sizeFromContents(type, option, contentSize, widget); + } + + void Style::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +@@ -571,7 +572,7 @@ void Style::drawControl(QStyle::ControlElement element, const QStyleOption *opti + { + if (emptyControlSet.find(element) == emptyControlSet.end()) + { +- ParentStyle::drawControl(element, option, painter, widget); ++ QProxyStyle::drawControl(element, option, painter, widget); + } + } + painter->restore(); +@@ -645,12 +646,12 @@ void Style::polish(QWidget *widget) + itemView->viewport()->setAttribute(Qt::WA_Hover); + } + +- ParentStyle::polish(widget); ++ QProxyStyle::polish(widget); + } + + void Style::polish(QApplication *app) + { +- ParentStyle::polish(app); ++ QProxyStyle::polish(app); + + QPalette palette; + StylePalette::instance()->polishPalette(&palette); +@@ -659,7 +660,7 @@ void Style::polish(QApplication *app) + + void Style::polish(QPalette &palette) + { +- // ParentStyle::polish(palette); ++ // QProxyStyle::polish(palette); + StylePalette::instance()->polishPalette(&palette); + } + +@@ -683,7 +684,7 @@ QPixmap Style::standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyl + default: + break; + } +- return ParentStyle::standardPixmap(standardPixmap, opt, widget); ++ return QProxyStyle::standardPixmap(standardPixmap, opt, widget); + } + + QIcon Style::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const +@@ -719,5 +720,5 @@ QIcon Style::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOptio + default: + break; + } +- return ParentStyle::standardIcon(standardIcon, option, widget); ++ return QProxyStyle::standardIcon(standardIcon, option, widget); + } +\ No newline at end of file +diff --git a/style/src/style.h b/style/src/style.h +index 7b3212c..19a5bfd 100644 +--- a/style/src/style.h ++++ b/style/src/style.h +@@ -16,19 +16,12 @@ + #define KIRAN_QT5_PLATFORMTHEME_STYLE_KIRAN_STYLE_H_ + + #include ++#include + + #include "draw-helper/draw-common-helper.h" + +-#if 1 +-#include +-#define ParentStyle QFusionStyle +-#else +-#include +-#define ParentStyle QCommonStyle +-#endif +- + class QAbstractScrollArea; +-class Style : public ParentStyle ++class Style : public QProxyStyle + { + public: + explicit Style(); +-- +2.27.0 + diff --git a/0015-fix-fix-theme-support-custom-library-name.patch b/0015-fix-fix-theme-support-custom-library-name.patch new file mode 100644 index 0000000000000000000000000000000000000000..667395ebd22db89a4300d7718bd822d353becd84 --- /dev/null +++ b/0015-fix-fix-theme-support-custom-library-name.patch @@ -0,0 +1,30 @@ +From ccb979e48e8336bff244f2c92be75cef6d793792 Mon Sep 17 00:00:00 2001 +From: yangfeng +Date: Wed, 17 Apr 2024 20:42:44 +0800 +Subject: [PATCH 15/16] fix(*):fix theme support custom library name +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复主题支持自定义库名 + +Fixed #35086 +--- + cmake/modules/FindQt5ThemeSupport.cmake | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cmake/modules/FindQt5ThemeSupport.cmake b/cmake/modules/FindQt5ThemeSupport.cmake +index d5c1753..2c47cd2 100644 +--- a/cmake/modules/FindQt5ThemeSupport.cmake ++++ b/cmake/modules/FindQt5ThemeSupport.cmake +@@ -16,6 +16,7 @@ find_path(Qt5ThemeSupport_INCLUDE_DIR + # 拼出Qt5ThemeSupport静态库位置 + find_library(Qt5ThemeSupport_LIBRARY + NAMES ++ Qt5ThemeSupportKS + Qt5ThemeSupport + HINTS + ${PKG_Qt5ThemeSupport_LIBRARY_DIRS} +-- +2.27.0 + diff --git a/0016-fix-css-generate-Adapting-to-lower-version-Qt-themes.patch b/0016-fix-css-generate-Adapting-to-lower-version-Qt-themes.patch new file mode 100644 index 0000000000000000000000000000000000000000..21187720d267e94397bd4f277db9b37443133955 --- /dev/null +++ b/0016-fix-css-generate-Adapting-to-lower-version-Qt-themes.patch @@ -0,0 +1,96 @@ +From 60b049b233e0695b3d259b0da7aca3a899a544ce Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Mon, 13 May 2024 19:59:27 +0800 +Subject: [PATCH 16/16] fix(css generate): Adapting to lower version Qt themes, + autorcc not correctly associating dependencies +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 适配低版本Qt css生成,autorcc未正确关联依赖 +--- + CMakeLists.txt | 5 +++++ + style-helper/CMakeLists.txt | 12 +++++------- + style/CMakeLists.txt | 7 +------ + 3 files changed, 11 insertions(+), 13 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3b7eafc..b18b0f5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,6 +9,11 @@ list(APPEND ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules/) + include(GNUInstallDirs) + include(Qt5PluginInstallDirs) + ++find_package(Qt5 COMPONENTS Core Gui Widgets Svg DBus) ++set(CMAKE_AUTOMOC ON) ++set(CMAKE_AUTOUIC ON) ++set(CMAKE_AUTORCC ON) ++ + #共用代码,生成静态库 + add_subdirectory(common) + #QPlatformTheme插件 +diff --git a/style-helper/CMakeLists.txt b/style-helper/CMakeLists.txt +index 004222a..20b6a0b 100644 +--- a/style-helper/CMakeLists.txt ++++ b/style-helper/CMakeLists.txt +@@ -27,21 +27,19 @@ add_custom_command( + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + ++# 生成资源文件 + set(KIRANSTYLE_HELPER_QRC ${CMAKE_CURRENT_BINARY_DIR}/kiranstyle-helper.qrc) + configure_file(kiranstyle-helper.qrc.in ${KIRANSTYLE_HELPER_QRC}) ++# 手动添加resources,避免低版本Qt上AUTORCC未扫描到资源文件并关联上依赖关系 ++qt5_add_resources(KIRANSTYLE_HELPER_QRC_SOURCE ${KIRANSTYLE_HELPER_QRC}) + +-message("${CMAKE_CURRENT_SOURCE_DIR}") +-find_package(Qt5 COMPONENTS Core Gui Widgets) + file(GLOB_RECURSE SRC "src/*.cpp" "src/*.h" "src/*.ui") + file(GLOB_RECURSE INCLUDE "include/*.h") + +-set(CMAKE_AUTOMOC ON) +-set(CMAKE_AUTOUIC ON) +-set(CMAKE_AUTORCC ON) +- + add_library(${TARGET_NAME} SHARED + ${SRC} + ${KIRANSTYLE_HELPER_QRC} ++ ${KIRANSTYLE_HELPER_QRC_SOURCE} + ${INCLUDE} + ${KIRAN_DARK_COLORS} + ${KIRAN_LIGHT_COLORS}) +@@ -72,4 +70,4 @@ install(FILES ${INCLUDE} DESTINATION ${KIRAN_STYLE_HELPER_INCLUDE_DIR}) + + configure_file(kiran-style-helper.pc.in kiran-style-helper.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kiran-style-helper.pc +- DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/) +\ No newline at end of file ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/) +diff --git a/style/CMakeLists.txt b/style/CMakeLists.txt +index 6cb6fa6..f4f888a 100644 +--- a/style/CMakeLists.txt ++++ b/style/CMakeLists.txt +@@ -1,12 +1,7 @@ + set(TARGET_NAME "kiranstyle") + +-find_package(Qt5 COMPONENTS Widgets Svg DBus) + file(GLOB_RECURSE SRC "src/*.cpp" "src/*.h" "src/*.ui") + +-set(CMAKE_AUTOMOC ON) +-set(CMAKE_AUTOUIC ON) +-set(CMAKE_AUTORCC ON) +- + add_library( ${TARGET_NAME} SHARED + ${SRC} ) + +@@ -27,4 +22,4 @@ target_link_libraries(${TARGET_NAME} + Qt5::Svg) + + #kiran style 插件 +-install(TARGETS ${TARGET_NAME} DESTINATION ${QT5_STYLE_INSTALL_DIR}) +\ No newline at end of file ++install(TARGETS ${TARGET_NAME} DESTINATION ${QT5_STYLE_INSTALL_DIR}) +-- +2.27.0 + diff --git a/0017-fix-appearance-Fix-theme-error-when-session-dbus-ser.patch b/0017-fix-appearance-Fix-theme-error-when-session-dbus-ser.patch new file mode 100644 index 0000000000000000000000000000000000000000..93f54a13c68f905a8578938220834652a443c477 --- /dev/null +++ b/0017-fix-appearance-Fix-theme-error-when-session-dbus-ser.patch @@ -0,0 +1,362 @@ +From ea864077919ba34c120c6ce47c421f730821e60d Mon Sep 17 00:00:00 2001 +From: yangfeng +Date: Fri, 12 Jul 2024 10:15:51 +0800 +Subject: [PATCH] fix(appearance):Fix theme error when session dbus service is + not registered +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复会话dbus服务没注册时主题出错 + +Related: #35760 +--- + common/src/kiran-appearance-monitor.cpp | 198 ++++++++++++++---------- + common/src/kiran-appearance-monitor.h | 19 ++- + 2 files changed, 130 insertions(+), 87 deletions(-) + +diff --git a/common/src/kiran-appearance-monitor.cpp b/common/src/kiran-appearance-monitor.cpp +index b279d55..749da7a 100644 +--- a/common/src/kiran-appearance-monitor.cpp ++++ b/common/src/kiran-appearance-monitor.cpp +@@ -19,109 +19,66 @@ + + #include + ++#include + #include + #include + ++#define APPEARANCE_DBUS_NAME "com.kylinsec.Kiran.SessionDaemon.Appearance" ++#define APPEARANCE_DBUS_OBJECT_PATH "/com/kylinsec/Kiran/SessionDaemon/Appearance" ++ ++#define DISPLAY_DBUS_NAME "com.kylinsec.Kiran.SessionDaemon.Display" ++#define DISPLAY_DBUS_OBJECT_PATH "/com/kylinsec/Kiran/SessionDaemon/Display" ++ + KiranAppearanceMonitor::KiranAppearanceMonitor(QObject *parent) +- : QObject(parent) ++ : QObject(parent), ++ m_appearanceServiceWatcher(nullptr), ++ m_displayServiceWatcher(nullptr) + { +- m_appearanceIface = new KiranAppearanceProxy("com.kylinsec.Kiran.SessionDaemon.Appearance", +- "/com/kylinsec/Kiran/SessionDaemon/Appearance", ++ m_polishCursorTimer.setInterval(500); ++ m_polishCursorTimer.setSingleShot(true); ++ connect(&m_polishCursorTimer, &QTimer::timeout, this, &KiranAppearanceMonitor::handleCursorThemeChanged); ++ ++ m_appearanceIface = new KiranAppearanceProxy(APPEARANCE_DBUS_NAME, ++ APPEARANCE_DBUS_OBJECT_PATH, + QDBusConnection::sessionBus(), + this); + +- if (QDBusConnection::sessionBus().interface()->isServiceRegistered("com.kylinsec.Kiran.SessionDaemon.Appearance")) ++ if (QDBusConnection::sessionBus().interface()->isServiceRegistered(APPEARANCE_DBUS_NAME)) + { +- //application font +- QString tempFontName; +- int tempFontSize; +- QString fontValue = m_appearanceIface->GetFont(APPEARANCE_FONT_TYPE_APPLICATION); +- if (parseFontValue(fontValue, tempFontName, tempFontSize)) +- { +- m_appFontName = tempFontName; +- m_appFontSize = tempFontSize; +- qDebug(kiranPlatformThemeCommon,"application font: %s %d",m_appFontName.toStdString().c_str(),m_appFontSize); +- } +- else +- { +- qWarning(kiranPlatformThemeCommon) << "appearance monitor: parse application font failed!"; +- } +- +- //window titlebar font +- fontValue = m_appearanceIface->GetFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE); +- if(parseFontValue(fontValue,tempFontName,tempFontSize)) +- { +- m_titleBarFontName = tempFontName; +- m_titleBarFontSize = tempFontSize; +- qDebug(kiranPlatformThemeCommon,"title bar font: %s %d",m_titleBarFontName.toStdString().c_str(),m_titleBarFontSize); +- } +- else +- { +- qDebug(kiranPlatformThemeCommon) << "parse titlebar font failed!"; +- } +- +- //icon theme +- auto themeReply = m_appearanceIface->GetTheme(APPEARANCE_THEME_TYPE_ICON); +- themeReply.waitForFinished(); +- if( !themeReply.isError() ) +- { +- m_iconTheme = themeReply.value(); +- qDebug(kiranPlatformThemeCommon,"icon theme: %s",m_iconTheme.toStdString().c_str()); +- } +- else +- { +- qDebug(kiranPlatformThemeCommon) << "get icon theme failed," << themeReply.error(); +- } +- +- //gtk theme +- themeReply = m_appearanceIface->GetTheme(APPEARANCE_THEME_TYPE_GTK); +- themeReply.waitForFinished(); +- if( !themeReply.isError() ) +- { +- QString gtkThemeName = themeReply.value(); +- +- if( gtkThemeName.contains("dark",Qt::CaseInsensitive) ) +- m_gtkThemeName = "kiran-dark"; +- else +- m_gtkThemeName = "kiran"; +- +- qDebug(kiranPlatformThemeCommon,"gtk theme: %s",m_gtkThemeName.toStdString().c_str()); +- } +- else +- { +- qDebug(kiranPlatformThemeCommon) << "get gtk theme failed," << themeReply.error(); +- } ++ loadAppearance(); + } + else + { +- qDebug(kiranPlatformThemeCommon) << "kiran session daemon appearance service isn't registered!"; ++ m_appearanceServiceWatcher = new QDBusServiceWatcher(APPEARANCE_DBUS_NAME, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); ++ connect(m_appearanceServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &KiranAppearanceMonitor::loadAppearance); ++ ++ qDebug(kiranPlatformThemeCommon) ++ << "kiran session daemon appearance service isn't registered!"; + } + + connect(m_appearanceIface, &KiranAppearanceProxy::FontChanged, + this, &KiranAppearanceMonitor::handleFontSettingChanged); +- connect(m_appearanceIface,&KiranAppearanceProxy::ThemeChanged, +- this,&KiranAppearanceMonitor::handleThemeSettingChanged); +- ++ connect(m_appearanceIface, &KiranAppearanceProxy::ThemeChanged, ++ this, &KiranAppearanceMonitor::handleThemeSettingChanged); + +- m_displayIface = new KiranDisplayProxy("com.kylinsec.Kiran.SessionDaemon.Display", +- "/com/kylinsec/Kiran/SessionDaemon/Display", ++ m_displayIface = new KiranDisplayProxy(DISPLAY_DBUS_NAME, ++ DISPLAY_DBUS_OBJECT_PATH, + QDBusConnection::sessionBus(), + this); +- if (QDBusConnection::sessionBus().interface()->isServiceRegistered("com.kylinsec.Kiran.SessionDaemon.Display")) ++ if (QDBusConnection::sessionBus().interface()->isServiceRegistered(DISPLAY_DBUS_NAME)) + { +- m_scaleFactor = m_displayIface->window_scaling_factor(); ++ loadScalingFactor(); + } + else + { ++ m_displayServiceWatcher = new QDBusServiceWatcher(DISPLAY_DBUS_NAME, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); ++ connect(m_displayServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &KiranAppearanceMonitor::loadScalingFactor); ++ + qDebug(kiranPlatformThemeCommon) << "kiran session daemon display service isn't registered!"; + } + + connect(m_displayIface, &KiranDisplayProxy::window_scaling_factorChanged, + this, &KiranAppearanceMonitor::handleWindowScaleFactorChanged); +- m_polishCursorTimer.setInterval(500); +- m_polishCursorTimer.setSingleShot(true); +- +- connect(&m_polishCursorTimer,&QTimer::timeout,this,&KiranAppearanceMonitor::handleCursorThemeChanged); + } + + KiranAppearanceMonitor *KiranAppearanceMonitor::instance() +@@ -143,7 +100,6 @@ KiranAppearanceMonitor *KiranAppearanceMonitor::instance() + + KiranAppearanceMonitor::~KiranAppearanceMonitor() + { +- + } + + void KiranAppearanceMonitor::handleFontSettingChanged(int type, const QString &fontValue) +@@ -199,7 +155,7 @@ bool KiranAppearanceMonitor::parseFontValue(const QString &font, QString &fontNa + } + + QFontDatabase fontDatabase; +- if( !fontDatabase.hasFamily(fontName) ) ++ if (!fontDatabase.hasFamily(fontName)) + { + qDebug(kiranPlatformThemeCommon) << "font data base don't has this font:" << fontName; + return false; +@@ -208,6 +164,84 @@ bool KiranAppearanceMonitor::parseFontValue(const QString &font, QString &fontNa + return true; + } + ++void KiranAppearanceMonitor::loadAppearance() ++{ ++ // application font ++ QString tempFontName; ++ int tempFontSize; ++ QString fontValue = m_appearanceIface->GetFont(APPEARANCE_FONT_TYPE_APPLICATION); ++ if (parseFontValue(fontValue, tempFontName, tempFontSize)) ++ { ++ m_appFontName = tempFontName; ++ m_appFontSize = tempFontSize; ++ qDebug(kiranPlatformThemeCommon, "application font: %s %d", m_appFontName.toStdString().c_str(), m_appFontSize); ++ ++ emit appFontChanged(appFont()); ++ } ++ else ++ { ++ qWarning(kiranPlatformThemeCommon) << "appearance monitor: parse application font failed!"; ++ } ++ ++ // window titlebar font ++ fontValue = m_appearanceIface->GetFont(APPEARANCE_FONT_TYPE_WINDOW_TITLE); ++ if (parseFontValue(fontValue, tempFontName, tempFontSize)) ++ { ++ m_titleBarFontName = tempFontName; ++ m_titleBarFontSize = tempFontSize; ++ qDebug(kiranPlatformThemeCommon, "title bar font: %s %d", m_titleBarFontName.toStdString().c_str(), m_titleBarFontSize); ++ ++ emit titleBarFontChanged(titleBarFont()); ++ } ++ else ++ { ++ qDebug(kiranPlatformThemeCommon) << "parse titlebar font failed!"; ++ } ++ ++ // icon theme ++ auto themeReply = m_appearanceIface->GetTheme(APPEARANCE_THEME_TYPE_ICON); ++ themeReply.waitForFinished(); ++ if (!themeReply.isError()) ++ { ++ m_iconTheme = themeReply.value(); ++ qDebug(kiranPlatformThemeCommon, "icon theme: %s", m_iconTheme.toStdString().c_str()); ++ ++ emit iconThemeChanged(m_iconTheme); ++ } ++ else ++ { ++ qDebug(kiranPlatformThemeCommon) << "get icon theme failed," << themeReply.error(); ++ } ++ ++ // gtk theme ++ themeReply = m_appearanceIface->GetTheme(APPEARANCE_THEME_TYPE_GTK); ++ themeReply.waitForFinished(); ++ if (!themeReply.isError()) ++ { ++ QString gtkThemeName = themeReply.value(); ++ ++ if (gtkThemeName.contains("dark", Qt::CaseInsensitive)) ++ m_gtkThemeName = "kiran-dark"; ++ else ++ m_gtkThemeName = "kiran"; ++ ++ qDebug(kiranPlatformThemeCommon, "gtk theme: %s", m_gtkThemeName.toStdString().c_str()); ++ ++ emit gtkThemeChanged(m_gtkThemeName); ++ } ++ else ++ { ++ qDebug(kiranPlatformThemeCommon) << "get gtk theme failed," << themeReply.error(); ++ } ++ ++ m_polishCursorTimer.start(); ++} ++ ++void KiranAppearanceMonitor::loadScalingFactor() ++{ ++ handleWindowScaleFactorChanged(m_displayIface->window_scaling_factor()); ++} ++ + QFont KiranAppearanceMonitor::appFont() const + { + QFont font = QFont(QString()); +@@ -236,16 +270,16 @@ QString KiranAppearanceMonitor::iconTheme() const + + void KiranAppearanceMonitor::handleThemeSettingChanged(int type, const QString &themeName) + { +- if(type == APPEARANCE_THEME_TYPE_ICON) ++ if (type == APPEARANCE_THEME_TYPE_ICON) + { + m_iconTheme = themeName; + emit iconThemeChanged(m_iconTheme); + } +- else if(type == APPEARANCE_THEME_TYPE_GTK) ++ else if (type == APPEARANCE_THEME_TYPE_GTK) + { + QString gtkTheme; + +- if( themeName.contains("dark",Qt::CaseInsensitive) ) ++ if (themeName.contains("dark", Qt::CaseInsensitive)) + { + gtkTheme = "kiran-dark"; + } +@@ -254,14 +288,14 @@ void KiranAppearanceMonitor::handleThemeSettingChanged(int type, const QString & + gtkTheme = "kiran"; + } + +- if(gtkTheme!=m_gtkThemeName) ++ if (gtkTheme != m_gtkThemeName) + { + qDebug(kiranPlatformThemeCommon) << "gtk theme changed:" << themeName; + m_gtkThemeName = gtkTheme; + emit gtkThemeChanged(m_gtkThemeName); + } + } +- else if(type==APPEARANCE_THEME_TYPE_CURSOR) ++ else if (type == APPEARANCE_THEME_TYPE_CURSOR) + { + // 延迟通知,让QXcbCursor更新主题 + // 若未变化光标,qt5.15之前都需要合入修复补丁 +diff --git a/common/src/kiran-appearance-monitor.h b/common/src/kiran-appearance-monitor.h +index 8d7033f..ba1d2b5 100644 +--- a/common/src/kiran-appearance-monitor.h ++++ b/common/src/kiran-appearance-monitor.h +@@ -13,17 +13,19 @@ + */ + #pragma once + +-#include + #include ++#include + #include + ++class QDBusServiceWatcher; + class KiranDisplayProxy; + class KiranAppearanceProxy; + class KiranAppearanceMonitor : public QObject + { + Q_OBJECT + private: +- explicit KiranAppearanceMonitor(QObject* parent= nullptr); ++ explicit KiranAppearanceMonitor(QObject* parent = nullptr); ++ + public: + static KiranAppearanceMonitor* instance(); + ~KiranAppearanceMonitor() override; +@@ -43,12 +45,15 @@ signals: + void cursorThemeChanged(); + + private: +- static bool parseFontValue(const QString& font,QString& fontName,int& fontSize); ++ static bool parseFontValue(const QString& font, QString& fontName, int& fontSize); ++ ++ void loadAppearance(); ++ void loadScalingFactor(); + + private slots: +- void handleFontSettingChanged(int type,const QString& fontValue); ++ void handleFontSettingChanged(int type, const QString& fontValue); + void handleWindowScaleFactorChanged(int scaleFactor); +- void handleThemeSettingChanged(int type,const QString& themeName); ++ void handleThemeSettingChanged(int type, const QString& themeName); + void handleCursorThemeChanged(); + + private: +@@ -64,6 +69,10 @@ private: + QString m_gtkThemeName = "kiran"; + + QTimer m_polishCursorTimer; ++ + KiranDisplayProxy* m_displayIface; ++ QDBusServiceWatcher* m_displayServiceWatcher; ++ + KiranAppearanceProxy* m_appearanceIface; ++ QDBusServiceWatcher* m_appearanceServiceWatcher; + }; +\ No newline at end of file +-- +2.27.0 + diff --git a/0018-fix-build-fix-build-error-in-qt5.9.2.patch b/0018-fix-build-fix-build-error-in-qt5.9.2.patch new file mode 100644 index 0000000000000000000000000000000000000000..05f555a18150d2724a8d22c6f5cd72e3ec3a0d52 --- /dev/null +++ b/0018-fix-build-fix-build-error-in-qt5.9.2.patch @@ -0,0 +1,33 @@ +From 408462531cdc45f8b9741d03beb1e25aeee7540e Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Fri, 23 Aug 2024 10:16:55 +0800 +Subject: [PATCH] fix(build): fix build error in qt5.9.2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复Qt5.9.2下的编译错误 + +Closes #45382 +--- + style-helper/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/style-helper/CMakeLists.txt b/style-helper/CMakeLists.txt +index 20b6a0b..2b67091 100644 +--- a/style-helper/CMakeLists.txt ++++ b/style-helper/CMakeLists.txt +@@ -32,6 +32,10 @@ set(KIRANSTYLE_HELPER_QRC ${CMAKE_CURRENT_BINARY_DIR}/kiranstyle-helper.qrc) + configure_file(kiranstyle-helper.qrc.in ${KIRANSTYLE_HELPER_QRC}) + # 手动添加resources,避免低版本Qt上AUTORCC未扫描到资源文件并关联上依赖关系 + qt5_add_resources(KIRANSTYLE_HELPER_QRC_SOURCE ${KIRANSTYLE_HELPER_QRC}) ++# qt5-qtbase-5.9.2下qt5_add_resources手动添加rcc,不会给qrc文件标记SKIP_AUTORCC ++if("${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}.${Qt5_VERSION_PATCH}" STREQUAL "5.9.2") ++ set_source_files_properties(${KIRANSTYLE_HELPER_QRC} PROPERTIES SKIP_AUTORCC ON) ++endif() + + file(GLOB_RECURSE SRC "src/*.cpp" "src/*.h" "src/*.ui") + file(GLOB_RECURSE INCLUDE "include/*.h") +-- +2.27.0 + diff --git a/0019-fix-QCompleter-Adjust-the-height-of-the-QCompleter-P.patch b/0019-fix-QCompleter-Adjust-the-height-of-the-QCompleter-P.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b61a5ce835fcd220ce0a119d0f257b8d770faa5 --- /dev/null +++ b/0019-fix-QCompleter-Adjust-the-height-of-the-QCompleter-P.patch @@ -0,0 +1,65 @@ +From 72166cc21f423f9c7a93f4773080dced6bfa8564 Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Tue, 24 Sep 2024 14:54:44 +0800 +Subject: [PATCH] fix(QCompleter): Adjust the height of the QCompleter Popup + pop-up +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 针对QCompleter Popup弹出的高度进行调整 + +Closes #42329 +--- + style/src/style.cpp | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/style/src/style.cpp b/style/src/style.cpp +index 6fba993..000fe11 100644 +--- a/style/src/style.cpp ++++ b/style/src/style.cpp +@@ -170,6 +170,8 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + switch (metric) + { + case PM_DefaultFrameWidth: ++ if (qobject_cast(widget)) ++ return 2; + return 6; + case PM_SpinBoxFrameWidth: + return 2; +@@ -182,7 +184,6 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + case PM_FocusFrameVMargin: + case PM_FocusFrameHMargin: + return 2; +- + // 布局默认边距 + case PM_LayoutLeftMargin: + case PM_LayoutTopMargin: +@@ -199,7 +200,7 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + return 6; + } + } +- ++ + // 布局默认间距 + case PM_LayoutHorizontalSpacing: + case PM_LayoutVerticalSpacing: +@@ -268,7 +269,6 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + case PM_TabCloseIndicatorWidth: + case PM_TabCloseIndicatorHeight: + return pixelMetric(PM_SmallIconSize, option, widget); +- + // scrollbars + case PM_ScrollBarExtent: + return 5; +@@ -317,7 +317,6 @@ int Style::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, c + return 1; + case PM_DockWidgetSeparatorExtent: + return 1; +- + default: // fallback + break; + } +-- +2.27.0 + diff --git a/0020-fix-style-Fix-the-failure-of-dynamic-theme-switching.patch b/0020-fix-style-Fix-the-failure-of-dynamic-theme-switching.patch new file mode 100644 index 0000000000000000000000000000000000000000..9e2b73a1de2aa878d254d1c8ec5a29ebe019773d --- /dev/null +++ b/0020-fix-style-Fix-the-failure-of-dynamic-theme-switching.patch @@ -0,0 +1,34 @@ +From c03e27fe1a775d30a61c1518fd93c22532e74dd4 Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Mon, 14 Oct 2024 20:40:31 +0800 +Subject: [PATCH] fix(style): Fix the failure of dynamic theme switching in low + version of Qt. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复由于Style Polish中再次更改app pal导致AA_SetPalette标记打上,导致低版本Qt动态切换主题失效 + +Closes #51353 +--- + style/src/style.cpp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/style/src/style.cpp b/style/src/style.cpp +index 000fe11..062a032 100644 +--- a/style/src/style.cpp ++++ b/style/src/style.cpp +@@ -651,10 +651,6 @@ void Style::polish(QWidget *widget) + void Style::polish(QApplication *app) + { + QProxyStyle::polish(app); +- +- QPalette palette; +- StylePalette::instance()->polishPalette(&palette); +- QApplication::setPalette(palette); + } + + void Style::polish(QPalette &palette) +-- +2.27.0 + diff --git a/kiran-qt5-integration.spec b/kiran-qt5-integration.spec index 224bf314b5976afba1397bf78a7dae5754ab436a..692f03ad2074d2047f6056d95ab4db5382f30e3e 100644 --- a/kiran-qt5-integration.spec +++ b/kiran-qt5-integration.spec @@ -1,6 +1,6 @@ -Name: kiran-qt5-integration +Name: kiran-qt5-integration Version: 2.4.0 -Release: 16%{?dist} +Release: 20%{?dist} Summary: Kiran desktop platform integration plugin. License: MulanPSL-2.0 @@ -19,35 +19,43 @@ Patch0010: 0010-fix-style-add-ks-ssr-gui-to-white-list.patch Patch0011: 0011-fix-theme-Fix-the-use-of-QApplication-class-for-plat.patch Patch0012: 0012-feature-style-add-kiran-manual-to-default-white-list.patch Patch0013: 0013-feature-adapt-Modified-some-code-to-adapt-to-KY3.3-6.patch +Patch0014: 0014-fix-style-replace-ParentStyle-with-QProxyStyle-and-a.patch +Patch0015: 0015-fix-fix-theme-support-custom-library-name.patch +Patch0016: 0016-fix-css-generate-Adapting-to-lower-version-Qt-themes.patch +Patch0017: 0017-fix-appearance-Fix-theme-error-when-session-dbus-ser.patch +Patch0018: 0018-fix-build-fix-build-error-in-qt5.9.2.patch +Patch0019: 0019-fix-QCompleter-Adjust-the-height-of-the-QCompleter-P.patch +Patch0020: 0020-fix-style-Fix-the-failure-of-dynamic-theme-switching.patch BuildRequires: cmake >= 3.2 -BuildRequires: gcc-c++ -BuildRequires: pkgconf -BuildRequires: sassc -BuildRequires: python%{python3_pkgversion} -BuildRequires: python%{python3_pkgversion}-cairo - -BuildRequires: qt5-qtbase-devel -BuildRequires: qt5-qtbase-private-devel -BuildRequires: qt5-qtbase-static -BuildRequires: qt5-qtsvg-devel -BuildRequires: qt5-linguist -BuildRequires: gsettings-qt-devel - -BuildRequires: kiran-qdbusxml2cpp -BuildRequires: kiran-log-qt5-devel -BuildRequires: kiran-cc-daemon-devel - -Requires: qt5-qtbase -Requires: qt5-qtsvg -Requires: gsettings-qt -Requires: kiran-log-qt5 - -%package devel -Summary: develop package for kiran-qt5-integration -Requires: %{name} = %{version}-%{release} - -%description devel +BuildRequires: gcc-c++ +BuildRequires: pkgconf +BuildRequires: sassc + +BuildRequires: python%{python3_pkgversion} +BuildRequires: python%{python3_pkgversion}-cairo + +BuildRequires: qt5-qtbase-devel +BuildRequires: qt5-qtbase-private-devel +BuildRequires: qt5-qtbase-static +BuildRequires: qt5-qtsvg-devel +BuildRequires: qt5-linguist +BuildRequires: gsettings-qt-devel + +BuildRequires: kiran-qdbusxml2cpp +BuildRequires: kiran-log-qt5-devel +BuildRequires: kiran-cc-daemon-devel + +Requires: qt5-qtbase +Requires: qt5-qtsvg +Requires: gsettings-qt +Requires: kiran-log-qt5 + +%package devel +Summary: develop package for kiran-qt5-integration +Requires: %{name} = %{version}-%{release} + +%description devel %{summary} %description @@ -74,8 +82,17 @@ make %{?_smp_mflags} %{_libdir}/pkgconfig/kiran-style-helper.pc %changelog +* Sun Dec 08 2024 liuxinhao - 2.4.0-20 +- KYOS-B: replace ParentStyle with QProxyStyle and adapt to QT5.9.7 version +- KYOS-B: theme support custom library name +- KYOS-B: Adapting to lower version Qt, autorcc not correctly associating dependencies +- KYOS-B: Fix theme error when session dbus service is not registered(#35760) +- kYOS-B: fix build in Qt5.9.2(#45382) +- KYOS-B: adjust the height of the QCompleter Popup pop-up(#42329) +- KYOS-B: fix the failure of dynamic theme switching in low version of Qt.(#51353) + * Mon Apr 15 2024 youzhengcai - 2.4.0-16 -- rebuild for 3.6.1 +- rebuil for 3.6.1 * Fri Dec 15 2023 youzhengcai - 2.4.0-15 - KYOS-F: add kiran-manual to default kiran-style-apps list