Add busy property to controller.
This commit is contained in:
@@ -122,6 +122,7 @@ void Controller::addConnection(Connection* c) {
|
||||
c->setLazyLoading(true);
|
||||
|
||||
connect(c, &Connection::syncDone, this, [=] {
|
||||
setBusy(false);
|
||||
emit syncDone();
|
||||
c->sync(30000);
|
||||
c->saveState();
|
||||
@@ -130,7 +131,9 @@ void Controller::addConnection(Connection* c) {
|
||||
|
||||
using namespace QMatrixClient;
|
||||
|
||||
c->sync(30000);
|
||||
setBusy(true);
|
||||
|
||||
c->sync();
|
||||
|
||||
emit connectionAdded(c);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class Controller : public QObject {
|
||||
setQuitOnLastWindowClosed NOTIFY quitOnLastWindowClosedChanged)
|
||||
Q_PROPERTY(Connection* connection READ connection WRITE setConnection NOTIFY
|
||||
connectionChanged)
|
||||
Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
|
||||
|
||||
public:
|
||||
explicit Controller(QObject* parent = nullptr);
|
||||
@@ -53,6 +54,12 @@ class Controller : public QObject {
|
||||
}
|
||||
}
|
||||
|
||||
bool busy() { return m_busy; }
|
||||
void setBusy(bool busy) {
|
||||
m_busy = busy;
|
||||
emit busyChanged();
|
||||
}
|
||||
|
||||
Connection* connection() {
|
||||
if (m_connection.isNull())
|
||||
return nullptr;
|
||||
@@ -69,6 +76,7 @@ class Controller : public QObject {
|
||||
private:
|
||||
QVector<Connection*> m_connections;
|
||||
QPointer<Connection> m_connection;
|
||||
bool m_busy = false;
|
||||
|
||||
QByteArray loadAccessTokenFromFile(const AccountSettings& account);
|
||||
QByteArray loadAccessTokenFromKeyChain(const AccountSettings& account);
|
||||
|
||||
Reference in New Issue
Block a user