Make the Controller a singleton
This commit is contained in:
committed by
Nicolas Fella
parent
1739a454da
commit
2d1a7d6500
@@ -31,9 +31,7 @@ Dialog {
|
||||
|
||||
spacing: 16
|
||||
|
||||
model: AccountListModel{
|
||||
controller: spectralController
|
||||
}
|
||||
model: AccountListModel{ }
|
||||
|
||||
delegate: Kirigami.Avatar {
|
||||
width: 48
|
||||
@@ -48,13 +46,13 @@ Dialog {
|
||||
MenuItem {
|
||||
text: "Mark all as read"
|
||||
|
||||
onClicked: spectralController.markAllMessagesAsRead(connection)
|
||||
onClicked: Controller.markAllMessagesAsRead(connection)
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Logout"
|
||||
|
||||
onClicked: spectralController.logout(connection)
|
||||
onClicked: Controller.logout(connection)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +61,7 @@ Dialog {
|
||||
|
||||
circular: true
|
||||
|
||||
onPrimaryClicked: spectralController.connection = connection
|
||||
onPrimaryClicked: Controller.connection = connection
|
||||
onSecondaryClicked: contextMenu.popup()
|
||||
}
|
||||
}
|
||||
@@ -113,7 +111,7 @@ Dialog {
|
||||
anchors.fill: parent
|
||||
|
||||
onPrimaryClicked: {
|
||||
joinRoomDialog.createObject(ApplicationWindow.overlay, {"controller": spectralController, "connection": spectralController.connection}).open()
|
||||
joinRoomDialog.createObject(ApplicationWindow.overlay, {"connection": Controller.connection}).open()
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
@@ -143,7 +141,7 @@ Dialog {
|
||||
anchors.fill: parent
|
||||
|
||||
onPrimaryClicked: {
|
||||
startChatDialog.createObject(ApplicationWindow.overlay, {"controller": spectralController, "connection": spectralController.connection}).open()
|
||||
startChatDialog.createObject(ApplicationWindow.overlay, {"connection": Controller.connection}).open()
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
import Spectral.Component 2.0
|
||||
|
||||
import Spectral 0.1
|
||||
|
||||
Dialog {
|
||||
anchors.centerIn: parent
|
||||
width: 360
|
||||
@@ -32,7 +34,7 @@ Dialog {
|
||||
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
onAccepted: spectralController.createRoom(spectralController.connection, roomNameField.text, roomTopicField.text)
|
||||
onAccepted: Controller.createRoom(Controller.connection, roomNameField.text, roomTopicField.text)
|
||||
|
||||
onClosed: destroy()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import Spectral.Setting 0.1
|
||||
import Spectral 0.1
|
||||
|
||||
Dialog {
|
||||
property var controller
|
||||
property var room
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
@@ -10,7 +10,6 @@ import Spectral.Setting 0.1
|
||||
import Spectral 0.1
|
||||
|
||||
Dialog {
|
||||
property var controller
|
||||
property var connection
|
||||
|
||||
property string keyword
|
||||
@@ -59,7 +58,7 @@ Dialog {
|
||||
if (identifierField.isJoined) {
|
||||
roomListForm.joinRoom(identifierField.room)
|
||||
} else {
|
||||
controller.joinRoom(connection, identifierField.text)
|
||||
Controller.joinRoom(connection, identifierField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,7 +248,7 @@ Dialog {
|
||||
circular: true
|
||||
|
||||
onClicked: {
|
||||
controller.joinRoom(connection, roomID)
|
||||
Controller.joinRoom(connection, roomID)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import Spectral.Component 2.0
|
||||
import Spectral.Effect 2.0
|
||||
import Spectral.Setting 0.1
|
||||
|
||||
import Spectral 0.1
|
||||
|
||||
Dialog {
|
||||
property var room
|
||||
|
||||
@@ -168,7 +170,7 @@ Dialog {
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
roomListForm.enteredRoom = spectralController.connection.room(room.predecessorId)
|
||||
roomListForm.enteredRoom = Controller.connection.room(room.predecessorId)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
@@ -219,7 +221,7 @@ Dialog {
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
roomListForm.enteredRoom = spectralController.connection.room(room.successorId)
|
||||
roomListForm.enteredRoom = Controller.connection.room(room.successorId)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import Spectral.Setting 0.1
|
||||
import Spectral 0.1
|
||||
|
||||
Dialog {
|
||||
property var controller
|
||||
property var connection
|
||||
|
||||
anchors.centerIn: parent
|
||||
@@ -47,7 +46,7 @@ Dialog {
|
||||
highlighted: true
|
||||
|
||||
onClicked: {
|
||||
controller.createDirectChat(connection, identifierField.text)
|
||||
Controller.createDirectChat(connection, identifierField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +156,7 @@ Dialog {
|
||||
circular: true
|
||||
|
||||
onClicked: {
|
||||
controller.createDirectChat(connection, userID)
|
||||
Controller.createDirectChat(connection, userID)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user