reduce some log level,new file interface that can disable kiranstyle
This commit is contained in:
parent
11285170ab
commit
6d062be526
129
0001-refactor-log-Reduce-some-log-output-levels.patch
Normal file
129
0001-refactor-log-Reduce-some-log-output-levels.patch
Normal file
@ -0,0 +1,129 @@
|
||||
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
|
||||
|
||||
196
0002-feat-style-new-file-interface-that-can-disable-Kiran.patch
Normal file
196
0002-feat-style-new-file-interface-that-can-disable-Kiran.patch
Normal file
@ -0,0 +1,196 @@
|
||||
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
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
Name: kiran-qt5-integration
|
||||
Version: 2.3.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Kiran desktop platform integration plugin.
|
||||
|
||||
License: Mulan PSL v2
|
||||
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
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
BuildRequires: gcc-c++
|
||||
@ -53,6 +55,7 @@ make %{?_smp_mflags}
|
||||
%files
|
||||
%{_libdir}/qt5/plugins/*
|
||||
%{_libdir}/libkiran-style-helper.so.2*
|
||||
%{_sysconfdir}/kiran-qt5-integration/kiran-qt5-integration.ini
|
||||
|
||||
%files devel
|
||||
%{_includedir}/kiran-style/*
|
||||
@ -60,5 +63,8 @@ make %{?_smp_mflags}
|
||||
%{_libdir}/pkgconfig/kiran-style-helper.pc
|
||||
|
||||
%changelog
|
||||
* Mon Jul 11 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.3.0-2
|
||||
- KYOS-F: reduce some log level,disable kiranstyle settings file
|
||||
|
||||
* Wed Jul 06 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.3.0-1
|
||||
- Initial source
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user