fix: 修复安装不成功时,关闭主窗口会直接退出,且重启后没有记录的问题

由于安装操作在线程中异步执行,原始逻辑中仅判断下载完成后就检测是否还有后续任务,存在安装未结束就退出的情况

Log: 调整判断后续下载任务位置到槽函数中,每个任务安装完成结果信号触发后优先判断安装是否成功,再判断是否需要退出
This commit is contained in:
zty199
2023-03-04 22:42:08 +08:00
parent 1543d75339
commit b99225bd3c
4 changed files with 34 additions and 22 deletions

View File

@@ -64,9 +64,9 @@ QString DownloadItem::getName()
/***************************************************************
* @brief 告知界面,准备安装
* @param
* @param
* @note 如果正在安装,返回-1
* @Sample usage: DownloadItem::install(0);
* @Sample usage: DownloadItem::install(0);
**************************************************************/
int DownloadItem::readyInstall()
{
@@ -110,9 +110,9 @@ void DownloadItem::setSpeed(QString s)
/***************************************************************
* @brief 安装当前应用
* @param int t, t为安装方式可以为 0,1,2
* @param int t, t为安装方式可以为 0,1,2
* @note 执行这个函数时,需要已经检查是否可以安装,但该函数仍然会再检测一次!
* @Sample usage: DownloadItem::install(0);
* @Sample usage: DownloadItem::install(0);
**************************************************************/
void DownloadItem::install(int t)
{
@@ -165,9 +165,9 @@ void DownloadItem::on_pushButton_3_clicked()
/***************************************************************
* @brief 实际安装应用
* @param int t, t为安装方式可以为 0,1,2
* @param int t, t为安装方式可以为 0,1,2
* @note 备注
* @Sample usage: slotAsyncInstall(0);
* @Sample usage: slotAsyncInstall(0);
**************************************************************/
void DownloadItem::slotAsyncInstall(int t)
{
@@ -238,5 +238,5 @@ void DownloadItem::slotAsyncInstall(int t)
ui->widget_spinner->hide();
DownloadItem::isInstall = false;
emit finished();
emit finished(error == 0 && !haveError && !notRoot);
}