Refactor startup
This commit is contained in:
20
qml/main.qml
20
qml/main.qml
@@ -312,24 +312,11 @@ Kirigami.ApplicationWindow {
|
|||||||
id: roomList
|
id: roomList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
|
||||||
target: LoginHelper
|
|
||||||
function onInitialSyncFinished() {
|
|
||||||
pageStack.replace(roomListComponent, {
|
|
||||||
activeConnection: Controller.activeConnection
|
|
||||||
});
|
|
||||||
roomListLoaded = true;
|
|
||||||
RoomManager.loadInitialRoom();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Controller
|
target: Controller
|
||||||
|
|
||||||
function onInitiated() {
|
function onInitiated() {
|
||||||
if (RoomManager.hasOpenRoom) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Controller.accountCount === 0) {
|
if (Controller.accountCount === 0) {
|
||||||
pageStack.replace("qrc:/imports/NeoChat/Page/WelcomePage.qml", {});
|
pageStack.replace("qrc:/imports/NeoChat/Page/WelcomePage.qml", {});
|
||||||
} else {
|
} else {
|
||||||
@@ -341,13 +328,6 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBusyChanged() {
|
|
||||||
if(!Controller.busy && roomListLoaded === false) {
|
|
||||||
pageStack.replace(roomListComponent);
|
|
||||||
roomListLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConnectionDropped() {
|
function onConnectionDropped() {
|
||||||
if (Controller.accountCount === 0) {
|
if (Controller.accountCount === 0) {
|
||||||
RoomManager.reset();
|
RoomManager.reset();
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ void Controller::invokeLogin()
|
|||||||
addConnection(connection);
|
addConnection(connection);
|
||||||
if (connection->userId() == id) {
|
if (connection->userId() == id) {
|
||||||
setActiveConnection(connection);
|
setActiveConnection(connection);
|
||||||
Q_EMIT initiated();
|
connectSingleShot(connection, &Connection::syncDone, this, &Controller::initiated);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(connection, &Connection::loginError, this, [=](const QString &error, const QString &) {
|
connect(connection, &Connection::loginError, this, [=](const QString &error, const QString &) {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void Login::login()
|
|||||||
});
|
});
|
||||||
|
|
||||||
connectSingleShot(m_connection, &Connection::syncDone, this, [=]() {
|
connectSingleShot(m_connection, &Connection::syncDone, this, [=]() {
|
||||||
Q_EMIT initialSyncFinished();
|
Q_EMIT Controller::instance().initiated();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,9 +185,8 @@ void Login::loginWithSso()
|
|||||||
Controller::instance().setActiveConnection(m_connection);
|
Controller::instance().setActiveConnection(m_connection);
|
||||||
m_connection = nullptr;
|
m_connection = nullptr;
|
||||||
});
|
});
|
||||||
connect(m_connection, &Connection::syncDone, this, [=]() {
|
connectSingleShot(m_connection, &Connection::syncDone, this, [=]() {
|
||||||
Q_EMIT initialSyncFinished();
|
Q_EMIT Controller::instance().initiated();
|
||||||
disconnect(m_connection, &Connection::syncDone, this, nullptr);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ Q_SIGNALS:
|
|||||||
void matrixIdChanged();
|
void matrixIdChanged();
|
||||||
void passwordChanged();
|
void passwordChanged();
|
||||||
void deviceNameChanged();
|
void deviceNameChanged();
|
||||||
void initialSyncFinished();
|
|
||||||
void loginFlowsChanged();
|
void loginFlowsChanged();
|
||||||
void ssoUrlChanged();
|
void ssoUrlChanged();
|
||||||
void connected();
|
void connected();
|
||||||
|
|||||||
Reference in New Issue
Block a user