Albert
Loading...
Searching...
No Matches
download.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Manuel Schneider
2// SPDX-License-Identifier: MIT
3
4#pragma once
5#include <QObject>
6#include <albert/export.h>
7#include <memory>
8class QNetworkReply;
9class QString;
10class QUrl;
11
12namespace albert::util
13{
14
17class ALBERT_EXPORT Download : public QObject
18{
19 Q_OBJECT
20public:
21
23 Download(const QUrl &url, const QString &path, QObject *parent = nullptr);
25
31 static std::shared_ptr<Download> unique(const QUrl &url, const QString &path);
32
34 const QUrl &url();
35
37 const QString &path();
38
40 bool isActive();
41
43 const QString &error();
44
48 void start();
49
50signals:
51
52 void finished();
53
54private:
55
56 class Private;
57 std::unique_ptr<Private> d;
58
59};
60
61}
Downloads a file from the given URL to the given path.
Definition download.h:18
static std::shared_ptr< Download > unique(const QUrl &url, const QString &path)
Returns a unique download for url and path.
const QUrl & url()
Returns the url of the download. Threadsafe.
const QString & error()
Returns the error of the download, if any. Threadsafe.
void start()
Starts the download.
Download(const QUrl &url, const QString &path, QObject *parent=nullptr)
Constructs a download with the given url and path. Threadsafe.
const QString & path()
Returns the destination path of the download. Threadsafe.
bool isActive()
Returns true if the download is active. Threadsafe.
Albert utility namespace.
Definition albert.h:14