Skip to content
Snippets Groups Projects
Commit 0922a8e4 authored by Jedi18's avatar Jedi18
Browse files

add room alias delegate, fix some quickswitcher ui problems

parent 32d419d1
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -161,6 +162,30 @@ Popup {
DelegateChoice {
roleValue: "room"
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
}
}
}
DelegateChoice {
roleValue: "roomAliases"
RowLayout {
id: del
......
......@@ -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;
......
......@@ -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
......@@ -570,6 +570,11 @@ TimelineViewManager::completerFor(QString completerName, QString roomId)
emojiModel->setParent(proxy);
return proxy;
} else if (completerName == "room") {
auto roomModel = new RoomsModel(false);
auto proxy = new CompletionProxyModel(roomModel);
roomModel->setParent(proxy);
return proxy;
} else if (completerName == "roomAliases") {
auto roomModel = new RoomsModel(true);
auto proxy = new CompletionProxyModel(roomModel);
roomModel->setParent(proxy);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment