Make the Controller a singleton

This commit is contained in:
Tobias Fella
2020-11-04 01:43:13 +00:00
committed by Nicolas Fella
parent 1739a454da
commit 2d1a7d6500
13 changed files with 42 additions and 66 deletions

View File

@@ -46,42 +46,36 @@ Kirigami.ApplicationWindow {
}
}
Controller {
id: spectralController
quitOnLastWindowClosed: true
onErrorOccured: showPassiveNotification(error + ": " + detail)
Connections {
target: Controller
onInitiated: {
if (spectralController.accountCount === 0) {
pageStack.replace("qrc:/qml/LoginPage.qml", {
'spectralController': spectralController
});
if (Controller.accountCount === 0) {
pageStack.replace("qrc:/qml/LoginPage.qml", {});
} else {
pageStack.replace(roomListComponent);
}
}
onConnectionAdded: {
if (spectralController.accountCount === 1) {
if (Controller.accountCount === 1) {
console.log("roomListComponent")
pageStack.replace(roomListComponent);
}
}
onErrorOccured: showPassiveNotification(error + ": " + detail)
}
Binding {
target: imageProvider
property: "connection"
value: spectralController.connection
value: Controller.connection
}
RoomListModel {
id: spectralRoomListModel
connection: spectralController.connection
connection: Controller.connection
}
Component {