|
QGroundControl
Ground Control Station for MAVLink Drones
|
Watches directories for new archive files and optionally auto-decompresses them. More...
#include <QGCArchiveWatcher.h>
Inheritance diagram for QGCArchiveWatcher:
Collaboration diagram for QGCArchiveWatcher:Public Types | |
| enum class | FilterMode { Archives , Compressed , Both } |
| Whether auto-decompression is enabled. More... | |
Signals | |
| void | archiveDetected (const QString &archivePath, QGCCompression::Format format) |
| void | extractionComplete (const QString &archivePath, const QString &outputPath, bool success, const QString &errorString) |
| void | autoDecompressChanged (bool autoDecompress) |
| Property change signals. | |
| void | extractingChanged (bool extracting) |
| void | progressChanged (qreal progress) |
| void | outputDirectoryChanged (const QString &directory) |
Public Member Functions | |
| QGCArchiveWatcher (QObject *parent=nullptr) | |
| ~QGCArchiveWatcher () override | |
| void | setFilterMode (FilterMode mode) |
| FilterMode | filterMode () const |
| void | setAutoDecompress (bool enable) |
| bool | autoDecompress () const |
| void | setOutputDirectory (const QString &directory) |
| QString | outputDirectory () const |
| void | setRemoveAfterExtraction (bool remove) |
| bool | removeAfterExtraction () const |
| void | setDebounceDelay (int milliseconds) |
| int | debounceDelay () const |
| bool | watchDirectory (const QString &directoryPath) |
| bool | unwatchDirectory (const QString &directoryPath) |
| QStringList | watchedDirectories () const |
| void | clear () |
| Stop watching all directories. | |
| bool | isExtracting () const |
| Check if extraction is in progress. | |
| qreal | progress () const |
| Get current extraction progress. | |
| QStringList | scanDirectory (const QString &directoryPath) const |
| void | cancelExtraction () |
| Cancel current extraction. | |
Watches directories for new archive files and optionally auto-decompresses them.
Example usage:
Definition at line 34 of file QGCArchiveWatcher.h.
|
strong |
Whether auto-decompression is enabled.
Whether an extraction is currently in progress Current extraction progress (0.0 to 1.0) Output directory for extractions (empty = same directory as archive) Filter mode for which files to watch
| Enumerator | |
|---|---|
| Archives | Watch for archive files (.zip, .tar, .tar.gz, .7z) |
| Compressed | Watch for single-file compressed (.gz, .xz, .zst, .bz2, .lz4) |
| Both | Watch for both archives and compressed files. |
Definition at line 54 of file QGCArchiveWatcher.h.
|
explicit |
Definition at line 14 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::directoryChanged(), and setDebounceDelay().
|
override |
Definition at line 24 of file QGCArchiveWatcher.cc.
References QGCCompressionJob::cancel(), and QGCCompressionJob::isRunning().
|
signal |
Emitted when an archive file is detected in a watched directory
| archivePath | Full path to the archive file |
| format | Detected format |
|
inline |
Definition at line 76 of file QGCArchiveWatcher.h.
|
signal |
Property change signals.
Referenced by setAutoDecompress().
| void QGCArchiveWatcher::cancelExtraction | ( | ) |
Cancel current extraction.
Definition at line 163 of file QGCArchiveWatcher.cc.
References QGCCompressionJob::cancel(), and QGCCompressionJob::isRunning().
| void QGCArchiveWatcher::clear | ( | ) |
Stop watching all directories.
Definition at line 122 of file QGCArchiveWatcher.cc.
References QGCCompressionJob::cancel(), QGCFileWatcher::clear(), and QGCCompressionJob::isRunning().
| int QGCArchiveWatcher::debounceDelay | ( | ) | const |
Definition at line 67 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::debounceDelay().
|
signal |
|
signal |
Emitted when extraction completes (only if autoDecompress is enabled)
| archivePath | Path to the source archive |
| outputPath | Path to extracted files/directory |
| success | true if extraction succeeded |
| errorString | Error message if failed |
|
inline |
Definition at line 71 of file QGCArchiveWatcher.h.
|
inline |
Check if extraction is in progress.
Definition at line 119 of file QGCArchiveWatcher.h.
|
inline |
Definition at line 81 of file QGCArchiveWatcher.h.
|
signal |
Referenced by setOutputDirectory().
|
inline |
Get current extraction progress.
Definition at line 122 of file QGCArchiveWatcher.h.
|
signal |
|
inline |
Definition at line 86 of file QGCArchiveWatcher.h.
| QStringList QGCArchiveWatcher::scanDirectory | ( | const QString & | directoryPath | ) | const |
Scan a directory for existing archives (useful for initial scan)
| directoryPath | Directory to scan |
Definition at line 143 of file QGCArchiveWatcher.cc.
| void QGCArchiveWatcher::setAutoDecompress | ( | bool | enable | ) |
Enable/disable automatic decompression of detected archives
| enable | true to auto-decompress, false to just emit signals |
Definition at line 41 of file QGCArchiveWatcher.cc.
References autoDecompressChanged().
| void QGCArchiveWatcher::setDebounceDelay | ( | int | milliseconds | ) |
Set debounce delay (inherited from QGCFileWatcher)
| milliseconds | Debounce delay (default 500ms for archives) |
Definition at line 62 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::setDebounceDelay().
Referenced by QGCArchiveWatcher().
| void QGCArchiveWatcher::setFilterMode | ( | FilterMode | mode | ) |
Set filter mode for which file types to watch
| mode | Filter mode |
Definition at line 36 of file QGCArchiveWatcher.cc.
| void QGCArchiveWatcher::setOutputDirectory | ( | const QString & | directory | ) |
Set output directory for extracted files
| directory | Output directory (empty = same directory as archive) |
Definition at line 49 of file QGCArchiveWatcher.cc.
References outputDirectoryChanged().
| void QGCArchiveWatcher::setRemoveAfterExtraction | ( | bool | remove | ) |
Set whether to remove archives after successful extraction
| remove | true to remove source archive after extraction |
Definition at line 57 of file QGCArchiveWatcher.cc.
| bool QGCArchiveWatcher::unwatchDirectory | ( | const QString & | directoryPath | ) |
Stop watching a directory
| directoryPath | Path to directory |
Definition at line 110 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::unwatchDirectory().
| bool QGCArchiveWatcher::watchDirectory | ( | const QString & | directoryPath | ) |
Watch a directory for archive files
| directoryPath | Path to directory to watch |
Definition at line 76 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::watchDirectory().
| QStringList QGCArchiveWatcher::watchedDirectories | ( | ) | const |
Get list of watched directories
Definition at line 117 of file QGCArchiveWatcher.cc.
References QGCFileWatcher::watchedDirectories().