mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-16 05:42:04 +08:00
由于安装操作在线程中异步执行,原始逻辑中仅判断下载完成后就检测是否还有后续任务,存在安装未结束就退出的情况 Log: 调整判断后续下载任务位置到槽函数中,每个任务安装完成结果信号触发后优先判断安装是否成功,再判断是否需要退出
69 lines
1.2 KiB
C++
69 lines
1.2 KiB
C++
#ifndef DOWNLOADITEM_H
|
|
#define DOWNLOADITEM_H
|
|
|
|
#include <QWidget>
|
|
#include <QTextBrowser>
|
|
#include <QMenu>
|
|
#include <QAction>
|
|
#include "utils/utils.h"
|
|
#include <DDialog>
|
|
DWIDGET_USE_NAMESPACE
|
|
|
|
namespace Ui {
|
|
class DownloadItem;
|
|
}
|
|
|
|
class DownloadItem : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DownloadItem(QWidget *parent = nullptr);
|
|
~DownloadItem();
|
|
|
|
int num;
|
|
bool free;
|
|
static bool isInstall;
|
|
bool reinstall;
|
|
QString speed;
|
|
QString out;
|
|
QString pkgName;
|
|
bool close;
|
|
int download;
|
|
void setValue(qint64);
|
|
void setMax(qint64);
|
|
void setName(QString);
|
|
QString getName();
|
|
int readyInstall();
|
|
|
|
void setFileName(QString);
|
|
void seticon(const QPixmap);
|
|
void closeDownload();
|
|
void setSpeed(QString);
|
|
|
|
void install(int);
|
|
|
|
private:
|
|
Ui::DownloadItem *ui;
|
|
|
|
QMenu *menu_install;
|
|
QAction *action_dpkg;
|
|
QAction *action_deepin;
|
|
QAction *action_gdebi;
|
|
|
|
DDialog *output_w;
|
|
QTextBrowser *textbrowser;
|
|
|
|
private slots:
|
|
void on_pushButton_install_clicked();
|
|
void on_pushButton_2_clicked();
|
|
void on_pushButton_3_clicked();
|
|
|
|
void slotAsyncInstall(int t);
|
|
|
|
signals:
|
|
void finished(bool success);
|
|
};
|
|
|
|
#endif // DOWNLOADITEM_H
|