!113 3.2.1 merge

Merge pull request !113 from shenmo/dev
This commit is contained in:
shenmo 2022-09-18 13:17:11 +00:00 committed by Gitee
commit 8e3787ab07
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 106 additions and 154 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
spark-store (3.2.1) stable; urgency=medium
* 更改刷新系统源的功能
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
spark-store (3.2) stable; urgency=medium
* 新增 下载量统计功能

View File

@ -6,6 +6,11 @@ case "$1" in
# config for aptss
mkdir -p /etc/aptss/sources.list.d
ln -s -f /etc/apt/sources.list /etc/aptss/sources.list
# Remove the sources.list file
if [ -e /etc/apt/sources.list.d/sparkstore.list ];then
rm /etc/apt/sources.list.d/sparkstore.list
fi
# Check if /usr/local/bin existed

View File

@ -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(

View File

@ -1090,77 +1090,13 @@ 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.waitForFinished();
QString error = runupdate.readAllStandardError();
QStringList everyError = error.split("\n");
bool haveError = false;
for(int i = 0; i < everyError.size(); i++)
{
if(everyError[i].left(2) == "E:")
{
haveError = true;
}
}
if(!haveError)
{
ui->label_aptserver->setText("deb [by-hash=force] " + ui->comboBox_server->currentText().toUtf8() + " /");
}
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!"));
}
QString storeSpk = "spk://store/tools/spark-store";
openUrl(storeSpk);
ui->label_aptserver->setText(tr(""));
ui->pushButton_updateApt->setEnabled(true);
});
});
}
void Widget::on_pushButton_uninstall_clicked()
@ -1212,6 +1148,16 @@ void Widget::on_pushButton_clear_clicked() // 清空临时缓存目录
});
}
void Widget::on_pushButton_clearWebCache_clicked()
{
QtConcurrent::run([=]()
{
QString dataLocal = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
QDir cacheDir(dataLocal );
cacheDir.removeRecursively(); });
}
quint64 Widget::dirFileSize(const QString &path)
{
QDir dir(path);

View File

@ -91,6 +91,7 @@ private slots:
void on_pushButton_updateApt_clicked();
void on_pushButton_uninstall_clicked();
void on_pushButton_clear_clicked();
void on_pushButton_clearWebCache_clicked();
void on_pushButton_website_clicked();
void on_pushButton_clicked();
void on_btn_openDir_clicked();

View File

@ -345,7 +345,7 @@
<number>0</number>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -489,7 +489,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>903</width>
<width>889</width>
<height>849</height>
</rect>
</property>
@ -993,8 +993,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>869</width>
<height>325</height>
<width>851</width>
<height>324</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -1123,8 +1123,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>886</height>
<width>889</width>
<height>716</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -1220,7 +1220,7 @@
<string notr="true">color:#808080</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check update for Spark Store. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -1237,7 +1237,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Source Server</string>
<string>Spark Store Update</string>
</property>
</widget>
</item>
@ -1285,7 +1285,31 @@
<item>
<widget class="QWidget" name="widget_10" native="true">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="3">
<item row="2" column="0" colspan="5">
<widget class="QLabel" name="label_12">
<property name="styleSheet">
<string notr="true">color:#808080</string>
</property>
<property name="text">
<string>Since the dictionary is at /tmp,It would be cleaned automatically when system reboot.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="tmp_size_ui">
<property name="text">
<string>0B</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Location/tmp/spark-store</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -1305,16 +1329,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QLabel" name="label_12">
<property name="styleSheet">
<string notr="true">color:#808080</string>
</property>
<property name="text">
<string>Since the dictionary is at /tmp,It would be cleaned automatically when system reboot.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="maximumSize">
@ -1328,17 +1342,10 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="tmp_size_ui">
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_clearWebCache">
<property name="text">
<string>0B</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Location/tmp/spark-store</string>
<string>Clear Web Cache</string>
</property>
</widget>
</item>

View File

@ -150,7 +150,7 @@
<message>
<location filename="../src/widget.ui" line="547"/>
<location filename="../src/widget.cpp" line="910"/>
<location filename="../src/widget.cpp" line="1183"/>
<location filename="../src/widget.cpp" line="1119"/>
<source>Install</source>
<translation type="unfinished"></translation>
</message>
@ -347,11 +347,6 @@
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1223"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1233"/>
<source>Update</source>
@ -359,7 +354,7 @@
</message>
<message>
<location filename="../src/widget.ui" line="1240"/>
<source>Source Server</source>
<source>Spark Store Update</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -427,6 +422,11 @@
<source>Take effect when restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1223"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check update for Spark Store. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1334"/>
<source>0B</source>
@ -493,17 +493,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1152"/>
<source>Apt has reported an error. Please use apt update in terminal to locate the problem.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1159"/>
<source>Unknown error!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1187"/>
<location filename="../src/widget.cpp" line="1123"/>
<source>Uninstall succeeded</source>
<translation type="unfinished"></translation>
</message>
@ -518,12 +508,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1209"/>
<location filename="../src/widget.cpp" line="1145"/>
<source>Temporary cache was cleaned</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1291"/>
<location filename="../src/widget.cpp" line="1227"/>
<source>The URL has been copied to the clipboard</source>
<translation type="unfinished"></translation>
</message>

View File

@ -211,7 +211,7 @@ Nous sommes nés pour le changement.</translation>
<message>
<location filename="../src/widget.ui" line="547"/>
<location filename="../src/widget.cpp" line="910"/>
<location filename="../src/widget.cpp" line="1183"/>
<location filename="../src/widget.cpp" line="1119"/>
<source>Install</source>
<translation type="unfinished"></translation>
</message>
@ -370,7 +370,7 @@ Nous sommes nés pour le changement.</translation>
</message>
<message>
<location filename="../src/widget.ui" line="1223"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check update for Spark Store. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -380,7 +380,7 @@ Nous sommes nés pour le changement.</translation>
</message>
<message>
<location filename="../src/widget.ui" line="1240"/>
<source>Source Server</source>
<source>Spark Store Update</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -557,15 +557,15 @@ Nous sommes nés pour le changement.</translation>
<translation type="vanished">Redémarrez pour prendre effet</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;使apt工具获取软件使线&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Le rôle du serveur source est de s&apos;assurer que le logiciel est mis à jour et prend en charge l&apos;utilisation de l&apos;outil apt pour obtenir le logiciel. Nous préférons généralement que vous utilisiez la première ligne comme source de mise à jour, qui est généralement la plus stable. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source></source>
<source></source>
<translation type="vanished">Mettre à jour la source APT</translation>
</message>
<message>
<source></source>
<source></source>
<translation type="vanished">Source APT: </translation>
</message>
<message>
@ -676,27 +676,17 @@ Nous sommes nés pour le changement.</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1152"/>
<source>Apt has reported an error. Please use apt update in terminal to locate the problem.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1159"/>
<source>Unknown error!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1187"/>
<location filename="../src/widget.cpp" line="1123"/>
<source>Uninstall succeeded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1209"/>
<location filename="../src/widget.cpp" line="1145"/>
<source>Temporary cache was cleaned</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1291"/>
<location filename="../src/widget.cpp" line="1227"/>
<source>The URL has been copied to the clipboard</source>
<translation type="unfinished"></translation>
</message>

View File

@ -205,7 +205,7 @@
<message>
<location filename="../src/widget.ui" line="547"/>
<location filename="../src/widget.cpp" line="910"/>
<location filename="../src/widget.cpp" line="1183"/>
<location filename="../src/widget.cpp" line="1119"/>
<source>Install</source>
<translation></translation>
</message>
@ -379,19 +379,18 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1223"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;使apt工具获取软件使线&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Jump to the Spark app store home page to check for updates. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../src/widget.ui" line="1233"/>
<source>Update</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1240"/>
<source>Source Server</source>
<translation></translation>
<source>Spark Store Update</source>
<translation></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1260"/>
@ -476,13 +475,18 @@
<message>
<location filename="../src/widget.ui" line="912"/>
<source>Request Update</source>
<translation type="unfinished">/</translation>
<translation>/</translation>
</message>
<message>
<location filename="../src/widget.ui" line="1194"/>
<source>Take effect when restart</source>
<translation></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1223"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check update for Spark Store. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/widget.ui" line="1334"/>
<source>0B</source>
@ -518,6 +522,10 @@
<source>Not Exist</source>
<translation></translation>
</message>
<message>
<source>Update finished</source>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="139"/>
<location filename="../src/widget.cpp" line="409"/>
@ -599,14 +607,12 @@
<translation></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1152"/>
<source>Apt has reported an error. Please use apt update in terminal to locate the problem.</source>
<translation>使apt update来查看错误原因</translation>
<translation type="vanished">使apt update来查看错误原因</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1159"/>
<source>Unknown error!</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>Yes</source>
@ -656,17 +662,17 @@ Click yes to continue.</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1187"/>
<location filename="../src/widget.cpp" line="1123"/>
<source>Uninstall succeeded</source>
<translation></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1209"/>
<location filename="../src/widget.cpp" line="1145"/>
<source>Temporary cache was cleaned</source>
<translation></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="1291"/>
<location filename="../src/widget.cpp" line="1227"/>
<source>The URL has been copied to the clipboard</source>
<translation></translation>
</message>