Skip to content

Commit

Permalink
Added progress handler for wind and HTTP downloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
albar965 committed Jul 20, 2021
1 parent ef0739c commit 9da5919
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/atools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const static QChar SEP(QDir::separator());

QString version()
{
return "3.7.3.develop"; // VERSION_NUMBER - atools
return "3.7.4.develop"; // VERSION_NUMBER - atools
}

QString gitRevision()
Expand Down
2 changes: 2 additions & 0 deletions src/fs/weather/weatherdownloadbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ WeatherDownloadBase::WeatherDownloadBase(QObject *parent, MetarFormat format, bo

connect(downloader, &atools::util::HttpDownloader::downloadSslErrors,
this, &WeatherDownloadBase::weatherDownloadSslErrors);
connect(downloader, &atools::util::HttpDownloader::downloadProgress,
this, &WeatherDownloadBase::weatherDownloadProgress);

errorStateTimer.setSingleShot(true);
errorStateTimer.setInterval(180 * 1000);
Expand Down
3 changes: 3 additions & 0 deletions src/fs/weather/weatherdownloadbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class WeatherDownloadBase :
/* Emitted on SSL errors. Call setIgnoreSslErrors to ignore future errors and continue. */
void weatherDownloadSslErrors(const QStringList& errors, const QString& downloadUrl);

/* Emitted during download */
void weatherDownloadProgress(qint64 bytesReceived, qint64 bytesTotal, QString downloadUrl);

protected:
virtual void startDownload();

Expand Down
1 change: 1 addition & 0 deletions src/grib/gribdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ GribDownloader::GribDownloader(QObject *parent, bool logVerbose = false)
connect(downloader, &HttpDownloader::downloadFinished, this, &GribDownloader::downloadFinished);
connect(downloader, &HttpDownloader::downloadFailed, this, &GribDownloader::downloadFailed);
connect(downloader, &HttpDownloader::downloadSslErrors, this, &GribDownloader::gribDownloadSslErrors);
connect(downloader, &HttpDownloader::downloadProgress, this, &GribDownloader::gribDownloadProgress);
}

GribDownloader::~GribDownloader()
Expand Down
2 changes: 2 additions & 0 deletions src/grib/gribdownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class GribDownloader :
/* Emitted on SSL errors. Call setIgnoreSslErrors to ignore future errors and continue. */
void gribDownloadSslErrors(const QStringList& errors, const QString& downloadUrl);

void gribDownloadProgress(qint64 bytesReceived, qint64 bytesTotal, QString downloadUrl);

private:
void downloadFinished(const QByteArray& data, QString downloadUrl);
void downloadFailed(const QString& error, int errorCode, QString downloadUrl);
Expand Down
1 change: 1 addition & 0 deletions src/grib/windquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ WindQuery::WindQuery(QObject *parentObject, bool logVerbose)
connect(downloader, &GribDownloader::gribDownloadFinished, this, &WindQuery::gribDownloadFinished);
connect(downloader, &GribDownloader::gribDownloadFailed, this, &WindQuery::gribDownloadFailed);
connect(downloader, &GribDownloader::gribDownloadSslErrors, this, &WindQuery::windDownloadSslErrors);
connect(downloader, &GribDownloader::gribDownloadProgress, this, &WindQuery::windDownloadProgress);

// Set up file watcher for file based updates
fileWatcher = new atools::util::FileSystemWatcher(parentObject, logVerbose);
Expand Down
2 changes: 2 additions & 0 deletions src/grib/windquery.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class WindQuery
/* Emitted on SSL errors. Call setIgnoreSslErrors to ignore future errors and continue. */
void windDownloadSslErrors(const QStringList& errors, const QString& downloadUrl);

void windDownloadProgress(qint64 bytesReceived, qint64 bytesTotal, QString downloadUrl);

private:
/* Wind for grid position */
WindData windForLayer(const WindAltLayer& layer, const QPoint& point) const;
Expand Down

0 comments on commit 9da5919

Please sign in to comment.