10#include <QtCore/QFuture>
11#include <QtCore/QFutureWatcher>
12#include <QtCore/QObject>
106 QFuture<bool>
future()
const {
return _future; }
118 const QString &outputDirectoryPath,
119 qint64 maxBytes = 0);
128 qint64 maxBytes = 0);
135 void extractArchive(
const QString &archivePath,
const QString &outputDirectoryPath,
136 qint64 maxBytes = 0);
143 qint64 maxBytes = 0);
150 qint64 maxBytes = 0);
156 void extractFile(
const QString &archivePath,
const QString &fileName,
163 void extractFiles(
const QString &archivePath,
const QStringList &fileNames,
164 const QString &outputDirectoryPath);
190 void _onProgressValueChanged(
int progressValue);
191 void _onFutureFinished();
196 void _startOperation(
Operation op,
const QString &source,
const QString &output,
199 void _setRunning(
bool running);
200 void _setErrorString(
const QString &error);
202 static QFuture<bool> _runWithProgress(WorkFunction work,
203 const std::shared_ptr<std::atomic_bool> &cancelRequested);
205 QFutureWatcher<bool> *_watcher =
nullptr;
206 QFuture<bool> _future;
208 qreal _progress = 0.0;
209 bool _running =
false;
210 QString _errorString;
214 std::shared_ptr<std::atomic_bool> _cancelRequested;
QGCCompressionJob(QObject *parent=nullptr)
void runningChanged(bool running)
Emitted when running state changes.
QString sourcePath() const
QString errorString() const
void progressChanged(qreal progress)
Emitted when progress changes (0.0 to 1.0).
void errorStringChanged(const QString &errorString)
Emitted when error string changes.
Operation currentOperation() const
Get current operation type.
void extractArchiveAtomic(const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0)
Operation
Current progress (0.0 to 1.0).
void extractFiles(const QString &archivePath, const QStringList &fileNames, const QString &outputDirectoryPath)
void extractFile(const QString &archivePath, const QString &fileName, const QString &outputPath)
void cancel()
Cancel current operation.
static QFuture< bool > extractArchiveAsync(const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0)
void sourcePathChanged(const QString &sourcePath)
Emitted when source path changes.
void finished(bool success)
void outputPathChanged(const QString &outputPath)
Emitted when output path changes.
void decompressFile(const QString &inputPath, const QString &outputPath=QString(), qint64 maxBytes=0)
QString outputPath() const
void extractArchive(const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0)
static QFuture< bool > decompressFileAsync(const QString &inputPath, const QString &outputPath=QString(), qint64 maxBytes=0)
QFuture< bool > future() const
~QGCCompressionJob() override
std::function< bool(qint64 bytesProcessed, qint64 totalBytes)> ProgressCallback