Track online status per connection

This commit is contained in:
Tobias Fella
2023-11-05 22:49:36 +01:00
parent 59153be006
commit 4ef44b8e93
5 changed files with 34 additions and 30 deletions

View File

@@ -26,6 +26,11 @@ class NeoChatConnection : public Quotient::Connection
Q_PROPERTY(QString deviceKey READ deviceKey CONSTANT)
Q_PROPERTY(QString encryptionKey READ encryptionKey CONSTANT)
/**
* @brief Whether NeoChat is currently able to connect to the server.
*/
Q_PROPERTY(bool isOnline READ isOnline WRITE setIsOnline NOTIFY isOnlineChanged)
public:
NeoChatConnection(QObject *parent = nullptr);
NeoChatConnection(const QUrl &server, QObject *parent = nullptr);
@@ -73,6 +78,13 @@ public:
QString deviceKey() const;
QString encryptionKey() const;
bool isOnline() const;
Q_SIGNALS:
void labelChanged();
void isOnlineChanged();
private:
bool m_isOnline = true;
void setIsOnline(bool isOnline);
};