Merge branch 'dev' into Reason

This commit is contained in:
2023-03-13 00:35:43 +08:00
5 changed files with 112 additions and 106 deletions

View File

@@ -194,13 +194,15 @@ void DownloadItem::slotAsyncInstall(int t)
out = installer.readAllStandardOutput();
QStringList everyOut = out.split("\n");
QString tempOutput;
for (int i = 0; i < everyOut.size(); i++)
{
if(everyOut[i].left(2) == "E:")
tempOutput = everyOut[i];
if (everyOut[i].left(2) == "E:" || tempOutput.contains("错误") || tempOutput.contains("exit code") || tempOutput.contains("OMG-IT-GOES-WRONG"))
{
haveError = true;
}
if(everyOut[i].right(14) == "Not authorized")
if (tempOutput.contains("Not authorized"))
{
notRoot = true;
}
@@ -208,12 +210,12 @@ void DownloadItem::slotAsyncInstall(int t)
QProcess isInstall;
isInstall.start("dpkg", QStringList() << "-s" << pkgName);
isInstall.waitForFinished(180*1000); // 默认超时 3 分钟
isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if (error == 0 && !haveError)
{
ui->pushButton_install->hide();
Utils::sendNotification("spark-store",tr("Spark Store"),ui->label->text() + " " + tr("Installation complete."));
Utils::sendNotification("spark-store", tr("Spark Store"), ui->label->text() + " " + tr("Installation complete."));
ui->label_2->setText(tr("Finish"));
ui->label_2->setToolTip(tr("Finish"));
download = 3;
@@ -224,7 +226,7 @@ void DownloadItem::slotAsyncInstall(int t)
ui->pushButton_install->show();
ui->pushButton_install->setText(tr("Retry"));
download = 1;
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Error happened in dpkg progress , you can try it again."));
Utils::sendNotification("spark-store", tr("Spark Store"), tr("Error happened in dpkg progress , you can try it again."));
ui->label_2->setText(tr("Error happened in dpkg progress , you can try it again"));
ui->label_2->setToolTip(tr("Error happened in dpkg progress , you can try it again"));
ui->pushButton_3->show();
@@ -232,7 +234,7 @@ void DownloadItem::slotAsyncInstall(int t)
if (notRoot)
{
Utils::sendNotification("spark-store",tr("Spark Store"),tr("dpkg progress had been abortedyou can retry installation."));
Utils::sendNotification("spark-store", tr("Spark Store"), tr("dpkg progress had been abortedyou can retry installation."));
ui->label_2->setText(tr("dpkg progress had been abortedyou can retry installation"));
ui->label_2->setToolTip(tr("dpkg progress had been abortedyou can retry installation"));
ui->pushButton_install->show();
@@ -241,5 +243,9 @@ void DownloadItem::slotAsyncInstall(int t)
ui->widget_spinner->hide();
DownloadItem::isInstall = false;
installer.deleteLater();
isInstall.deleteLater();
emit finished(error == 0 && !haveError && !notRoot);
}