!62 在界面中添加KiranNew图标主题选择控件;增加编译选项开关,是否开启网络、音量和用户组插件

From: @luoqing_kylinsec 
Reviewed-by: @liubuguiii 
Signed-off-by: @liubuguiii
This commit is contained in:
openeuler-ci-bot 2023-04-17 08:49:35 +00:00 committed by Gitee
commit 2bf100d62a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 198 additions and 8 deletions

View File

@ -0,0 +1,94 @@
From 141c91b449bb0c4b90b30b48cb36756e8c4b6ced Mon Sep 17 00:00:00 2001
From: yuanxing <yuanxing@kylinsec.com.cn>
Date: Thu, 13 Apr 2023 14:32:36 +0800
Subject: [PATCH 1/2] fix(icon):add KiranNew icon selector in ui
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在界面中添加KiranNew图标主题选择控件
---
.../pages/theme/icon-themes/icon-themes.cpp | 53 ++++++++++++++++++-
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp b/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
index 6e6f614..7dd60ac 100644
--- a/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
+++ b/plugins/appearance/src/pages/theme/icon-themes/icon-themes.cpp
@@ -39,6 +39,14 @@ static QStringList icons{"accessories-calculator",
"user-info",
"preferences-desktop-wallpaper"};
+static QStringList kiranNewIcons{"kc-calculator",
+ "smplayer",
+ "firefox",
+ "thunderbird",
+ "utilities-terminal",
+ "brasero",
+ "accessories-text-editor"};
+
IconThemes::IconThemes(QWidget *parent) : QWidget(parent),
ui(new Ui::IconThemes)
{
@@ -167,7 +175,7 @@ void IconThemes::createIconWidgets()
for (int i = 0; i < m_iconThemes.size(); i++)
{
- if (m_iconThemes.at(i).startsWith("Kiran", Qt::CaseInsensitive))
+ if (!m_iconThemes.at(i).compare("Kiran", Qt::CaseInsensitive))
{
QString path = m_iconThemesPath.at(i) + "/apps/scalable/";
QDir appsDir = QDir(path);
@@ -208,7 +216,48 @@ void IconThemes::createIconWidgets()
else
continue;
}
- else if (m_iconThemes.at(i).startsWith("Adwaita", Qt::CaseInsensitive))
+ else if (!m_iconThemes.at(i).compare("KiranNew", Qt::CaseInsensitive))
+ {
+ QString path = m_iconThemesPath.at(i) + "/48x48/apps/";
+ QDir appsDir = QDir(path);
+ QStringList iconList = appsDir.entryList(QDir::Files);
+ QStringList showIconsList;
+ if (appsDir.exists())
+ {
+ for (int i = 0; i < kiranNewIcons.size(); i++)
+ {
+ if (iconList.contains(kiranNewIcons.at(i) + ".png"))
+ showIconsList.append(path + kiranNewIcons.at(i) + ".png");
+ else
+ {
+ KLOG_INFO() << "not contain " << kiranNewIcons.at(i);
+ foreach (QString icon, iconList)
+ {
+ if (icon.startsWith(kiranNewIcons.at(i)))
+ {
+ showIconsList.append(path + icon);
+ break;
+ }
+ }
+ }
+ }
+ if (!showIconsList.isEmpty())
+ {
+ //new theme-widget
+ ThemeWidget *themeWidget = new ThemeWidget(QSize(40, 40), m_currentIconTheme,
+ m_iconThemes.at(i), showIconsList);
+ vLayout->addWidget(themeWidget, Qt::AlignRight);
+
+ if (m_iconThemes.at(i) == m_currentIconTheme)
+ m_iconThemeWidgetGroup->setCurrentWidget(themeWidget);
+ m_iconThemeWidgetGroup->addWidget(themeWidget);
+ themeWidget->setTheme(m_iconThemes.at(i));
+ }
+ }
+ else
+ continue;
+ }
+ else if (!m_iconThemes.at(i).compare("Adwaita", Qt::CaseInsensitive))
{
QString path = m_iconThemesPath.at(i) + "/48x48/apps/";
QDir appsDir = QDir(path);
--
2.33.0

View File

@ -0,0 +1,84 @@
From 4b93ca3e5b8eed92c1dfc4468780733ded46a886 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Mon, 17 Apr 2023 10:20:11 +0800
Subject: [PATCH 2/2] feature(options.cmake):Add compilation option switch,
whether to enable network, volume, and user group plugins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 增加编译选项开关,是否开启网络、音量和用户组插件
---
CMakeLists.txt | 1 +
kcp_variables.cmake | 1 -
options.cmake | 3 +++
plugins/CMakeLists.txt | 10 ++++++++--
4 files changed, 12 insertions(+), 3 deletions(-)
create mode 100644 options.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d053430..a437b57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ pkg_search_module(QGSETTINGS REQUIRED gsettings-qt)
include(kcp_variables.cmake)
include(kcp-qdbus-wrapper.cmake)
+include(options.cmake)
configure_file(${CMAKE_SOURCE_DIR}/data/config.h.in ${CMAKE_BINARY_DIR}/config.h)
configure_file(${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.desktop.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop)
diff --git a/kcp_variables.cmake b/kcp_variables.cmake
index 0709a11..ae01d40 100644
--- a/kcp_variables.cmake
+++ b/kcp_variables.cmake
@@ -10,7 +10,6 @@ set(KCP_INSTALL_INCLUDE ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PR
set(SYSCONFDIR "/etc" CACHE PATH "Installation directory for configurations")
set(KCP_PLUGIN_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
-OPTION(ENABLE_USER_GROUP "Enable user group" OFF)
#根级分类安装路径
set(CATEGORY_INSTALL_DIR ${INSTALL_DATADIR}/${PROJECT_NAME}/category)
diff --git a/options.cmake b/options.cmake
new file mode 100644
index 0000000..1776e21
--- /dev/null
+++ b/options.cmake
@@ -0,0 +1,3 @@
+OPTION(ENABLE_USER_GROUP "Enable user group" OFF)
+OPTION(ENABLE_NETWORK "Enable network plugin" ON)
+OPTION(ENABLE_AUDIO "Enable audio plugin" ON)
\ No newline at end of file
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index a55e816..c471259 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -3,16 +3,22 @@ cmake_minimum_required(VERSION 3.2)
add_subdirectory(system)
add_subdirectory(power)
add_subdirectory(mouse)
-add_subdirectory(audio)
# add_subdirectory(greeter)
add_subdirectory(account)
add_subdirectory(keyboard)
add_subdirectory(timedate)
-add_subdirectory(network)
add_subdirectory(display)
add_subdirectory(keybinding)
add_subdirectory(appearance)
add_subdirectory(authentication)
+if(ENABLE_NETWORK)
+ add_subdirectory(network)
+endif()
+
+if(ENABLE_AUDIO)
+ add_subdirectory(audio)
+endif()
+
if(ENABLE_USER_GROUP)
add_subdirectory(group)
endif()
--
2.33.0

View File

@ -7,6 +7,8 @@ Summary(zh_CN): Kiran桌面控制面板
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0: 0001-fix-translate-add-some-translation.patch
Patch1: 0001-fix-icon-add-KiranNew-icon-selector-in-ui.patch
Patch2: 0002-feature-options.cmake-Add-compilation-option-switch-.patch
BuildRequires: gcc-c++
BuildRequires: cmake >= 3.2
@ -104,7 +106,15 @@ Summary: Development files for kiran control panel plugin
%build
%{__mkdir} -p %{buildroot}
%cmake
%if "%{ks_custom_name}" == "GC"
%cmake -DENABLE_USER_GROUP:BOOL=ON \
-DENABLE_NETWORK:BOOL=OFF \
-DENABLE_AUDIO:BOOL=OFF
%else
%cmake
%endif
make %{?_smp_mflags}
%install
@ -123,14 +133,16 @@ make %{?_smp_mflags}
%{_libexecdir}/kiran-avatar-editor
%{_datadir}/kiran-cpanel-account/*
#audio
%{_sysconfdir}/xdg/autostart/kiran-audio-status-icon.desktop
%{_bindir}/kiran-audio-status-icon
%if "%{ks_custom_name}" != "GC"
#audio
%{_sysconfdir}/xdg/autostart/kiran-audio-status-icon.desktop
%{_bindir}/kiran-audio-status-icon
#network
%{_sysconfdir}/xdg/autostart/kiran-network-status-icon.desktop
%{_bindir}/kiran-network-status-icon
/etc/NetworkManager/conf.d/00-server.conf
#network
%{_sysconfdir}/xdg/autostart/kiran-network-status-icon.desktop
%{_bindir}/kiran-network-status-icon
/etc/NetworkManager/conf.d/00-server.conf
%endif
%files -n kiran-cpanel-launcher
%{_bindir}/kiran-cpanel-launcher