1 Star 0 Fork 10

chenguanglee/kylin-calculator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Fix-the-version-showing-none-in-about-dialog.patch 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kr-space/kylin-calculator.git
git@gitee.com:kr-space/kylin-calculator.git
kr-space
kylin-calculator
kylin-calculator
master

搜索帮助