File indexing completed on 2024-10-06 10:25:58

0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include <QFile>
0007 #include <QNetworkReply>
0008 
0009 class TestReply : public QNetworkReply
0010 {
0011 public:
0012     TestReply(const QString &jsonFile, QObject *parent)
0013         : QNetworkReply(parent)
0014     {
0015         setError(NetworkError::NoError, QString());
0016         setFinished(true);
0017 
0018         apiResult.setFileName(QLatin1String(DATA_DIR) + QLatin1Char('/') + jsonFile);
0019         apiResult.open(QIODevice::ReadOnly);
0020     }
0021 
0022     qint64 readData(char *data, qint64 maxSize) override
0023     {
0024         return apiResult.read(data, maxSize);
0025     }
0026 
0027     void abort() override
0028     {
0029     }
0030 
0031     QFile apiResult;
0032 };