File indexing completed on 2024-12-08 10:25:49
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqolacore_export.h" 0010 #include <QObject> 0011 #include <QSslError> 0012 class QNetworkAccessManager; 0013 class QNetworkReply; 0014 class LIBRUQOLACORE_EXPORT DownloadAvartarUrlManager : public QObject 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit DownloadAvartarUrlManager(QObject *parent = nullptr); 0019 ~DownloadAvartarUrlManager() override; 0020 0021 [[nodiscard]] bool canStart() const; 0022 void start(); 0023 0024 [[nodiscard]] QString avatarUrl() const; 0025 void setAvatarUrl(const QString &avatarUrl); 0026 Q_SIGNALS: 0027 void avatarDownloaded(const QByteArray &data, const QString &avatarUrl); 0028 0029 private: 0030 LIBRUQOLACORE_NO_EXPORT void slotFileDownloaded(QNetworkReply *reply); 0031 LIBRUQOLACORE_NO_EXPORT void slotSslErrors(QNetworkReply *reply, const QList<QSslError> &error); 0032 QString mAvatarUrl; 0033 QNetworkAccessManager *const mNetworkAccessManager; 0034 };