From 65c26f035bd2068e9c032d2c2672f13731883767 Mon Sep 17 00:00:00 2001 From: zty199 <46324746+zty199@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:38:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ISSUE=20#I66334=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E4=BB=8D=E6=98=BE=E7=A4=BA=20Instal?= =?UTF-8?q?ling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DownloadItem::install 中 finished 信号发送时间错误:安装操作被放入 QtConcurrent::run 中异步执行,发送信号在主线程中,安装未结束就发送了信号 Log: 调整信号发送位置至子线程中;AppIntoPage::isDownloading 中,若安装任务正在执行,需要 return,否则会出现安装后卸载再重新安装时,直接显示卸载按钮的问题 --- src/pages/appintopage.cpp | 20 +++++++++----------- src/widgets/common/downloaditem.cpp | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/pages/appintopage.cpp b/src/pages/appintopage.cpp index 010cc90..eebf953 100644 --- a/src/pages/appintopage.cpp +++ b/src/pages/appintopage.cpp @@ -196,30 +196,28 @@ void AppIntoPage::openUrl(QUrl url) void AppIntoPage::isDownloading(QUrl url) { - if(dw->getUrlList().lastIndexOf(url) == -1) - { + if (dw->getUrlList().lastIndexOf(url) == -1) { ui->downloadButton->setEnabled(true); return; - }else{ + } else { 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->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->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->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->setText(tr("Reinstall")); ui->downloadButton->show(); diff --git a/src/widgets/common/downloaditem.cpp b/src/widgets/common/downloaditem.cpp index 996b144..bff0095 100644 --- a/src/widgets/common/downloaditem.cpp +++ b/src/widgets/common/downloaditem.cpp @@ -164,11 +164,11 @@ void DownloadItem::install(int t) ui->widget_spinner->hide(); DownloadItem::isInstall = false; + emit finished(); }); - emit finished(); + // emit finished(); qDebug()<label_filename->text().toUtf8(); } - } void DownloadItem::on_pushButton_install_clicked()