Rename ProgressiveJob to SimpleJob

Because I had to.
This commit is contained in:
Pengfei
2021-06-28 00:20:54 +08:00
parent 3db1c43fd6
commit 817c3ea1a8
5 changed files with 24 additions and 26 deletions
+37
View File
@@ -0,0 +1,37 @@
// Copyright 2019 threeSD Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <functional>
#include <QThread>
#include "common/common_types.h"
/**
* Lightweight wrapper around QThread, for easy use with progressive jobs.
*/
class SimpleJob : public QThread {
Q_OBJECT
public:
using ProgressCallback = std::function<void(std::size_t, std::size_t)>;
using ExecuteFunc = std::function<bool(const ProgressCallback&)>;
using AbortFunc = std::function<void()>;
explicit SimpleJob(QObject* parent, ExecuteFunc execute, AbortFunc abort);
~SimpleJob() override;
void run() override;
void Cancel();
signals:
void ProgressUpdated(u64 current, u64 total);
void Completed();
void ErrorOccured();
private:
ExecuteFunc execute;
AbortFunc abort;
bool canceled{};
};