mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 00:38:58 +00:00
Rename ProgressiveJob to SimpleJob
Because I had to.
This commit is contained in:
@@ -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{};
|
||||
};
|
||||
Reference in New Issue
Block a user