Files
frelay/Gui/Form/Transform.h

77 lines
1.4 KiB
C
Raw Normal View History

2025-06-16 23:41:35 +08:00
#ifndef TRANSFORM_H
2025-06-16 20:06:49 +08:00
#define TRANSFORM_H
#include <ClientCore.h>
2025-06-18 14:53:56 +08:00
#include <FileTrans.h>
2025-06-16 20:06:49 +08:00
#include <QDialog>
2025-06-16 23:41:35 +08:00
#include <QFile>
2025-06-18 14:53:56 +08:00
#include <QThread>
2025-06-16 20:06:49 +08:00
namespace Ui {
class TransForm;
}
2025-06-18 14:53:56 +08:00
class TranFromTh;
2025-06-16 20:06:49 +08:00
class TransForm : public QDialog
{
Q_OBJECT
public:
explicit TransForm(QWidget* parent = nullptr);
~TransForm();
public:
void SetClientCore(ClientCore* clientCore);
2025-06-18 13:18:31 +08:00
void SetTasks(const QVector<TransTask>& tasks);
2025-06-18 14:53:56 +08:00
void startTask();
signals:
void sigProgress(double val);
void sigFailed();
void sigDone();
void sigSetUi(const TransTask& task);
2025-06-20 09:45:39 +08:00
void sigTaskNum(const QString& data);
2025-06-16 20:06:49 +08:00
private:
2025-06-18 14:53:56 +08:00
void setProgress(double val);
void handleFailed();
void handleDone();
void handleUI(const TransTask& task);
2025-06-20 09:45:39 +08:00
void showNum(const QString& data);
2025-06-18 13:18:31 +08:00
protected:
void showEvent(QShowEvent* event) override;
2025-06-19 22:07:12 +08:00
void closeEvent(QCloseEvent* event) override;
2025-06-18 13:18:31 +08:00
private:
2025-06-19 17:01:25 +08:00
bool exis_{ false };
2025-06-18 14:53:56 +08:00
TranFromTh* workTh_{};
2025-06-20 09:45:39 +08:00
qint32 curTaskNum_{ 0 };
2025-06-18 13:18:31 +08:00
QVector<TransTask> tasks_;
FileTrans* fileTrans_{};
ClientCore* clientCore_{};
2025-06-16 20:06:49 +08:00
Ui::TransForm* ui;
};
2025-06-18 14:53:56 +08:00
class TranFromTh : public QThread
{
Q_OBJECT
public:
explicit TranFromTh(TransForm* tf, QObject* parent = nullptr) : QThread(parent), tf_(tf)
{
}
protected:
void run() override
{
if (tf_) {
tf_->startTask();
}
}
private:
TransForm* tf_;
};
2025-06-16 20:06:49 +08:00
#endif // TRANSFORM_H