File indexing completed on 2024-07-21 12:44:00

0001 // SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later OR GPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003 
0004 #pragma once
0005 
0006 #include <QObject>
0007 
0008 class NetworkController : public QObject
0009 {
0010     Q_OBJECT
0011 public:
0012     static NetworkController &instance();
0013     Q_INVOKABLE void setApplicationProxy();
0014 
0015     void openWebApLink(QString url);
0016 
0017 Q_SIGNALS:
0018     void networkErrorOccurred(const QString &errorString);
0019     void openPost(QString id);
0020     void openAccount(QString id);
0021 
0022 private:
0023     explicit NetworkController(QObject *parent = nullptr);
0024 
0025     void openLink();
0026 
0027     QString m_requestedLink;
0028     bool m_accountsReady = false;
0029 };