digiKam
Loading...
Searching...
No Matches
filesdownloader.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-11-14
7 * Description : Files downloader
8 *
9 * SPDX-FileCopyrightText: 2020-2024 by Maik Qualmann <metzpinguin at gmail dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QDialog>
20#include <QSettings>
21
22// Local includes
23
24#include "digikam_export.h"
25
26class QNetworkReply;
27
28namespace Digikam
29{
30
31// ----------------------------------------------------------------------------
32
33class DIGIKAM_EXPORT DownloadInfo
34{
35public:
36
37 DownloadInfo() = default;
38 DownloadInfo(const QString& _path,
39 const QString& _name,
40 const QString& _hash,
41 const qint64& _size);
42 DownloadInfo(const DownloadInfo& other);
43 ~DownloadInfo() = default;
44
45 DownloadInfo& operator=(const DownloadInfo& other);
46
50 QString path;
51
55 QString name;
56
60 QString hash;
61
65 qint64 size = 0;
66};
67
68// ----------------------------------------------------------------------------
69
70class DIGIKAM_EXPORT FilesDownloader : public QDialog
71{
72 Q_OBJECT
73
74public:
75
76 explicit FilesDownloader(QWidget* const parent = nullptr);
77 ~FilesDownloader() override;
78
79 bool checkDownloadFiles() const;
80 void startDownload();
81
82private:
83
84 void download();
85 void nextDownload();
86 void createRequest(const QUrl& url);
87 void printDownloadInfo(const QUrl& url);
88 bool downloadExists(const DownloadInfo& info) const;
89
90 QString getFacesEnginePath() const;
91 void createDownloadInfo();
92
93private Q_SLOTS:
94
95 void reject() override;
96 void slotDownload();
97 void slotHelp();
98 void slotUpdateDownloadInfo();
99 void slotDownloaded(QNetworkReply* reply);
100 void slotDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
101
102private:
103
104 // Disable
105 FilesDownloader(const FilesDownloader&) = delete;
106 FilesDownloader& operator=(const FilesDownloader&) = delete;
107
108private:
109
110 class Private;
111 Private* const d = nullptr;
112};
113
114} // namespace Digikam
Definition filesdownloader.h:34
QString hash
Definition filesdownloader.h:60
QString path
Definition filesdownloader.h:50
QString name
Definition filesdownloader.h:55
Definition filesdownloader.h:71
Definition datefolderview.cpp:34