|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <QGCCachedFileDownload.h>
Inheritance diagram for QGCCachedFileDownload:
Collaboration diagram for QGCCachedFileDownload:Public Slots | |
| bool | download (const QString &url, int maxCacheAgeSec) |
| bool | downloadPreferCache (const QString &url) |
| bool | downloadNoCache (const QString &url) |
| void | cancel () |
| Cancel current download. | |
| void | clearCache () |
| Clear all cached files. | |
| bool | removeFromCache (const QString &url) |
Signals | |
| void | progressChanged (qreal progress) |
| Emitted when download progress changes. | |
| void | runningChanged (bool running) |
| Emitted when running state changes. | |
| void | errorStringChanged (const QString &errorString) |
| Emitted when error string changes. | |
| void | urlChanged (const QUrl &url) |
| Emitted when URL changes. | |
| void | localPathChanged (const QString &localPath) |
| Emitted when local path changes. | |
| void | fromCacheChanged (bool fromCache) |
| Emitted when fromCache state changes. | |
| void | cacheDirectoryChanged (const QString &directory) |
| Emitted when cache directory changes. | |
| void | maxCacheSizeChanged (qint64 bytes) |
| Emitted when max cache size changes. | |
| void | cacheSizeChanged (qint64 bytes) |
| Emitted when cache size changes. | |
| void | finished (bool success, const QString &localPath, const QString &errorMessage, bool fromCache) |
| void | downloadProgress (qint64 bytesReceived, qint64 totalBytes) |
| Emitted during download with byte counts. | |
Cached file download with time-based expiration
Features:
Cache behavior:
Example C++ usage:
Example QML usage:
Definition at line 55 of file QGCCachedFileDownload.h.
|
signal |
Emitted when cache directory changes.
|
signal |
Emitted when cache size changes.
Referenced by clearCache(), and removeFromCache().
|
slot |
Cancel current download.
Definition at line 260 of file QGCCachedFileDownload.cc.
References QGCFileDownload::cancel().
|
slot |
Clear all cached files.
Definition at line 283 of file QGCCachedFileDownload.cc.
References cacheSizeChanged().
|
slot |
Download a file with cache support
| url | URL to download |
| maxCacheAgeSec | Maximum cache age in seconds (0 = any age is valid) |
Definition at line 147 of file QGCCachedFileDownload.cc.
References urlChanged().
Referenced by ComponentInformationTranslation::downloadAndTranslate().
|
slot |
Download a file, bypassing cache entirely
| url | URL to download |
Definition at line 235 of file QGCCachedFileDownload.cc.
References urlChanged().
|
slot |
Download a file, always using cache if available (no expiration check)
| url | URL to download |
Definition at line 204 of file QGCCachedFileDownload.cc.
References urlChanged().
|
signal |
Emitted during download with byte counts.
|
signal |
Emitted when error string changes.
|
signal |
Emitted when download completes
| success | true if download succeeded |
| localPath | Path to downloaded/cached file |
| errorMessage | Error message (empty on success) |
| fromCache | true if result came from cache |
Referenced by ComponentInformationTranslation::downloadAndTranslate().
|
signal |
Emitted when fromCache state changes.
|
signal |
Emitted when local path changes.
|
signal |
Emitted when max cache size changes.
|
signal |
Emitted when download progress changes.
|
slot |
Remove a specific URL from cache
| url | URL to remove |
Definition at line 290 of file QGCCachedFileDownload.cc.
References cacheSizeChanged().
|
signal |
Emitted when running state changes.
|
signal |
Emitted when URL changes.
Referenced by download(), downloadNoCache(), and downloadPreferCache().