Support Qt 5.11 and fix image provider.

This commit is contained in:
Black Hat
2018-07-07 17:38:20 +08:00
parent a850224c98
commit 17fa7cc7da
24 changed files with 666 additions and 808 deletions

View File

@@ -2,9 +2,7 @@
#define CONTROLLER_H
#include <QObject>
#include "libqmatrixclient/connection.h"
#include "roomlistmodel.h"
namespace QMatrixClient {
@@ -15,25 +13,27 @@ class Controller : public QObject
{
Q_OBJECT
Q_PROPERTY(QMatrixClient::Connection *connection READ getConnection WRITE setConnection NOTIFY connectionChanged)
Q_PROPERTY(QMatrixClient::Connection* connection READ getConnection NOTIFY connectionChanged)
Q_PROPERTY(bool isLogin READ getIsLogin WRITE setIsLogin NOTIFY isLoginChanged)
Q_PROPERTY(QString homeserver READ getHomeserver WRITE setHomeserver NOTIFY homeserverChanged)
Q_PROPERTY(QString userID READ getUserID WRITE setUserID NOTIFY userIDChanged)
Q_PROPERTY(QByteArray token READ getToken WRITE setToken NOTIFY tokenChanged)
Q_PROPERTY(bool busy READ getBusy WRITE setBusy NOTIFY busyChanged)
public:
explicit Controller(QObject *parent = nullptr);
~Controller();
// All the Q_INVOKABLEs.
Q_INVOKABLE void login(QString, QString, QString);
Q_INVOKABLE void login();
Q_INVOKABLE void loginWithCredentials(QString, QString, QString);
Q_INVOKABLE void logout();
// All the non-Q_INVOKABLE functions.
// All the Q_PROPERTYs.
QMatrixClient::Connection* m_connection;
QMatrixClient::Connection* m_connection = new QMatrixClient::Connection();
QMatrixClient::Connection* getConnection() { return m_connection; }
void setConnection(QMatrixClient::Connection* conn);
bool isLogin = false;
bool getIsLogin() { return isLogin; }
@@ -62,6 +62,24 @@ class Controller : public QObject
}
}
QString homeserver;
QString getHomeserver() { return homeserver; }
void setHomeserver(QString n) {
if (n != homeserver) {
homeserver = n;
emit homeserverChanged();
}
}
bool busy = false;
bool getBusy() { return busy; }
void setBusy(bool b) {
if (b != busy) {
busy = b;
emit busyChanged();
}
}
private:
void connected();
void resync();
@@ -72,7 +90,9 @@ class Controller : public QObject
void isLoginChanged();
void userIDChanged();
void tokenChanged();
void homeServerChanged();
void homeserverChanged();
void busyChanged();
void errorOccured();
public slots:
};