-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhelperreply.h
42 lines (33 loc) · 935 Bytes
/
helperreply.h
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
33
34
35
36
37
38
39
40
41
42
// SPDX-FileCopyrightText: 2022 Carl Schwan <[email protected]>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include <QFile>
#include <QNetworkReply>
class TestReply : public QNetworkReply
{
public:
TestReply(const QString &jsonFile, QObject *parent)
: QNetworkReply(parent)
{
setError(NetworkError::NoError, QString());
setFinished(true);
apiResult.setFileName(QLatin1String(DATA_DIR "/%1").arg(jsonFile));
apiResult.open(QIODevice::ReadOnly);
}
qint64 readData(char *data, qint64 maxSize) override
{
return apiResult.read(data, maxSize);
}
bool seek(const qint64 pos) override
{
return apiResult.seek(pos);
}
void abort() override
{
}
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
{
QNetworkReply::setRawHeader(headerName, value);
}
QFile apiResult;
};