Fix crashing when logging out.
That's a complex issue. Yay!
This commit is contained in:
@@ -2,70 +2,37 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
import Matrique 0.1
|
||||
import Matrique.Settings 0.1
|
||||
|
||||
import "component"
|
||||
import "form"
|
||||
|
||||
Page {
|
||||
// Page {
|
||||
// id: accountForm
|
||||
// parent: null
|
||||
|
||||
// padding: 64
|
||||
|
||||
// ColumnLayout {
|
||||
// RowLayout {
|
||||
// Layout.preferredHeight: 60
|
||||
|
||||
// ImageStatus {
|
||||
// Layout.preferredWidth: height
|
||||
// Layout.fillHeight: true
|
||||
|
||||
// source: matriqueController.isLogin ? connection.localUser && connection.localUser.avatarUrl ? "image://mxc/" + connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png"
|
||||
// displayText: matriqueController.isLogin && connection.localUser.displayName ? connection.localUser.displayName : ""
|
||||
// }
|
||||
|
||||
// ColumnLayout {
|
||||
// Layout.fillWidth: true
|
||||
// Layout.fillHeight: true
|
||||
|
||||
// Label {
|
||||
// font.pointSize: 18
|
||||
// text: matriqueController.isLogin ? connection.localUser.displayName : ""
|
||||
// }
|
||||
|
||||
// Label {
|
||||
// font.pointSize: 12
|
||||
// text: matriqueController.isLogin ? connection.localUser.id : ""
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Button {
|
||||
// text: "Logout"
|
||||
// highlighted: true
|
||||
|
||||
// onClicked: {
|
||||
// matriqueController.logout()
|
||||
// Qt.quit()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Page{
|
||||
property alias listModel: accountSettingsListView.model
|
||||
Page {
|
||||
id: accountForm
|
||||
|
||||
parent: null
|
||||
|
||||
// Button {
|
||||
// flat: true
|
||||
// highlighted: true
|
||||
// text: "Login"
|
||||
padding: 64
|
||||
|
||||
// onClicked: stackView.push(loginPage)
|
||||
// }
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
|
||||
id: accountSettingsListView
|
||||
|
||||
spacing: 0
|
||||
|
||||
delegate: RowLayout{
|
||||
Label {
|
||||
text: accountID
|
||||
}
|
||||
ItemDelegate {
|
||||
text: "Logout"
|
||||
onClicked: matriqueController.logout(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Page {
|
||||
|
||||
23
qml/main.qml
23
qml/main.qml
@@ -11,7 +11,7 @@ import "component"
|
||||
import "form"
|
||||
|
||||
ApplicationWindow {
|
||||
readonly property var connection: matriqueController.connection
|
||||
readonly property var currentConnection: accountListView.currentConnection ? accountListView.currentConnection : null
|
||||
|
||||
width: 960
|
||||
height: 640
|
||||
@@ -42,6 +42,11 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
AccountListModel {
|
||||
id: accountListModel
|
||||
controller: matriqueController
|
||||
}
|
||||
|
||||
Popup {
|
||||
property bool busy: matriqueController.busy
|
||||
|
||||
@@ -71,13 +76,15 @@ ApplicationWindow {
|
||||
|
||||
parent: null
|
||||
|
||||
connection: accountListView.currentConnection
|
||||
connection: currentConnection
|
||||
}
|
||||
|
||||
Setting {
|
||||
id: settingPage
|
||||
|
||||
parent: null
|
||||
|
||||
listModel: accountListModel
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -104,7 +111,7 @@ ApplicationWindow {
|
||||
|
||||
id: accountListView
|
||||
|
||||
model: AccountListModel { controller: matriqueController }
|
||||
model: accountListModel
|
||||
|
||||
spacing: 0
|
||||
|
||||
@@ -176,7 +183,7 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
onAccepted: matriqueController.createRoom(addRoomDialogNameTextField.text, addRoomDialogTopicTextField.text)
|
||||
onAccepted: matriqueController.createRoom(currentConnection, addRoomDialogNameTextField.text, addRoomDialogTopicTextField.text)
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
@@ -202,7 +209,7 @@ ApplicationWindow {
|
||||
placeholderText: "#matrix:matrix.org"
|
||||
}
|
||||
|
||||
onAccepted: matriqueController.joinRoom(joinRoomDialogTextField.text)
|
||||
onAccepted: matriqueController.joinRoom(currentConnection, joinRoomDialogTextField.text)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +236,7 @@ ApplicationWindow {
|
||||
placeholderText: "@bot:matrix.org"
|
||||
}
|
||||
|
||||
onAccepted: matriqueController.createDirectChat(directChatDialogTextField.text)
|
||||
onAccepted: currentConnection.createDirectChat(directChatDialogTextField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,13 +290,13 @@ ApplicationWindow {
|
||||
|
||||
id: stackView
|
||||
|
||||
initialItem: roomPage
|
||||
// initialItem: roomPage
|
||||
}
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: imageProvider
|
||||
property: "connection"
|
||||
value: accountListView.currentConnection
|
||||
value: currentConnection
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user