File indexing completed on 2024-10-06 07:38:13
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.1-or-later 0003 0004 #pragma once 0005 0006 #include <QtQml> 0007 0008 class QNetworkReply; 0009 0010 class NetworkRequestProgress : public QObject 0011 { 0012 Q_OBJECT 0013 QML_ELEMENT 0014 0015 Q_PROPERTY(QNetworkReply *reply READ reply WRITE setReply NOTIFY replyChanged) 0016 0017 Q_PROPERTY(bool uploading READ uploading NOTIFY progressChanged) 0018 Q_PROPERTY(int progress READ progress NOTIFY progressChanged) 0019 0020 public: 0021 explicit NetworkRequestProgress(QObject *parent = nullptr); 0022 0023 QNetworkReply *reply() const; 0024 void setReply(QNetworkReply *reply); 0025 0026 bool uploading() const; 0027 0028 int progress() const; 0029 void setProgress(int progress); 0030 0031 Q_SIGNALS: 0032 void replyChanged(); 0033 void progressChanged(); 0034 0035 private: 0036 QNetworkReply *m_reply = nullptr; 0037 int m_progress = 0; 0038 };