More error indication.

Also fixes #80.
This commit is contained in:
Black Hat 2018-10-15 06:49:30 +08:00
parent 878bcaa84d
commit babe614555
3 changed files with 16 additions and 1 deletions

View File

@ -74,6 +74,10 @@ void Controller::loginWithCredentials(QString serverAddr, QString user,
account.sync();
addConnection(m_connection);
});
connect(m_connection, &Connection::networkError,
[=](QString error, QByteArray detail) {
emit errorOccured("Network", error);
});
connect(m_connection, &Connection::loginError,
[=](QString error, QByteArray detail) {
emit errorOccured("Login Failed", error);
@ -141,6 +145,14 @@ void Controller::invokeLogin() {
c->loadState();
addConnection(c);
});
connect(c, &Connection::loginError,
[=](QString error, QByteArray detail) {
emit errorOccured("Login Failed", error);
});
connect(c, &Connection::networkError,
[=](QString error, QByteArray detail) {
emit errorOccured("Network", error);
});
c->connectWithToken(account.userId(), accessToken, account.deviceId());
}
}

View File

@ -14,6 +14,8 @@
SpectralRoom::SpectralRoom(Connection* connection, QString roomId,
JoinState joinState)
: Room(connection, std::move(roomId), joinState) {
connect(this, &Room::avatarChanged, this,
&SpectralRoom::inheritedAvatarChanged);
connect(this, &SpectralRoom::notificationCountChanged, this,
&SpectralRoom::countChanged);
connect(this, &SpectralRoom::highlightCountChanged, this,

View File

@ -10,7 +10,7 @@ using namespace QMatrixClient;
class SpectralRoom : public Room {
Q_OBJECT
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY avatarChanged)
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY inheritedAvatarChanged)
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
Q_PROPERTY(QString usersTyping READ getUsersTyping NOTIFY typingChanged)
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
@ -74,6 +74,7 @@ class SpectralRoom : public Room {
signals:
void cachedInputChanged();
void busyChanged();
void inheritedAvatarChanged(); // https://bugreports.qt.io/browse/QTBUG-7684
public slots:
void chooseAndUploadFile();