当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
work.h 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
SSSSSSSan 提交于 2022-08-01 02:12 . 兼容Qt5
#ifndef WORK_H
#define WORK_H
#include <QObject>
#include <QThreadPool>
#include <QJsonDocument>
#include <QRunnable>
#include "file.h"
#include "define.h"
#include "http.h"
struct MissionInfo
{
QString workPath="";
QString Path="";
QString MD5="";
};
class work:public QObject
{
Q_OBJECT
public:
work(QObject *parent);
~work();
bool dtIsRuning=true;
bool initdone=false;
QString workPath;
void setWorkPath(QString workPath);
void stop();
private:
QString tempPath;
QThreadPool * tpool;
QThread * twork;
QJsonDocument jdc;
void v1();
void v2();
int finishedNum=0;
int totleNum=0;
int step=0;
signals:
void signal_initdone();
void signal_start();
void signal_stop();
void signal_test();
void signal_finished();
void ui_setprogress(int step,int value);
private slots:
void slot_aMissionIsFinished();
void slot_start();
void slot_stop();
void slot_test();
};
class Mission:public QObject,public QRunnable
{
Q_OBJECT
public:
Mission(QObject * parent,MissionInfo missionInfo);
~Mission();
void run();
void stop();
private:
work * tp;
http * h=nullptr;
QFile * f=nullptr;
MissionInfo missionInfo;
QString tempPath=file::getTempPath()+"/download/";
signals:
void signal_finished();
void signal_stop();
private slots:
void slot_dlfinished();
};
#endif // WORK_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化