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
13{
14
22class ALBERT_EXPORT Download : public QObject
23{
24 Q_OBJECT
25public:
26
30 Download(const QUrl &url, const QString &path, QObject *parent = nullptr);
31
36
46 static std::shared_ptr<Download> unique(const QUrl &url, const QString &path);
47
53 const QUrl &url();
54
60 const QString &path();
61
67 bool isActive();
68
74 const QString &error();
75
81 void start();
82
83signals:
84
88 void finished();
89
90private:
91
92 class Private;
93 std::unique_ptr<Private> d;
94
95};
96
97}
Downloads a file from the given URL to the given path.
Definition download.h:23
Download(const QUrl &url, const QString &path, QObject *parent=nullptr)
Constructs a download with the given url, path and parent.
bool isActive()
Returns true if the download is active.
~Download()
Destructs this download.
void start()
Starts the download.
const QString & path()
Returns the destination path of the download.
static std::shared_ptr< Download > unique(const QUrl &url, const QString &path)
Returns a unique download for url and path.
void finished()
Emitted when the download has finished.
const QString & error()
Returns the error of the download, if any.
const QUrl & url()
Returns the url of the download.
Definition app.h:56