diff --git a/qml/component/RoomDrawer.qml b/qml/component/RoomDrawer.qml
new file mode 100644
index 0000000..e852bd9
--- /dev/null
+++ b/qml/component/RoomDrawer.qml
@@ -0,0 +1,163 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.2
+import QtQuick.Controls.Material 2.2
+import QtQuick.Layouts 1.3
+import Matrique 0.1
+
+Drawer {
+ property var room
+
+ id: roomDrawer
+
+ edge: Qt.RightEdge
+ interactive: false
+
+ ToolButton {
+ contentItem: MaterialIcon { icon: "\ue5c4" }
+
+ onClicked: roomDrawer.close()
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 32
+
+ ImageStatus {
+ Layout.preferredWidth: 64
+ Layout.preferredHeight: 64
+ Layout.alignment: Qt.AlignHCenter
+
+ source: room && room.avatarUrl != "" ? "image://mxc/" + room.avatarUrl : null
+ displayText: room ? room.displayName : ""
+ }
+
+ Label {
+ Layout.fillWidth: true
+
+ horizontalAlignment: Text.AlignHCenter
+ text: room && room.id ? room.id : ""
+ }
+
+ Label {
+ Layout.fillWidth: true
+
+ horizontalAlignment: Text.AlignHCenter
+ text: room && room.canonicalAlias ? room.canonicalAlias : "No Canonical Alias"
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+
+ TextField {
+ Layout.fillWidth: true
+
+ id: roomNameField
+ text: room && room.name ? room.name : ""
+ }
+
+ ItemDelegate {
+ Layout.preferredWidth: height
+ Layout.preferredHeight: parent.height
+
+ contentItem: MaterialIcon { icon: "\ue5ca" }
+
+ onClicked: room.setName(roomNameField.text)
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+
+ TextField {
+ Layout.fillWidth: true
+
+ id: roomTopicField
+
+ text: room && room.topic ? room.topic : ""
+ }
+
+ ItemDelegate {
+ Layout.preferredWidth: height
+ Layout.preferredHeight: parent.height
+
+ contentItem: MaterialIcon { icon: "\ue5ca" }
+
+ onClicked: room.setTopic(roomTopicField.text)
+ }
+ }
+
+ ListView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ clip: true
+
+ boundsBehavior: Flickable.DragOverBounds
+
+ delegate: ItemDelegate {
+ width: parent.width
+ height: 48
+
+ RowLayout {
+ anchors.fill: parent
+ anchors.margins: 8
+ spacing: 12
+
+ ImageStatus {
+ Layout.preferredWidth: height
+ Layout.fillHeight: true
+
+ source: avatar != "" ? "image://mxc/" + avatar : ""
+ displayText: name
+ }
+
+ Label {
+ Layout.fillWidth: true
+
+ text: name
+ }
+ }
+ }
+
+ model: UserListModel {
+ id: userListModel
+
+ room: roomDrawer.room
+ }
+
+ ScrollBar.vertical: ScrollBar {}
+ }
+
+ Button {
+ Layout.fillWidth: true
+
+ text: "Invite User"
+ flat: true
+ highlighted: true
+
+ onClicked: inviteUserDialog.open()
+
+ Dialog {
+ x: (window.width - width) / 2
+ y: (window.height - height) / 2
+ width: 360
+
+ id: inviteUserDialog
+
+ parent: ApplicationWindow.overlay
+
+ title: "Input User ID"
+ modal: true
+ standardButtons: Dialog.Ok | Dialog.Cancel
+
+ contentItem: TextField {
+ id: inviteUserDialogTextField
+ placeholderText: "@bot:matrix.org"
+ }
+
+ onAccepted: room.inviteToRoom(inviteUserDialogTextField.text)
+ }
+ }
+ }
+}
+
diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml
index ffce4fa..aabc4a3 100644
--- a/qml/form/RoomForm.qml
+++ b/qml/form/RoomForm.qml
@@ -15,133 +15,13 @@ Item {
id: item
- UserListModel {
- id: userListModel
-
- room: currentRoom
- }
-
- Drawer {
+ RoomDrawer {
width: Math.min(item.width * 0.7, 480)
height: item.height
id: roomDrawer
- edge: Qt.RightEdge
- interactive: false
-
- ToolButton {
- contentItem: MaterialIcon { icon: "\ue5c4" }
-
- onClicked: roomDrawer.close()
- }
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 32
-
- ImageStatus {
- Layout.preferredWidth: 64
- Layout.preferredHeight: 64
- Layout.alignment: Qt.AlignHCenter
-
- source: currentRoom && currentRoom.avatarUrl != "" ? "image://mxc/" + currentRoom.avatarUrl : null
- displayText: currentRoom ? currentRoom.displayName : ""
- }
-
- Label {
- Layout.fillWidth: true
-
- horizontalAlignment: Text.AlignHCenter
- text: currentRoom && currentRoom.id ? currentRoom.id : ""
- }
-
- Label {
- Layout.fillWidth: true
-
- horizontalAlignment: Text.AlignHCenter
- text: currentRoom && currentRoom.canonicalAlias ? currentRoom.canonicalAlias : "No Canonical Alias"
- }
-
- RowLayout {
- Layout.fillWidth: true
-
- TextField {
- Layout.fillWidth: true
-
- id: roomNameField
- text: currentRoom && currentRoom.name ? currentRoom.name : ""
- }
-
- ItemDelegate {
- Layout.preferredWidth: height
- Layout.preferredHeight: parent.height
-
- contentItem: MaterialIcon { icon: "\ue5ca" }
-
- onClicked: currentRoom.setName(roomNameField.text)
- }
- }
-
- RowLayout {
- Layout.fillWidth: true
-
- TextField {
- Layout.fillWidth: true
-
- id: roomTopicField
-
- text: currentRoom && currentRoom.topic ? currentRoom.topic : ""
- }
-
- ItemDelegate {
- Layout.preferredWidth: height
- Layout.preferredHeight: parent.height
-
- contentItem: MaterialIcon { icon: "\ue5ca" }
-
- onClicked: currentRoom.setTopic(roomTopicField.text)
- }
- }
-
- ListView {
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- clip: true
-
- boundsBehavior: Flickable.DragOverBounds
-
- delegate: ItemDelegate {
- width: parent.width
- height: 48
-
- RowLayout {
- anchors.fill: parent
- anchors.margins: 8
- spacing: 12
-
- ImageStatus {
- Layout.preferredWidth: height
- Layout.fillHeight: true
-
- source: avatar != "" ? "image://mxc/" + avatar : ""
- displayText: name
- }
-
- Label {
- Layout.fillWidth: true
-
- text: name
- }
- }
- }
-
- model: userListModel
-
- ScrollBar.vertical: ScrollBar {}
- }
- }
+ room: currentRoom
}
Pane {
diff --git a/res.qrc b/res.qrc
index 71c1cf5..300bca8 100644
--- a/res.qrc
+++ b/res.qrc
@@ -29,5 +29,6 @@
qml/component/GenericBubble.qml
qml/component/StateDelegate.qml
qml/component/AutoLabel.qml
+ qml/component/RoomDrawer.qml