From: @myshow2258
Reviewed-by: @dou33
Signed-off-by: @dou33
This commit is contained in:
openeuler-ci-bot 2021-01-26 09:52:17 +08:00 committed by Gitee
commit ce4acb6233
7 changed files with 482 additions and 7 deletions

View File

@ -0,0 +1,257 @@
From e64005deb039312a914ce8dcb9f93f1f4ac6cf7c Mon Sep 17 00:00:00 2001
From: myshow <296570182@qq.com>
Date: Wed, 25 Nov 2020 17:34:20 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E4=BA=8E?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=20=E5=86=85=E6=A0=B8=20cpu=20=E5=86=85?=
=?UTF-8?q?=E5=AD=98=20=E7=A1=AC=E7=9B=98=20=E4=BF=A1=E6=81=AF=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E7=A9=BA=E7=99=BD=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugins/messages-task/about/about.cpp | 53 +++++----------------
plugins/messages-task/about/about.pro | 8 ++--
plugins/messages-task/about/cpuinfo.cpp | 34 +++++++++++++
plugins/messages-task/about/cpuinfo.h | 15 ++++++
plugins/messages-task/about/memoryentry.cpp | 32 ++++++++++---
plugins/messages-task/about/memoryentry.h | 1 +
6 files changed, 92 insertions(+), 51 deletions(-)
create mode 100644 plugins/messages-task/about/cpuinfo.cpp
create mode 100644 plugins/messages-task/about/cpuinfo.h
diff --git a/plugins/messages-task/about/about.cpp b/plugins/messages-task/about/about.cpp
index 9e8c290..a2dc766 100644
--- a/plugins/messages-task/about/about.cpp
+++ b/plugins/messages-task/about/about.cpp
@@ -22,6 +22,7 @@
#include "about.h"
#include "ui_about.h"
#include "memoryentry.h"
+#include "cpuinfo.h"
#include <QProcess>
#include <QFile>
@@ -99,54 +100,22 @@ void About::setupDesktopComponent() {
void About::setupKernelCompenent() {
QString kernal = QSysInfo::kernelType() + " " + QSysInfo::kernelVersion();
- QString diskSize;
- QString memorySize;
- QString cpuType;
-
- //ubuntukylin youker DBus interface
- QDBusInterface *youkerInterface;
- for (int i = 0; i < 2; i++) {
- youkerInterface = new QDBusInterface("com.kylin.assistant.systemdaemon",
- "/com/kylin/assistant/systemdaemon",
- "com.kylin.assistant.systemdaemon",
- QDBusConnection::systemBus(), this);
- }
- if (!youkerInterface->isValid()) {
- qCritical() << "Create youker Interface Failed When Get Computer info: " << QDBusConnection::systemBus().lastError();
- return;
- }
-
- QDBusReply<QMap<QString, QVariant>> diskinfo;
- diskinfo = youkerInterface ->call("get_harddisk_info");
- if (!diskinfo.isValid()) {
- qDebug() << "diskinfo is invalid" << endl;
- } else {
- QMap<QString, QVariant> res = diskinfo.value();
- diskSize = res["DiskCapacity"].toString();
- if (diskSize.contains("<1_1>")) {
- int index = diskSize.indexOf("<1_1>");
- QString disk1 = diskSize.left(index);
- diskSize = tr("Disk:") + disk1;
- }
- }
-
- QDBusReply<QMap<QString, QVariant>> cpuinfo;
- cpuinfo = youkerInterface ->call("get_cpu_info");
- if (!diskinfo.isValid()) {
- qDebug() << "cpuinfo is invalid" << endl;
- } else {
- QMap<QString, QVariant> res = cpuinfo.value();
- cpuType = res["CpuVersion"].toString();
- }
+ QString memorySize = "N/A";
+ QString cpuType = "N/A";
+ QString diskSize = "N/A";
MemoryEntry memoryInfo;
QStringList memory = memoryInfo.totalMemory();
- memorySize = memorySize + memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
+ memorySize = memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
- ui->cpuContent->setText(cpuType);
- ui->diskContent->setText(diskSize);
ui->kernalContent->setText(kernal);
ui->memoryContent->setText(memorySize);
+
+ ui->cpuContent->setText(cpuinfo::getCpuName());
+
+ QStorageInfo storage = QStorageInfo::root();
+ diskSize = QString("%1").arg(storage.bytesTotal()/1024.0f/1024/1024, 0, 'f', 1) + " GB";
+ ui->diskContent->setText(diskSize);
}
void About::setupVersionCompenent() {
diff --git a/plugins/messages-task/about/about.pro b/plugins/messages-task/about/about.pro
index b9898f6..cd789e1 100644
--- a/plugins/messages-task/about/about.pro
+++ b/plugins/messages-task/about/about.pro
@@ -17,12 +17,14 @@ INCLUDEPATH += \
HEADERS += \
about.h \
entry.h \
- memoryentry.h
+ memoryentry.h \
+ cpuinfo.h
SOURCES += \
about.cpp \
entry.cpp \
- memoryentry.cpp
+ memoryentry.cpp \
+ cpuinfo.cpp
FORMS += \
about.ui
@@ -30,4 +32,4 @@ FORMS += \
RESOURCES += \
res/img.qrc
-INSTALLS += target
\ No newline at end of file
+INSTALLS += target
diff --git a/plugins/messages-task/about/cpuinfo.cpp b/plugins/messages-task/about/cpuinfo.cpp
new file mode 100644
index 0000000..ee24a95
--- /dev/null
+++ b/plugins/messages-task/about/cpuinfo.cpp
@@ -0,0 +1,34 @@
+#include <QFile>
+#include <QDebug>
+
+#include "cpuinfo.h"
+
+cpuinfo::cpuinfo(QObject *parent) : QObject(parent)
+{
+
+}
+
+QString cpuinfo::getCpuName()
+{
+ QString name = "";
+#ifdef Q_OS_LINUX
+ QFile file("/proc/cpuinfo");
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return "no cpuinfo";
+
+ QString line = "N/A";
+ QTextStream in(&file);
+ line = in.readLine();
+ while (!in.atEnd()) {
+ line = in.readLine();
+ if (line.contains("model name"))
+ break;
+ }
+ //openEuler /proc/cpuinfo
+ //model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
+ name = QString(line).right(line.length() - (line.indexOf(":") + 2));
+#elif defined(Q_OS_FREEBSD)
+
+#endif
+ return name;
+}
diff --git a/plugins/messages-task/about/cpuinfo.h b/plugins/messages-task/about/cpuinfo.h
new file mode 100644
index 0000000..2253ea6
--- /dev/null
+++ b/plugins/messages-task/about/cpuinfo.h
@@ -0,0 +1,15 @@
+#ifndef CPUINFO_H
+#define CPUINFO_H
+
+#include <QObject>
+
+class cpuinfo : public QObject
+{
+ Q_OBJECT
+public:
+ explicit cpuinfo(QObject *parent = nullptr);
+
+ static QString getCpuName();
+};
+
+#endif // CPUINFO_H
diff --git a/plugins/messages-task/about/memoryentry.cpp b/plugins/messages-task/about/memoryentry.cpp
index 4d93a3b..f1b1bef 100644
--- a/plugins/messages-task/about/memoryentry.cpp
+++ b/plugins/messages-task/about/memoryentry.cpp
@@ -22,6 +22,27 @@ MemoryEntry::MemoryEntry() : Entry(ki18n("Memory:"), totalMemory().at(1))
}
qlonglong MemoryEntry::calculateTotalRam()
+{
+ qlonglong ret = -1;
+#ifdef Q_OS_LINUX
+ struct sysinfo info;
+ if (sysinfo(&info) == 0)
+ // manpage "sizes are given as multiples of mem_unit bytes"
+ ret = qlonglong(info.totalswap) * info.mem_unit;
+#elif defined(Q_OS_FREEBSD)
+ /* Stuff for sysctl */
+ size_t len;
+
+ unsigned long memory;
+ len = sizeof(memory);
+ sysctlbyname("hw.physmem", &memory, &len, NULL, 0);
+
+ ret = memory;
+#endif
+ return ret;
+}
+
+qlonglong MemoryEntry::calculateavAilableRam()
{
qlonglong ret = -1;
#ifdef Q_OS_LINUX
@@ -46,16 +67,15 @@ QStringList MemoryEntry::totalMemory()
{
QStringList res;
const qlonglong totalRam = calculateTotalRam();
+ const qlonglong availableRam = calculateavAilableRam();
if (totalRam > 0) {
- QString total = KFormat().formatByteSize(totalRam, 0);
- QString available = KFormat().formatByteSize(totalRam, 1);
- if (total.toDouble() > available.toDouble()) {
- qSwap(total, available);
- }
+ QString total = KFormat().formatByteSize(totalRam);
+ QString available = KFormat().formatByteSize(availableRam);
+
res << total << available;
return res;
}
-// return ki18n("Unknown amount of RAM", "Unknown");
+
return res;
}
diff --git a/plugins/messages-task/about/memoryentry.h b/plugins/messages-task/about/memoryentry.h
index d992a30..3ef792a 100644
--- a/plugins/messages-task/about/memoryentry.h
+++ b/plugins/messages-task/about/memoryentry.h
@@ -15,6 +15,7 @@ class MemoryEntry : public Entry
public:
MemoryEntry();
static qlonglong calculateTotalRam();
+ static qlonglong calculateavAilableRam();
static QStringList totalMemory();
};
--
2.29.2.windows.2

View File

@ -0,0 +1,89 @@
From 024f7bebf163348518ebbdf443c185dc66595a53 Mon Sep 17 00:00:00 2001
From: myshow <296570182@qq.com>
Date: Fri, 27 Nov 2020 17:34:23 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8?=
=?UTF-8?q?=E7=99=BB=E5=BD=95=E4=B8=8E=E5=85=8D=E5=AF=86=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugins/account/userinfo/userinfo.cpp | 3 ++-
plugins/account/userinfo/userinfo.ui | 2 +-
registeredQDbus/main.cpp | 2 +-
registeredQDbus/sysdbusregister.cpp | 9 ++++++---
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/plugins/account/userinfo/userinfo.cpp b/plugins/account/userinfo/userinfo.cpp
index 49744f6..09183a4 100644
--- a/plugins/account/userinfo/userinfo.cpp
+++ b/plugins/account/userinfo/userinfo.cpp
@@ -355,8 +355,9 @@ void UserInfo::initComponent(){
if (!getuid()){
ui->changeTypeBtn->setEnabled(false);
ui->changeGroupBtn->setEnabled(false);
+ ui->changeValidBtn->setEnabled(false);
ui->autoLoginFrame->setVisible(false);
- ui->autoLoginFrame_2->setVisible(false);
+ ui->noPasswdFrame->setVisible(false);
}
//样式表
// pluginWidget->setStyleSheet("background: #ffffff;");
diff --git a/plugins/account/userinfo/userinfo.ui b/plugins/account/userinfo/userinfo.ui
index 4793f7b..c6d0da8 100644
--- a/plugins/account/userinfo/userinfo.ui
+++ b/plugins/account/userinfo/userinfo.ui
@@ -471,7 +471,7 @@
</widget>
</item>
<item>
- <widget class="QFrame" name="autoLoginFrame_2">
+ <widget class="QFrame" name="noPasswdFrame">
<property name="minimumSize">
<size>
<width>550</width>
diff --git a/registeredQDbus/main.cpp b/registeredQDbus/main.cpp
index e6b1340..c2db36e 100644
--- a/registeredQDbus/main.cpp
+++ b/registeredQDbus/main.cpp
@@ -29,7 +29,7 @@ int main(int argc, char *argv[]){
QCoreApplication app(argc, argv);
app.setOrganizationName("Kylin Team");
- app.setApplicationName("ukcc-service");
+ app.setApplicationName("ukui-service");
QDBusConnection systemBus = QDBusConnection::systemBus();
diff --git a/registeredQDbus/sysdbusregister.cpp b/registeredQDbus/sysdbusregister.cpp
index 2985c57..670e5e5 100644
--- a/registeredQDbus/sysdbusregister.cpp
+++ b/registeredQDbus/sysdbusregister.cpp
@@ -87,7 +87,7 @@ QString SysdbusRegister::getNoPwdLoginStatus(){
//设置免密登录状态
void SysdbusRegister::setNoPwdLoginStatus(bool status,QString username){
-
+ systemRun("groupadd -r nopasswdlogin");
QString cmd;
if(true == status){
cmd = QString("gpasswd -a %1 nopasswdlogin").arg(username);
@@ -102,10 +102,13 @@ void SysdbusRegister::setAutoLoginStatus(QString username)
{
QString filename = "/etc/lightdm/lightdm.conf";
QSharedPointer<QSettings> autoSettings = QSharedPointer<QSettings>(new QSettings(filename, QSettings::IniFormat));
- autoSettings->beginGroup("SeatDefaults");
- autoSettings->clear();
+ autoSettings->beginGroup("SeatDefaults");
autoSettings->setValue("autologin-user", username);
+ autoSettings->setValue("autologin-session", "ukui");
autoSettings->endGroup();
autoSettings->sync();
+
+ systemRun("groupadd -r autologin");
+ systemRun(QString("gpasswd -a %1 autologin").arg(username));
}
--
2.29.2.windows.2

View File

@ -0,0 +1,31 @@
From bb73b40db7489201f2d5237a675cfd2ff7ae01bc Mon Sep 17 00:00:00 2001
From: myshow <296570182@qq.com>
Date: Tue, 1 Dec 2020 14:45:48 +0800
Subject: [PATCH 4/5] =?UTF-8?q?fix-dialog-pop-twice-after-modifying-resolu?=
=?UTF-8?q?tion-bug=20=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E5=88=86?=
=?UTF-8?q?=E8=BE=A8=E7=8E=87=E4=B9=8B=E5=90=8E=E5=AF=B9=E8=AF=9D=E6=A1=86?=
=?UTF-8?q?=E5=BC=B9=E5=87=BA=E4=B8=A4=E6=AC=A1=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugins/system/display/widget.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/system/display/widget.cpp b/plugins/system/display/widget.cpp
index 7055733..7c175ed 100644
--- a/plugins/system/display/widget.cpp
+++ b/plugins/system/display/widget.cpp
@@ -78,7 +78,7 @@ Widget::Widget(QWidget *parent)
ui->monitorLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}");
ui->quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0)
+#if QT_VERSION <= QT_VERSION_CHECK(5, 6, 0)
oriApply = true;
#else
oriApply = false;
--
2.29.2.windows.2

View File

@ -0,0 +1,47 @@
From d0e9549cf4c08d0566bd3656b49a3c9e73d72383 Mon Sep 17 00:00:00 2001
From: myshow <296570182@qq.com>
Date: Tue, 1 Dec 2020 15:31:10 +0800
Subject: [PATCH 5/5] =?UTF-8?q?fix-effects-mode-not-available-bug=20?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=B9=E6=95=88=E6=A8=A1=E5=BC=8F=E4=B8=8D?=
=?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugins/personalized/theme/theme.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/personalized/theme/theme.cpp b/plugins/personalized/theme/theme.cpp
index a62cf4a..5e9d066 100644
--- a/plugins/personalized/theme/theme.cpp
+++ b/plugins/personalized/theme/theme.cpp
@@ -536,6 +536,7 @@ void Theme::initConnection() {
connect(effectSwitchBtn, &SwitchButton::checkedChanged, [this](bool checked) {
if (!checked) {
personliseGsettings->set(PERSONALSIE_TRAN_KEY, 1.0);
+ ui->tranSlider->setValue(100);
}
// 提供给外部监听特效接口
personliseGsettings->set(PERSONALSIE_EFFECT_KEY, checked);
@@ -657,7 +658,7 @@ void Theme::writeKwinSettings(bool change, QString theme, bool effect) {
kwinSettings->setValue("kwin4_effect_translucencyEnabled", false);
kwinSettings->setValue("zoomEnabled", false);
kwinSettings->endGroup();
-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0)
+#if QT_VERSION <= QT_VERSION_CHECK(5, 6, 0)
#else
for (int i = 0; i < effectList.length(); i++) {
@@ -676,7 +677,7 @@ void Theme::writeKwinSettings(bool change, QString theme, bool effect) {
kwinSettings->setValue("kwin4_effect_translucencyEnabled", true);
kwinSettings->setValue("zoomEnabled", true);
kwinSettings->endGroup();
-#if QT_VERSION <= QT_VERSION_CHECK(5, 12, 0)
+#if QT_VERSION <= QT_VERSION_CHECK(5, 6, 0)
#else
// 开启模糊特效:
--
2.29.2.windows.2

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
%define debug_package %{nil}
Name: ukui-control-center
Version: 2.0.3
Release: 1
Version: 3.0.1
Release: 3
Summary: utilities to configure the UKUI desktop
License: GPL-2+
URL: http://www.ukui.org
@ -23,14 +23,26 @@ BuildRequires: kf5-ki18n-devel
BuildRequires: libkscreen-qt5-devel
BuildRequires: qt5-qtdeclarative-devel
BuildRequires: dconf-devel
BuildRequires: edid-decode
BuildRequires: edid-decode
BuildRequires: redshift
BuildRequires: libmatemixer-devel
BuildRequires: libqtxdg-devel
BuildRequires: qt5-qtmultimedia-devel
BuildRequires: libxml2-devel
BuildRequires: libcanberra-devel
BuildRequires: kf5-kcoreaddons-devel
BuildRequires: kf5-kguiaddons-devel
BuildRequires: mate-desktop-devel
BuildRequires: libX11-devel
BuildRequires: libxkbcommon-devel
BuildRequires: libxkbfile-devel
BuildRequires: boost-devel
BuildRequires: libxcb-devel
BuildRequires: qt5-linguist
BuildRequires: polkit-qt5-1-devel
Requires: dconf
Requires: qt5-qtimageformats
Requires: qt5-qtsvg-devel
Requires: gsettings-qt-devel
Requires: glib2-devel
@ -46,7 +58,7 @@ Requires: kf5-ki18n-devel
Requires: libkscreen-qt5-devel
Requires: qt5-qtdeclarative-devel
Requires: dconf-devel
Requires: edid-decode
Requires: edid-decode
Requires: redshift
Requires: libmatemixer-devel
Requires: libqtxdg-devel
@ -57,6 +69,11 @@ Requires: libcanberra-devel
Requires: qt5-qtgraphicaleffects
Requires: qt5-qtquickcontrols
patch0: 0001-fix-system-overview-failed.patch
patch1: 0002-fix-autologin-nopasswdlogin-failed.patch
patch2: 0003-fix-dialog-pop-twice-after-modifying-resolution-bug.patch
patch3: 0004-fix-effects-mode-not-available-bug.patch
Recommends: qt5-qtquickcontrols
Suggests: gsettings-desktop-schemas
@ -76,29 +93,63 @@ Suggests: ukui-settings-daemon
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
qmake-qt5
qmake-qt5
make
%install
rm -rf $RPM_BUILD_ROOT
make INSTALL_ROOT=%{buildroot} install
%post
set -e
glib-compile-schemas /usr/share/glib-2.0/schemas/
#systemctl enable ukui-group-manager.service
#systemctl start ukui-group-manager.service
chown root:root /usr/bin/checkuserpwd
chmod u+s /usr/bin/checkuserpwd
%preun
#systemctl disable ukui-group-manager.service
#systemctl stop ukui-group-manager.service
%clean
rm -rf $RPM_BUILD_ROOT
%files
%files
%{_sysconfdir}/dbus-1/system.d/*
%{_bindir}/launchSysDbus
%{_bindir}/ukui-control-center
%{_prefix}/lib/control-center/*
#%%{_prefix}/lib/control-center/*
%{_libdir}/ukui-control-center/*
%{_datadir}/applications/*
%{_datadir}/dbus-1/system-services/*
%{_datadir}/glib-2.0/schemas/*
%{_datadir}/locale/zh_CN/LC_MESSAGES/*
%{_datadir}/ukui/faces/*
%{_datadir}/ukui-control-center/shell/res/i18n
%{_bindir}/group-manager-server
%{_bindir}/checkuserpwd
%{_unitdir}/ukui-group-manager.service
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
%changelog
* Thu Dec 3 2020 lvhan <lvhan@kylinos.cn> - 3.0.1-3
- fix dialog pop twice after modifying resolution
- fix effects mode not available
* Mon Nov 30 2020 lvhan <lvhan@kylinos.cn> - 3.0.1-2
- fix autologin nopasswdlogin failed
- fix system overview failed
* Thu Jul 9 2020 douyan <douyan@kylinos.cn> - 3.0.1-1
- update to upstream version 3.0.0-1+1031
* Thu Jul 9 2020 douyan <douyan@kylinos.cn> - 2.0.3-1
- Init package for openEuler