代码拉取完成,页面将自动刷新
From c16a752694ed5e34382199e0b4175a73c2c6ab5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
Date: Mon, 27 May 2024 14:22:23 +0800
Subject: [PATCH] Fix the version showing "none" in about dialog
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
---
src/menumodule/menumodule.cpp | 31 ++++++++++++------------
translations/generate_translations_qm.sh | 4 +--
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/menumodule/menumodule.cpp b/src/menumodule/menumodule.cpp
index 230ad47..765e855 100755
--- a/src/menumodule/menumodule.cpp
+++ b/src/menumodule/menumodule.cpp
@@ -127,22 +127,21 @@ void menuModule::helpAction()
QString menuModule::getVersion()
{
- QString version;
- QString command = "dpkg -l kylin-calculator | grep kylin-calculator";
- QProcess process;
- QStringList args;
- args << "-c" << command;
- process.start("bash", args);
- process.waitForFinished();
- process.waitForReadyRead();
- version = process.readAll();
- QStringList fields = version.split(QRegularExpression("[ \t]+"));
- if (fields.size() >= 3)
- version = fields.at(2);
- else
- version = "none";
-
- return version;
+ QProcess v_p;
+ v_p.start("rpm", QStringList() << "-q" << "kylin-calculator");
+
+ 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";
}
void menuModule::keyPressEvent(QKeyEvent *event)
diff --git a/translations/generate_translations_qm.sh b/translations/generate_translations_qm.sh
index 62fa6b5..c162798 100755
--- a/translations/generate_translations_qm.sh
+++ b/translations/generate_translations_qm.sh
@@ -4,5 +4,5 @@ ts_file_list=(`ls translations/*.ts`)
for ts in "${ts_file_list[@]}"
do
- lrelease "${ts}"
-done
\ No newline at end of file
+ lrelease-qt5 "${ts}"
+done
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。