!3 modify the error version of ukui-clock

From: @peijiankang 
Reviewed-by: @tanyulong2021 
Signed-off-by: @tanyulong2021
This commit is contained in:
openeuler-ci-bot 2022-08-08 07:57:03 +00:00 committed by Gitee
commit cc0a02de3a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 26c21cea61c43db986817d8be4a25642b46e0fc7 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Tue, 2 Aug 2022 09:26:38 +0800
Subject: [PATCH] modify the error version of ukui-clock
---
about.cpp | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/about.cpp b/about.cpp
index 08b081c..e699d2a 100644
--- a/about.cpp
+++ b/about.cpp
@@ -38,7 +38,31 @@ About::About(QWidget *parent) :
ui->appnameLabel->setText(tr(KYLIN_CLOCK_APP_NAME));
ui->appnameLabel->setStyleSheet("QLabel{ font-size: 18px; color: palette(windowText);}"
"QLabel{font-family: NotoSansCJKsc-Medium, NotoSansCJKsc;}");
- ui->versionLabel->setText(tr("Version: ")+"2021.2.0");
+
+ QString appVersion = "2021.2.0";
+ FILE *pp = NULL;
+ char *line = NULL;
+ char *q = NULL;
+ size_t len = 0;
+ ssize_t read;
+
+ pp = popen("rpm -q ukui-clock", "r");
+ if(pp) { while((read = getline(&line, &len, pp)) != -1){
+ q = strrchr(line, '\n');
+ *q = '\0';
+ QString content = line;
+ QStringList list = content.split("-");
+ if (list.size() >= 3)
+ appVersion = list.at(2);
+ }
+ }
+ if(line){
+ free(line);
+ line = NULL;
+ }
+ pclose(pp);
+
+ ui->versionLabel->setText(tr("Version: ")+ appVersion);
settingsStyle();
//中间大图标
ui->appiconLabel->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(96,96));
--
2.33.0

View File

@ -2,11 +2,12 @@
Name: ukui-clock
Version: 3.0.1
Release: 1
Release: 2
Summary: contain clock alarm,stopwatch,countdown
License: GPL-2.1+ and GPL-3.0+
URL: http://www.ukui.org
Source0: %{name}-%{version}.tar.xz
Patch01: 0001-modify-the-error-version-of-ukui-clock.patch
BuildRequires: glib2-devel
BuildRequires: qt5-qtbase-devel
@ -32,6 +33,7 @@ contain clock alarm,stopwatch,countdown
%prep
%setup -q
%patch01 -p1
%build
mkdir build && cd build
@ -52,5 +54,8 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ukui-clock
%changelog
* Mon Aug 8 2022 peijiankang <peijiankang@kylinos.cn> - 3.0.1-2
- modify the error version of ukui-clock
* Mon Aug 8 2022 peijiankang <peijiankang@kylinos.cn> - 3.0.1-1
- Init package for openEuler