File indexing completed on 2025-01-19 03:56:08

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2020-12-31
0007  * Description : Online version downloader.
0008  *
0009  * SPDX-FileCopyrightText: 2020-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ONLINE_VERSION_DWNL_H
0016 #define DIGIKAM_ONLINE_VERSION_DWNL_H
0017 
0018 // Qt includes
0019 
0020 #include <QNetworkReply>
0021 #include <QUrl>
0022 
0023 // Local includes
0024 
0025 #include "digikam_export.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DIGIKAM_EXPORT OnlineVersionDwnl : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     explicit OnlineVersionDwnl(QObject* const parent = nullptr,
0037                                bool checkPreRelease = false,
0038                                bool updateWithDebug = false);
0039     ~OnlineVersionDwnl() override;
0040 
0041     void startDownload(const QString& version);
0042     void cancelDownload();
0043 
0044     QString downloadedPath() const;
0045 
0046     QString downloadUrl()    const;
0047 
0048 Q_SIGNALS:
0049 
0050     void signalDownloadError(const QString& error);
0051     void signalDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
0052     void signalComputeChecksum();
0053 
0054 private Q_SLOTS:
0055 
0056     void slotDownloaded(QNetworkReply* reply);
0057 
0058 private:
0059 
0060     void download(const QUrl& url);
0061 
0062 private:
0063 
0064     class Private;
0065     Private* const d;
0066 };
0067 
0068 } // namespace Digikam
0069 
0070 #endif // DIGIKAM_ONLINE_VERSION_DWNL_H