summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorMalte E <malte.e@mailbox.org>2022-03-25 22:30:19 +0100
committerMalte E <malte.e@mailbox.org>2022-03-25 22:30:19 +0100
commitb8b31cb36d886fa50f29a2ec9789d7e4844fd5a1 (patch)
tree6954923599e4d07956401a8fe2dfafafd9baef72 /resources/qml
parentRelease v0.9.3 (diff)
downloadnheko-b8b31cb36d886fa50f29a2ec9789d7e4844fd5a1.tar.xz
CreateRoom dialog in QML
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/RoomList.qml13
-rw-r--r--resources/qml/dialogs/CreateRoom.qml81
2 files changed, 93 insertions, 1 deletions
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index 702d77e5..eb518f40 100644
--- a/resources/qml/RoomList.qml
+++ b/resources/qml/RoomList.qml
@@ -26,6 +26,13 @@ Page {
 
     }
 
+    Component {
+        id: createRoomComponent
+
+        CreateRoom {
+        }
+    }
+
     ListView {
         id: roomlist
 
@@ -648,7 +655,11 @@ Page {
 
                         Platform.MenuItem {
                             text: qsTr("Create a new room")
-                            onTriggered: Nheko.openCreateRoomDialog()
+                            onTriggered: {
+                                var createRoom = createRoomComponent.createObject(timelineRoot);
+                                createRoom.show();
+                                timelineRoot.destroyOnClose(createRoom);
+                            }
                         }
 
                     }
diff --git a/resources/qml/dialogs/CreateRoom.qml b/resources/qml/dialogs/CreateRoom.qml
new file mode 100644
index 00000000..843d10c8
--- /dev/null
+++ b/resources/qml/dialogs/CreateRoom.qml
@@ -0,0 +1,81 @@
+// SPDX-FileCopyrightText: 2021 Nheko Contributors
+// SPDX-FileCopyrightText: 2022 Nheko Contributors
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import ".."
+import QtQuick 2.15
+import QtQuick.Window 2.13
+import QtQuick.Layouts 1.3
+import QtQuick.Controls 2.3
+import im.nheko 1.0
+
+ApplicationWindow {
+    id: createRoomRoot
+    title: qsTr("Create Room")
+    minimumWidth: rootLayout.implicitWidth+2*rootLayout.anchors.margins
+    minimumHeight: rootLayout.implicitHeight+footer.implicitHeight+2*rootLayout.anchors.margins
+    GridLayout {
+        id: rootLayout
+        anchors.fill: parent
+        anchors.margins: Nheko.paddingSmall
+        columns: 2
+        MatrixTextField {
+            id: newRoomName
+            Layout.columnSpan: 2
+            Layout.fillWidth: true
+
+            focus: true
+            placeholderText: qsTr("Name")
+        }
+        MatrixTextField {
+            id: newRoomTopic
+            Layout.columnSpan: 2
+            Layout.fillWidth: true
+
+            focus: true
+            placeholderText: qsTr("Topic")
+        }
+        MatrixTextField {
+            id: newRoomAlias
+            Layout.columnSpan: 2
+            Layout.fillWidth: true
+
+            focus: true
+            placeholderText: qsTr("Alias")
+        }
+        Label {
+            Layout.preferredWidth: implicitWidth
+            Layout.alignment: Qt.AlignLeft
+            text: qsTr("Room Visibility")
+            color: Nheko.colors.text
+        }
+        ComboBox {
+            id: newRoomVisibility
+            Layout.preferredWidth: implicitWidth
+            Layout.alignment: Qt.AlignRight
+            model: [qsTr("Private"), qsTr("Public")]
+        }
+        Label {
+            Layout.preferredWidth: implicitWidth
+            Layout.alignment: Qt.AlignLeft
+            text: qsTr("Room Preset")
+            color: Nheko.colors.text
+        }
+        ComboBox {
+            id: newRoomPreset
+            Layout.preferredWidth: implicitWidth
+            Layout.alignment: Qt.AlignRight
+            model: [qsTr("Private Chat"), qsTr("Public Chat"), qsTr("Trusted Private Chat")]
+        }
+    }
+    footer: DialogButtonBox {
+        standardButtons: DialogButtonBox.Cancel
+        Button {
+            text: "CreateRoom"
+            DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+        }
+        onRejected: createRoomRoot.close();
+        //onAccepted: createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, newRoomVisibility.index, newRoomPreset.index)
+    }
+}