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