Watches directories for new archive files and optionally auto-decompresses them.
More...
#include <QGCArchiveWatcher.h>
Watches directories for new archive files and optionally auto-decompresses them.
Example usage:
[](const QString &path) {
qDebug() << "Found archive:" << path;
});
[](const QString &archive, const QString &output, bool success) {
qDebug() << "Extracted" << archive << "to" << output
<< (success ? "OK" : "FAILED");
});
void setOutputDirectory(const QString &directory)
bool watchDirectory(const QString &directoryPath)
QGCArchiveWatcher(QObject *parent=nullptr)
void setAutoDecompress(bool enable)
void extractionComplete(const QString &archivePath, const QString &outputPath, bool success, const QString &errorString)
void archiveDetected(const QString &archivePath, QGCCompression::Format format)
Definition at line 34 of file QGCArchiveWatcher.h.
◆ FilterMode
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.
◆ QGCArchiveWatcher()
| QGCArchiveWatcher::QGCArchiveWatcher |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
◆ ~QGCArchiveWatcher()
| QGCArchiveWatcher::~QGCArchiveWatcher |
( |
| ) |
|
|
override |
◆ archiveDetected
Emitted when an archive file is detected in a watched directory
- Parameters
-
| archivePath | Full path to the archive file |
| format | Detected format |
◆ autoDecompress()
| bool QGCArchiveWatcher::autoDecompress |
( |
| ) |
const |
|
inline |
◆ autoDecompressChanged
| void QGCArchiveWatcher::autoDecompressChanged |
( |
bool | autoDecompress | ) |
|
|
signal |
◆ cancelExtraction()
| void QGCArchiveWatcher::cancelExtraction |
( |
| ) |
|
◆ clear()
| void QGCArchiveWatcher::clear |
( |
| ) |
|
◆ debounceDelay()
| int QGCArchiveWatcher::debounceDelay |
( |
| ) |
const |
◆ extractingChanged
| void QGCArchiveWatcher::extractingChanged |
( |
bool | extracting | ) |
|
|
signal |
◆ extractionComplete
| void QGCArchiveWatcher::extractionComplete |
( |
const QString & | archivePath, |
|
|
const QString & | outputPath, |
|
|
bool | success, |
|
|
const QString & | errorString ) |
|
signal |
Emitted when extraction completes (only if autoDecompress is enabled)
- Parameters
-
| archivePath | Path to the source archive |
| outputPath | Path to extracted files/directory |
| success | true if extraction succeeded |
| errorString | Error message if failed |
◆ filterMode()
| FilterMode QGCArchiveWatcher::filterMode |
( |
| ) |
const |
|
inline |
◆ isExtracting()
| bool QGCArchiveWatcher::isExtracting |
( |
| ) |
const |
|
inline |
◆ outputDirectory()
| QString QGCArchiveWatcher::outputDirectory |
( |
| ) |
const |
|
inline |
◆ outputDirectoryChanged
| void QGCArchiveWatcher::outputDirectoryChanged |
( |
const QString & | directory | ) |
|
|
signal |
◆ progress()
| qreal QGCArchiveWatcher::progress |
( |
| ) |
const |
|
inline |
◆ progressChanged
| void QGCArchiveWatcher::progressChanged |
( |
qreal | progress | ) |
|
|
signal |
◆ removeAfterExtraction()
| bool QGCArchiveWatcher::removeAfterExtraction |
( |
| ) |
const |
|
inline |
◆ scanDirectory()
| QStringList QGCArchiveWatcher::scanDirectory |
( |
const QString & | directoryPath | ) |
const |
Scan a directory for existing archives (useful for initial scan)
- Parameters
-
| directoryPath | Directory to scan |
- Returns
- List of archive files found
Definition at line 143 of file QGCArchiveWatcher.cc.
◆ setAutoDecompress()
| void QGCArchiveWatcher::setAutoDecompress |
( |
bool | enable | ) |
|
◆ setDebounceDelay()
| void QGCArchiveWatcher::setDebounceDelay |
( |
int | milliseconds | ) |
|
◆ setFilterMode()
| void QGCArchiveWatcher::setFilterMode |
( |
FilterMode | mode | ) |
|
◆ setOutputDirectory()
| void QGCArchiveWatcher::setOutputDirectory |
( |
const QString & | directory | ) |
|
◆ setRemoveAfterExtraction()
| void QGCArchiveWatcher::setRemoveAfterExtraction |
( |
bool | remove | ) |
|
Set whether to remove archives after successful extraction
- Parameters
-
| remove | true to remove source archive after extraction |
Definition at line 57 of file QGCArchiveWatcher.cc.
◆ unwatchDirectory()
| bool QGCArchiveWatcher::unwatchDirectory |
( |
const QString & | directoryPath | ) |
|
Stop watching a directory
- Parameters
-
| directoryPath | Path to directory |
- Returns
- true if directory was being watched
Definition at line 110 of file QGCArchiveWatcher.cc.
◆ watchDirectory()
| bool QGCArchiveWatcher::watchDirectory |
( |
const QString & | directoryPath | ) |
|
Watch a directory for archive files
- Parameters
-
| directoryPath | Path to directory to watch |
- Returns
- true if directory was added to watch list
Definition at line 76 of file QGCArchiveWatcher.cc.
◆ watchedDirectories()
| QStringList QGCArchiveWatcher::watchedDirectories |
( |
| ) |
const |
Get list of watched directories
- Returns
- List of directory paths being watched
Definition at line 117 of file QGCArchiveWatcher.cc.
The documentation for this class was generated from the following files: