mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 01:58:27 +08:00
38 lines
949 B
C
38 lines
949 B
C
|
/*
|
||
|
* 重写 QThread 以实现多线程下载功能
|
||
|
*/
|
||
|
#ifndef DOWNLOADTHREAD_H
|
||
|
#define DOWNLOADTHREAD_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QThread>
|
||
|
#include <QProgressDialog>
|
||
|
#include <QListView>
|
||
|
#include <QJsonArray>
|
||
|
|
||
|
class DownloadThread : public QThread // 继承 QThread
|
||
|
{
|
||
|
public:
|
||
|
DownloadThread(QProgressDialog *dialog, QString url, QString save, QString fileName, QListView *view, bool deleteZip, bool unzip, QJsonArray *localList);
|
||
|
void SettingVirtualMachine(QString savePath);
|
||
|
QProgressDialog *dialog;
|
||
|
QString fileUrl;
|
||
|
QString fileSaveName;
|
||
|
QString fileSavePath;
|
||
|
QListView *localView;
|
||
|
QJsonArray *localJsonList;
|
||
|
bool downloadDeleteZip;
|
||
|
bool downloadUnzip;
|
||
|
|
||
|
protected:
|
||
|
void run(); // 核心
|
||
|
void ReadLocalInformation();
|
||
|
|
||
|
signals:
|
||
|
// 防止非主线程刷新控件导致程序退出
|
||
|
void MessageBoxInfo(QString info);
|
||
|
void MessageBoxError(QString info);
|
||
|
};
|
||
|
|
||
|
#endif // DOWNLOADTHREAD_H
|