fix: ISSUE #I66334 安装结束后仍显示 Installing

DownloadItem::install 中 finished 信号发送时间错误:安装操作被放入 QtConcurrent::run 中异步执行,发送信号在主线程中,安装未结束就发送了信号

Log: 调整信号发送位置至子线程中;AppIntoPage::isDownloading 中,若安装任务正在执行,需要 return,否则会出现安装后卸载再重新安装时,直接显示卸载按钮的问题
This commit is contained in:
zty199
2022-12-19 17:38:41 +08:00
parent ba331cb3fb
commit 65c26f035b
2 changed files with 11 additions and 13 deletions

View File

@@ -196,30 +196,28 @@ void AppIntoPage::openUrl(QUrl url)
void AppIntoPage::isDownloading(QUrl url) void AppIntoPage::isDownloading(QUrl url)
{ {
if(dw->getUrlList().lastIndexOf(url) == -1) if (dw->getUrlList().lastIndexOf(url) == -1) {
{
ui->downloadButton->setEnabled(true); ui->downloadButton->setEnabled(true);
return; return;
}else{ } else {
ui->downloadButton->setEnabled(false); ui->downloadButton->setEnabled(false);
} }
if(dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 2)
{ ui->pushButton_3->hide();
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 2) {
ui->downloadButton->setEnabled(true); ui->downloadButton->setEnabled(true);
ui->downloadButton->setText(tr("Download")); ui->downloadButton->setText(tr("Download"));
} }
if(dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 1) if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 1) {
{
ui->downloadButton->setEnabled(true); ui->downloadButton->setEnabled(true);
ui->downloadButton->setText(tr("Install")); ui->downloadButton->setText(tr("Install"));
} }
if(dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->isInstall) if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->isInstall) {
{
ui->downloadButton->setEnabled(false); ui->downloadButton->setEnabled(false);
ui->downloadButton->setText(tr("Installing")); ui->downloadButton->setText(tr("Installing"));
return;
} }
if(dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 3) if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 3) {
{
ui->downloadButton->setEnabled(true); ui->downloadButton->setEnabled(true);
ui->downloadButton->setText(tr("Reinstall")); ui->downloadButton->setText(tr("Reinstall"));
ui->downloadButton->show(); ui->downloadButton->show();

View File

@@ -164,11 +164,11 @@ void DownloadItem::install(int t)
ui->widget_spinner->hide(); ui->widget_spinner->hide();
DownloadItem::isInstall = false; DownloadItem::isInstall = false;
emit finished();
}); });
emit finished(); // emit finished();
qDebug()<<ui->label_filename->text().toUtf8(); qDebug()<<ui->label_filename->text().toUtf8();
} }
} }
void DownloadItem::on_pushButton_install_clicked() void DownloadItem::on_pushButton_install_clicked()