|
QGroundControl
Ground Control Station for MAVLink Drones
|
QObject wrapper for compression operations with progress signals. More...
#include <QGCCompressionJob.h>
Inheritance diagram for QGCCompressionJob:
Collaboration diagram for QGCCompressionJob:Public Types | |
| enum class | Operation { None , ExtractArchive , ExtractArchiveAtomic , DecompressFile , ExtractFile , ExtractFiles } |
| Current progress (0.0 to 1.0) More... | |
Public Slots | |
| void | extractArchive (const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0) |
| void | extractArchiveAtomic (const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0) |
| void | decompressFile (const QString &inputPath, const QString &outputPath=QString(), qint64 maxBytes=0) |
| void | extractFile (const QString &archivePath, const QString &fileName, const QString &outputPath) |
| void | extractFiles (const QString &archivePath, const QStringList &fileNames, const QString &outputDirectoryPath) |
| void | cancel () |
| Cancel current operation. | |
Signals | |
| void | progressChanged (qreal progress) |
| Emitted when progress changes (0.0 to 1.0) | |
| void | runningChanged (bool running) |
| Emitted when running state changes. | |
| void | finished (bool success) |
| void | errorStringChanged (const QString &errorString) |
| Emitted when error string changes. | |
| void | sourcePathChanged (const QString &sourcePath) |
| Emitted when source path changes. | |
| void | outputPathChanged (const QString &outputPath) |
| Emitted when output path changes. | |
Public Member Functions | |
| QGCCompressionJob (QObject *parent=nullptr) | |
| ~QGCCompressionJob () override | |
| qreal | progress () const |
| bool | isRunning () const |
| QString | errorString () const |
| QString | sourcePath () const |
| QString | outputPath () const |
| Operation | currentOperation () const |
| Get current operation type. | |
| QFuture< bool > | future () const |
Static Public Member Functions | |
| static QFuture< bool > | extractArchiveAsync (const QString &archivePath, const QString &outputDirectoryPath, qint64 maxBytes=0) |
| static QFuture< bool > | decompressFileAsync (const QString &inputPath, const QString &outputPath=QString(), qint64 maxBytes=0) |
QObject wrapper for compression operations with progress signals.
Uses QtConcurrent and QPromise for modern async operations Can be used from C++ or QML
Example C++ usage:
Example QML usage:
Alternative: Use static async methods that return QFuture directly:
Definition at line 59 of file QGCCompressionJob.h.
|
strong |
Current progress (0.0 to 1.0)
Whether an operation is currently running Error string from last failed operation (empty if last operation succeeded) Source path for current/last operation Output path for current/last operation Operation type
| Enumerator | |
|---|---|
| None | |
| ExtractArchive | |
| ExtractArchiveAtomic | |
| DecompressFile | |
| ExtractFile | |
| ExtractFiles | |
Definition at line 81 of file QGCCompressionJob.h.
|
explicit |
Definition at line 14 of file QGCCompressionJob.cc.
|
override |
Definition at line 24 of file QGCCompressionJob.cc.
References cancel().
|
slot |
Cancel current operation.
Definition at line 129 of file QGCCompressionJob.cc.
Referenced by QGCFileDownload::cancel(), QGCArchiveWatcher::cancelExtraction(), FTPController::cancelExtraction(), QGCArchiveWatcher::clear(), QGCArchiveWatcher::~QGCArchiveWatcher(), and ~QGCCompressionJob().
|
inline |
Get current operation type.
Definition at line 102 of file QGCCompressionJob.h.
|
slot |
Decompress single compressed file (.gz, .xz, etc.)
| inputPath | Path to compressed file |
| outputPath | Path for decompressed output (empty = auto-detect) |
| maxBytes | Maximum decompressed size (0 = unlimited) |
Definition at line 94 of file QGCCompressionJob.cc.
References QGCCompression::Auto, QGCCompression::decompressFile(), DecompressFile, outputPath(), and progress().
|
static |
Decompress file asynchronously, returns QFuture with progress support
| inputPath | Path to compressed file |
| outputPath | Path for decompressed output (empty = auto-detect) |
| maxBytes | Maximum decompressed size (0 = unlimited) |
Definition at line 50 of file QGCCompressionJob.cc.
References QGCCompression::Auto, QGCCompression::decompressFile(), outputPath(), and progress().
|
inline |
Definition at line 97 of file QGCCompressionJob.h.
|
signal |
Emitted when error string changes.
|
slot |
Extract archive to directory (non-atomic, faster)
| archivePath | Path to archive file |
| outputDirectoryPath | Directory to extract to |
| maxBytes | Maximum decompressed size (0 = unlimited) |
Definition at line 68 of file QGCCompressionJob.cc.
References QGCCompression::Auto, QGCCompression::extractArchive(), ExtractArchive, and progress().
Referenced by FTPController::extractArchive(), QGCMapEngineManager::importArchive(), and PlanMasterController::loadFromArchive().
|
static |
Extract archive asynchronously, returns QFuture with progress support
| archivePath | Path to archive file |
| outputDirectoryPath | Directory to extract to |
| maxBytes | Maximum decompressed size (0 = unlimited) |
Definition at line 36 of file QGCCompressionJob.cc.
References QGCCompression::Auto, QGCCompression::extractArchive(), and progress().
|
slot |
Extract archive atomically (all-or-nothing, safer)
| archivePath | Path to archive file |
| outputDirectoryPath | Directory to extract to |
| maxBytes | Maximum decompressed size (0 = unlimited) |
Definition at line 81 of file QGCCompressionJob.cc.
References QGCCompression::Auto, QGCCompression::extractArchiveAtomic(), ExtractArchiveAtomic, and progress().
|
slot |
Extract single file from archive
| archivePath | Path to archive file |
| fileName | Name of file inside archive |
| outputPath | Output file path |
Definition at line 107 of file QGCCompressionJob.cc.
References QGCCompression::extractFile(), ExtractFile, and outputPath().
|
slot |
Extract multiple files from archive
| archivePath | Path to archive file |
| fileNames | Names of files inside archive |
| outputDirectoryPath | Output directory |
Definition at line 118 of file QGCCompressionJob.cc.
References QGCCompression::extractFiles(), and ExtractFiles.
|
signal |
Emitted when operation completes
| success | true if operation succeeded |
Referenced by FTPController::extractArchive(), QGCMapEngineManager::importArchive(), and PlanMasterController::loadFromArchive().
|
inline |
Get the QFuture for the current operation (for advanced use) Returns invalid future if no operation is running
Definition at line 106 of file QGCCompressionJob.h.
|
inline |
Definition at line 96 of file QGCCompressionJob.h.
Referenced by QGCFileDownload::cancel(), QGCArchiveWatcher::cancelExtraction(), QGCArchiveWatcher::clear(), and QGCArchiveWatcher::~QGCArchiveWatcher().
|
inline |
Definition at line 99 of file QGCCompressionJob.h.
Referenced by decompressFile(), decompressFileAsync(), and extractFile().
|
signal |
Emitted when output path changes.
|
inline |
Definition at line 95 of file QGCCompressionJob.h.
Referenced by decompressFile(), decompressFileAsync(), extractArchive(), extractArchiveAsync(), and extractArchiveAtomic().
|
signal |
Emitted when progress changes (0.0 to 1.0)
Referenced by FTPController::extractArchive(), and QGCMapEngineManager::importArchive().
|
signal |
Emitted when running state changes.
|
inline |
Definition at line 98 of file QGCCompressionJob.h.
|
signal |
Emitted when source path changes.