!190 fix-cpuinfo-error-of-ukui-control-center-3.1.2.patch
From: @peijiankang Reviewed-by: @hou-hongxun Signed-off-by: @hou-hongxun
This commit is contained in:
commit
4aaa828beb
77
fix-cpuinfo-error-of-ukui-control-center-3.1.2.patch
Normal file
77
fix-cpuinfo-error-of-ukui-control-center-3.1.2.patch
Normal file
@ -0,0 +1,77 @@
|
||||
From 67187a2ac22acad835b8e78a5007a77776c34742 Mon Sep 17 00:00:00 2001
|
||||
From: peijiankang <peijiankang@kylinos.cn>
|
||||
Date: Fri, 10 May 2024 15:44:06 +0800
|
||||
Subject: [PATCH] fix cpuinfo error of ukui-control-center-3.1.2
|
||||
|
||||
---
|
||||
shell/utils/utils.cpp | 34 ++++++++++++++++++++++++++++++++++
|
||||
shell/utils/utils.h | 1 +
|
||||
2 files changed, 35 insertions(+)
|
||||
|
||||
diff --git a/shell/utils/utils.cpp b/shell/utils/utils.cpp
|
||||
index 3c859a1..0680ab9 100644
|
||||
--- a/shell/utils/utils.cpp
|
||||
+++ b/shell/utils/utils.cpp
|
||||
@@ -57,6 +57,39 @@ QVariantMap Utils::getModuleHideStatus() {
|
||||
}
|
||||
|
||||
QString Utils::getCpuInfo() {
|
||||
+ QFile file("/proc/cpuinfo");
|
||||
+
|
||||
+ if (file.open(QIODevice::ReadOnly)) {
|
||||
+ QString buffer = file.readAll();
|
||||
+ QStringList modelLine = buffer.split('\n').filter(QRegularExpression("^model name"));
|
||||
+ QStringList modelLineWayland = buffer.split('\n').filter(QRegularExpression("^Hardware"));
|
||||
+ QStringList lines = buffer.split('\n');
|
||||
+
|
||||
+ if (modelLine.isEmpty()) {
|
||||
+ if (modelLineWayland.isEmpty()) {
|
||||
+ QString lscpuresult = getlscpuinfo();
|
||||
+ if (lscpuresult == "")
|
||||
+ return "Unknown";
|
||||
+ return lscpuresult;
|
||||
+ }
|
||||
+ modelLine = modelLineWayland;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ int count = lines.filter(QRegularExpression("^processor")).count();
|
||||
+
|
||||
+ QString result;
|
||||
+ result.append(modelLine.first().split(':').at(1));
|
||||
+ result = result.trimmed();
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ return QString();
|
||||
+}
|
||||
+
|
||||
+QString Utils::getlscpuinfo()
|
||||
+{
|
||||
QString result = "";
|
||||
QProcess process;
|
||||
process.start("lscpu");
|
||||
@@ -74,6 +107,7 @@ QString Utils::getCpuInfo() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ result = result.trimmed();
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git a/shell/utils/utils.h b/shell/utils/utils.h
|
||||
index 71fb3bd..86e6150 100644
|
||||
--- a/shell/utils/utils.h
|
||||
+++ b/shell/utils/utils.h
|
||||
@@ -40,6 +40,7 @@ namespace Utils
|
||||
QRect sizeOnCursor();
|
||||
QVariantMap getModuleHideStatus();
|
||||
QString getCpuInfo();
|
||||
+ QString getlscpuinfo();
|
||||
QString getCpuArchitecture();
|
||||
bool isExistEffect();
|
||||
bool isExistBattery();
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: ukui-control-center
|
||||
Version: 3.1.2
|
||||
Release: 29
|
||||
Release: 30
|
||||
Summary: utilities to configure the UKUI desktop
|
||||
License: GPL-2+
|
||||
URL: http://www.ukui.org
|
||||
@ -27,6 +27,7 @@ Patch22: cpuinfo-in-arm-system-is-null.patch
|
||||
Patch23: add-ukcc-setlang.patch
|
||||
Patch24: fix-changeusertype-error.patch
|
||||
Patch25: update-formats_loacle-and-language.patch
|
||||
Patch26: fix-cpuinfo-error-of-ukui-control-center-3.1.2.patch
|
||||
|
||||
Patch200: fix-build-error-of-libkscreen-qt5-5.27.6.patch
|
||||
Patch201: fix-build-error-of-clang.patch
|
||||
@ -151,6 +152,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri May 10 2024 peijiankang <peijiankang@kylinos.cn> - 3.1.2-30
|
||||
- Type:bugfix
|
||||
- ID :NA
|
||||
- SUG :NA
|
||||
- DESC:add fix-cpuinfo-error-of-ukui-control-center-3.1.2.patch
|
||||
|
||||
* Mon Jan 29 2024 peijiankang <peijiankang@kylinos.cn> - 3.1.2-29
|
||||
- Type:bugfix
|
||||
- ID :NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user