digiKam
onlineversiondwnl.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2020-12-31
7  * Description : Online version downloader.
8  *
9  * Copyright (C) 2020-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_ONLINE_VERSION_DWNL_H
25 #define DIGIKAM_ONLINE_VERSION_DWNL_H
26 
27 // Qt includes
28 
29 #include <QNetworkReply>
30 #include <QUrl>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 
36 namespace Digikam
37 {
38 
39 class DIGIKAM_EXPORT OnlineVersionDwnl : public QObject
40 {
41  Q_OBJECT
42 
43 public:
44 
45  explicit OnlineVersionDwnl(QObject* const parent = nullptr,
46  bool checkPreRelease = false,
47  bool updateWithDebug = false);
48  ~OnlineVersionDwnl() override;
49 
50  void startDownload(const QString& version);
51  void cancelDownload();
52 
53  QString downloadedPath() const;
54 
55  QString downloadUrl() const;
56 
57 Q_SIGNALS:
58 
59  void signalDownloadError(const QString& error);
60  void signalDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
62 
63 private Q_SLOTS:
64 
65  void slotDownloaded(QNetworkReply* reply);
66 
67 private:
68 
69  void download(const QUrl& url);
70 
71 private:
72 
73  class Private;
74  Private* const d;
75 };
76 
77 } // namespace Digikam
78 
79 #endif // DIGIKAM_ONLINE_VERSION_DWNL_H
Definition: onlineversiondwnl.h:40
void signalDownloadError(const QString &error)
void signalDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
Definition: datefolderview.cpp:43