summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-22 00:01:50 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-22 00:01:50 +0530
commit0922a8e4c755dec9170820ae6263a1fc3122468c (patch)
tree2b9a19f7eaf7e12890434766e52eb28e6bf532a7 /resources/qml
parentadd quick switcher qml file and moved completerFor from inputbar to timeline ... (diff)
downloadnheko-0922a8e4c755dec9170820ae6263a1fc3122468c.tar.xz
add room alias delegate, fix some quickswitcher ui problems
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/Completer.qml29
-rw-r--r--resources/qml/MessageInput.qml2
-rw-r--r--resources/qml/QuickSwitcher.qml18
3 files changed, 41 insertions, 8 deletions
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml
index ec5030e7..76e08e7e 100644
--- a/resources/qml/Completer.qml
+++ b/resources/qml/Completer.qml
@@ -11,6 +11,7 @@ Popup {
     property string completerName
     property var completer
     property bool bottomToTop: true
+    property bool fullWidth: false
     property alias count: listView.count
 
     signal completionClicked(string completion)
@@ -75,14 +76,14 @@ Popup {
         id: listView
 
         anchors.fill: parent
-        implicitWidth: contentItem.childrenRect.width
+        implicitWidth: fullWidth ? parent.width : contentItem.childrenRect.width
         model: completer
         verticalLayoutDirection: popup.bottomToTop ? ListView.BottomToTop : ListView.TopToBottom
 
         delegate: Rectangle {
             color: model.index == popup.currentIndex ? colors.highlight : colors.base
             height: chooser.childrenRect.height + 4
-            implicitWidth: chooser.childrenRect.width + 4
+            implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
 
             MouseArea {
                 id: mouseArea
@@ -178,6 +179,30 @@ Popup {
                             color: model.index == popup.currentIndex ? colors.highlightedText : colors.text
                         }
 
+                    }
+
+                }
+
+                DelegateChoice {
+                    roleValue: "roomAliases"
+
+                    RowLayout {
+                        id: del
+
+                        anchors.centerIn: parent
+
+                        Avatar {
+                            height: 24
+                            width: 24
+                            url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
+                            onClicked: popup.completionClicked(completer.completionAt(model.index))
+                        }
+
+                        Label {
+                            text: model.roomName
+                            color: model.index == popup.currentIndex ? colors.highlightedText : colors.text
+                        }
+
                         Label {
                             text: "(" + model.roomAlias + ")"
                             color: model.index == popup.currentIndex ? colors.highlightedText : colors.buttonText
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 7ecaf81a..e6b6762d 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -184,7 +184,7 @@ Rectangle {
                         messageInput.openCompleter(cursorPosition, "emoji");
                         popup.open();
                     } else if (event.key == Qt.Key_NumberSign) {
-                        messageInput.openCompleter(cursorPosition, "room");
+                        messageInput.openCompleter(cursorPosition, "roomAliases");
                         popup.open();
                     } else if (event.key == Qt.Key_Escape && popup.opened) {
                         completerTriggeredAt = -1;
diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml
index 317c96b3..ca7a5eeb 100644
--- a/resources/qml/QuickSwitcher.qml
+++ b/resources/qml/QuickSwitcher.qml
@@ -6,17 +6,16 @@ Popup {
     x: parent.width / 2 - width / 2
     y: parent.height / 4 - height / 2
     width: parent.width / 2
-    height: 100
     modal: true
-    focus: true
     closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
     parent: Overlay.overlay
 
     TextInput {
         id: roomTextInput
 
-        anchors.fill: parent
         focus: true
+        anchors.fill: parent
+        color: colors.text
 
         onTextEdited: {
             completerPopup.completer.setSearchString(text)
@@ -26,13 +25,22 @@ Popup {
     Completer {
         id: completerPopup
 
-        x: roomTextInput.x + 100
-        y: roomTextInput.y - 20
+        x: roomTextInput.x
+        y: roomTextInput.y + parent.height
+        width: parent.width
         completerName: "room"
         bottomToTop: true
+        fullWidth: true
+
+        closePolicy: Popup.NoAutoClose
     }
 
     onOpened: {
         completerPopup.open()
+        roomTextInput.forceActiveFocus()
+    }
+
+    onClosed: {
+        completerPopup.close()
     }
 }
\ No newline at end of file