Fix the problem that application version is not set
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
This commit is contained in:
parent
bc7b2a0a5b
commit
98aa26b101
105
0001-fix-the-problem-that-the-app-version-not-set.patch
Normal file
105
0001-fix-the-problem-that-the-app-version-not-set.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
From cca34e2f88f6a2c2af752a39f665ce9fdc776464 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
|
||||||
|
Date: Tue, 28 May 2024 14:47:33 +0800
|
||||||
|
Subject: [PATCH] fix the problem that the app version not set
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
|
||||||
|
---
|
||||||
|
src/ukui-screensaver-command.cpp | 22 ++++++++++++++++++++++
|
||||||
|
src/ukui-screensaver-dialog.cpp | 21 +++++++++++++++++++++
|
||||||
|
2 files changed, 43 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/ukui-screensaver-command.cpp b/src/ukui-screensaver-command.cpp
|
||||||
|
index 1ce2d54..97f1eb7 100644
|
||||||
|
--- a/src/ukui-screensaver-command.cpp
|
||||||
|
+++ b/src/ukui-screensaver-command.cpp
|
||||||
|
@@ -22,15 +22,37 @@
|
||||||
|
#include <QTranslator>
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
#include <QDebug>
|
||||||
|
+#include <QProcess>
|
||||||
|
+#include <QRegularExpression>
|
||||||
|
#include "types.h"
|
||||||
|
#include <ukui-log4qt.h>
|
||||||
|
|
||||||
|
#define WORKING_DIRECTORY "/usr/share/ukui-screensaver"
|
||||||
|
|
||||||
|
+static QString getVersion()
|
||||||
|
+{
|
||||||
|
+ QProcess v_p;
|
||||||
|
+ v_p.start("rpm", QStringList() << "-q" << "ukui-screensaver");
|
||||||
|
+
|
||||||
|
+ if (!v_p.waitForFinished())
|
||||||
|
+ return "none";
|
||||||
|
+
|
||||||
|
+ QByteArray ba = v_p.readAllStandardOutput();
|
||||||
|
+
|
||||||
|
+ QRegularExpression qe("-([^-]+)-[^-]+\n$");
|
||||||
|
+
|
||||||
|
+ QRegularExpressionMatch qem = qe.match(ba);
|
||||||
|
+ if (qem.hasMatch()) {
|
||||||
|
+ return qem.captured(1);
|
||||||
|
+ }
|
||||||
|
+ return "none";
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
initUkuiLog4qt("ukui-screensaver-command");
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
+ a.setApplicationVersion(getVersion());
|
||||||
|
|
||||||
|
QString locale = QLocale::system().name();
|
||||||
|
QTranslator translator;
|
||||||
|
diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp
|
||||||
|
index e05cd00..3ea7bad 100644
|
||||||
|
--- a/src/ukui-screensaver-dialog.cpp
|
||||||
|
+++ b/src/ukui-screensaver-dialog.cpp
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
+#include <QRegularExpression>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
@@ -125,6 +126,25 @@ void handler(int signum)
|
||||||
|
window->closeScreensaver();
|
||||||
|
}
|
||||||
|
|
||||||
|
+static QString getVersion()
|
||||||
|
+{
|
||||||
|
+ QProcess v_p;
|
||||||
|
+ v_p.start("rpm", QStringList() << "-q" << "ukui-screensaver");
|
||||||
|
+
|
||||||
|
+ if (!v_p.waitForFinished())
|
||||||
|
+ return "none";
|
||||||
|
+
|
||||||
|
+ QByteArray ba = v_p.readAllStandardOutput();
|
||||||
|
+
|
||||||
|
+ QRegularExpression qe("-([^-]+)-[^-]+\n$");
|
||||||
|
+
|
||||||
|
+ QRegularExpressionMatch qem = qe.match(ba);
|
||||||
|
+ if (qem.hasMatch()) {
|
||||||
|
+ return qem.captured(1);
|
||||||
|
+ }
|
||||||
|
+ return "none";
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#define WORKING_DIRECTORY "/usr/share/ukui-screensaver"
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
@@ -169,6 +189,7 @@ int main(int argc, char *argv[])
|
||||||
|
//signal(SIGTERM,handler);
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
QApplication::setSetuidAllowed(true);
|
||||||
|
+ a.setApplicationVersion(getVersion());
|
||||||
|
|
||||||
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
if(desktop->geometry().width()<=0 || desktop->geometry().height()<=0)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: ukui-screensaver
|
Name: ukui-screensaver
|
||||||
Version: 3.1.1
|
Version: 3.1.1
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: Screensaver for UKUI desktop environment
|
Summary: Screensaver for UKUI desktop environment
|
||||||
License: GPL-3+ and GPL-2+
|
License: GPL-3+ and GPL-2+
|
||||||
URL: http://www.ukui.org
|
URL: http://www.ukui.org
|
||||||
@ -11,6 +11,7 @@ Patch02: 0002-fix-build-compile-error.patch
|
|||||||
Patch03: disable-Suspend-and-Sleep-of-ukui-screensaver.patch
|
Patch03: disable-Suspend-and-Sleep-of-ukui-screensaver.patch
|
||||||
Patch04: add-switchuser-no-limits-in-ukui-screensaver.patch
|
Patch04: add-switchuser-no-limits-in-ukui-screensaver.patch
|
||||||
%endif
|
%endif
|
||||||
|
Patch05: 0001-fix-the-problem-that-the-app-version-not-set.patch
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: qt5-qtbase-devel
|
BuildRequires: qt5-qtbase-devel
|
||||||
BuildRequires: qt5-qtx11extras-devel
|
BuildRequires: qt5-qtx11extras-devel
|
||||||
@ -48,6 +49,7 @@ fi
|
|||||||
%patch03 -p1
|
%patch03 -p1
|
||||||
%patch04 -p1
|
%patch04 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%patch05 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cmake .
|
cmake .
|
||||||
@ -82,6 +84,12 @@ glib-compile-schemas /usr/share/glib-2.0/schemas/ &> /dev/null ||:
|
|||||||
%{_prefix}/lib/ukui-screensaver/screensaver-focus-helper
|
%{_prefix}/lib/ukui-screensaver/screensaver-focus-helper
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 28 2024 houhongxun <houhongxun@kylinos.cn> - 3.1.1-7
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:add patch5:0001-fix-the-problem-that-the-app-version-not-set.patch
|
||||||
|
|
||||||
* Mon Sep 04 2023 peijiankang <peijiankang@kylinos.cn> - 3.1.1-6
|
* Mon Sep 04 2023 peijiankang <peijiankang@kylinos.cn> - 3.1.1-6
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user