aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/downloadfilejob.h
blob: 588584489c8d7b04d1c783a4415059aa69d35d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "csapi/content-repo.h"

namespace QMatrixClient
{
class DownloadFileJob : public GetContentJob
{
public:
    enum
    {
        FileError = BaseJob::UserDefinedError + 1
    };

    using GetContentJob::makeRequestUrl;
    static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri);

    DownloadFileJob(const QString& serverName, const QString& mediaId,
                    const QString& localFilename = {});

    QString targetFileName() const;

private:
    class Private;
    QScopedPointer<Private> d;

    void beforeStart(const ConnectionData*) override;
    void afterStart(const ConnectionData*, QNetworkReply* reply) override;
    void beforeAbandon(QNetworkReply*) override;
    Status parseReply(QNetworkReply*) override;
};
} // namespace QMatrixClient