From a252e7b724034ff7887aeaab9e373b73f892fb45 Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 1 Sep 2022 00:29:37 +0800 Subject: [PATCH] =?UTF-8?q?3.2.1=20=E6=9B=B4=E6=96=B0=E6=BA=90=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=94=B9=E4=B8=BAaptss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 7 ++++ src/main.cpp | 4 +-- src/widget.cpp | 55 +++++-------------------------- translations/spark-store_en.ts | 20 +++++------ translations/spark-store_fr.ts | 20 +++++------ translations/spark-store_zh_CN.ts | 20 ++++++----- 6 files changed, 49 insertions(+), 77 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7a6f97c..8938191 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +spark-store (3.2.1) stable; urgency=medium + + * 更改刷新系统源的功能 + + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + spark-store (3.2) stable; urgency=medium * 新增 下载量统计功能 diff --git a/src/main.cpp b/src/main.cpp index 35d72e6..7b29aeb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) DAboutDialog dialog; a.setAboutDialog(&dialog); dialog.setLicense(QObject::tr("We publish this program under GPL V3")); - dialog.setVersion(DApplication::buildVersion("Version 3.2")); + dialog.setVersion(DApplication::buildVersion("Version 3.2.1")); dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo dialog.setProductName(QLabel::tr("Spark Store")); dialog.setDescription( @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) a.setOrganizationName("spark-union"); a.setOrganizationDomain("https://www.deepinos.org/"); a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文 - a.setApplicationVersion(DApplication::buildVersion("3.2")); + a.setApplicationVersion(DApplication::buildVersion("3.2.1")); a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store"); a.setApplicationDescription( QObject::tr( diff --git a/src/widget.cpp b/src/widget.cpp index 877f713..3a40641 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1090,46 +1090,8 @@ void Widget::on_pushButton_updateApt_clicked() ui->pushButton_updateApt->setEnabled(false); ui->label_aptserver->setText(tr("Updating, please wait...")); - std::fstream sourcesList, policy, update; - QDir tmpdir("/tmp"); - auto tmpPath = QString::fromUtf8(TMP_PATH).toStdString(); - bool unknownError = true; - - tmpdir.mkpath("spark-store"); - sourcesList.open(tmpPath + "/sparkstore.list", std::ios::out); - // 商店已经下架会替换系统库的包,优先级 policy 弃用 - // policy.open(tmpPath + "/sparkstore", std::ios::out); - - if(sourcesList /*&& policy*/) - { - auto serverAddr = ui->comboBox_server->currentText(); - - sourcesList << "deb [by-hash=force] "; - sourcesList << serverAddr.toUtf8().toStdString(); - sourcesList << " /"; - sourcesList.close(); - - /* - * policy << "Package: *\n" << "Pin: origin *" << - * serverAddr.mid(serverAddr.indexOf('.')).toUtf8().toStdString() << "\n" << - * "Pin-Priority: 90"; // 降低星火源的优先级,防止从星火安装已存在的系统包,破坏依赖 - * policy.close(); - */ - - update.open(tmpPath + "/update.sh", std::ios::out); - if(update) - { - unknownError = false; - update << "#!/bin/sh\n" << - "mv " + tmpPath + "/sparkstore.list /etc/apt/sources.list.d/sparkstore.list && " << - // "mv " + tmpPath + "/sparkstore /etc/apt/preferences.d/sparkstore && " << - "apt update"; - update.close(); - - system(("chmod +x " + tmpPath + "/update.sh").c_str()); - QProcess runupdate; - runupdate.start("pkexec", QStringList() << QString::fromStdString(tmpPath + "/update.sh")); + runupdate.start("pkexec" , QStringList() << "aptss" << "ssupdate"); runupdate.waitForFinished(); QString error = runupdate.readAllStandardError(); @@ -1145,22 +1107,21 @@ void Widget::on_pushButton_updateApt_clicked() if(!haveError) { - ui->label_aptserver->setText("deb [by-hash=force] " + ui->comboBox_server->currentText().toUtf8() + " /"); + ui->label_aptserver->setText(tr("Update finished")); } else { ui->label_aptserver->setText(tr("Apt has reported an error. Please use apt update in terminal to locate the problem.")); } - } - } - if(unknownError) - { - ui->label_aptserver->setText(tr("Unknown error!")); - } + + + + ui->pushButton_updateApt->setEnabled(true); - }); + }); + } void Widget::on_pushButton_uninstall_clicked() diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts index 04f1a75..bde37e6 100644 --- a/translations/spark-store_en.ts +++ b/translations/spark-store_en.ts @@ -150,7 +150,7 @@ - + Install @@ -493,17 +493,12 @@ - + Apt has reported an error. Please use apt update in terminal to locate the problem. - - Unknown error! - - - - + Uninstall succeeded @@ -518,12 +513,17 @@ - + + Update finished + + + + Temporary cache was cleaned - + The URL has been copied to the clipboard diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts index 072f3ac..3f3caa7 100644 --- a/translations/spark-store_fr.ts +++ b/translations/spark-store_fr.ts @@ -211,7 +211,7 @@ Nous sommes nés pour le changement. - + Install @@ -650,6 +650,11 @@ Nous sommes nés pour le changement. Reinstall + + + Update finished + + Failed to get the name to the file to be downloaded. @@ -676,27 +681,22 @@ Nous sommes nés pour le changement. - + Apt has reported an error. Please use apt update in terminal to locate the problem. - - Unknown error! - - - - + Uninstall succeeded - + Temporary cache was cleaned - + The URL has been copied to the clipboard diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts index a3975b1..1b619df 100644 --- a/translations/spark-store_zh_CN.ts +++ b/translations/spark-store_zh_CN.ts @@ -205,7 +205,7 @@ - + Install 安装 @@ -476,7 +476,7 @@ Request Update - 软件催更/应用反馈 + 软件催更/应用反馈 @@ -518,6 +518,11 @@ Not Exist 不存在 + + + Update finished + 更新完毕 + @@ -599,14 +604,13 @@ 正在更新,请稍候…… - + Apt has reported an error. Please use apt update in terminal to locate the problem. 更新中发生错误,请在终端使用apt update来查看错误原因。 - Unknown error! - 未知错误! + 未知错误! Yes @@ -656,17 +660,17 @@ Click yes to continue. 服务器未知错误 - + Uninstall succeeded 卸载成功 - + Temporary cache was cleaned 缓存目录已清空 - + The URL has been copied to the clipboard 链接已复制到剪贴板