Working public room directory.

Fix "no known servers".
Rename all QMatrixClient to Quotient.
This commit is contained in:
Black Hat
2019-12-25 19:53:50 +08:00
parent 9d2dc3e96a
commit d25a9fb3a4
14 changed files with 297 additions and 161 deletions

View File

@@ -97,14 +97,14 @@ Dialog {
Layout.preferredHeight: 48
color: MPalette.foreground
icon: "\ue7ff"
icon: "\ue5d2"
}
Label {
Layout.fillWidth: true
color: MPalette.foreground
text: "Start a Chat"
text: "Explore Rooms"
}
}
@@ -113,7 +113,7 @@ Dialog {
onPrimaryClicked: {
joinRoomDialog.createObject(ApplicationWindow.overlay, {"controller": spectralController, "connection": spectralController.connection}).open()
root.destroy()
root.close()
}
}
}

View File

@@ -21,7 +21,7 @@ Dialog {
id: root
title: "Start a Chat"
title: "Explore Rooms"
contentItem: ColumnLayout {
spacing: 0
@@ -30,17 +30,39 @@ Dialog {
Layout.fillWidth: true
AutoTextField {
property bool isRoomAlias: text.match(/#(.+):(.+)/g)
property var room: isRoomAlias ? connection.roomByAlias(text) : null
property bool isJoined: room != null
Layout.fillWidth: true
id: identifierField
placeholderText: "Room Alias/User ID"
placeholderText: "Find a room..."
Keys.onReturnPressed: {
onEditingFinished: {
keyword = text
}
}
Button {
id: joinButton
visible: identifierField.isRoomAlias
text: identifierField.isJoined ? "View" : "Join"
highlighted: true
flat: identifierField.isJoined
onClicked: {
if (identifierField.isJoined) {
roomListForm.joinRoom(identifierField.room)
} else {
spectralController.joinRoom(connection, identifierField.text)
}
}
}
ComboBox {
Layout.maximumWidth: 120
@@ -88,14 +110,13 @@ Dialog {
keyword: root.keyword
}
delegate: Item {
delegate: Control {
width: publicRoomsListView.width
height: 40
height: 48
RowLayout {
anchors.fill: parent
anchors.margins: 4
padding: 8
contentItem: RowLayout {
spacing: 8
Avatar {
@@ -109,20 +130,52 @@ Dialog {
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
spacing: 0
Label {
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
text: name
color: MPalette.foreground
font.pixelSize: 13
textFormat: Text.PlainText
elide: Text.ElideRight
wrapMode: Text.NoWrap
spacing: 4
Label {
Layout.fillWidth: true
Layout.fillHeight: true
text: name
color: MPalette.foreground
font.pixelSize: 13
textFormat: Text.PlainText
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
Label {
visible: allowGuests
text: "GUESTS CAN JOIN"
color: MPalette.lighter
font.pixelSize: 10
padding: 4
background: Rectangle {
color: MPalette.banner
}
}
Label {
visible: worldReadable
text: "WORLD READABLE"
color: MPalette.lighter
font.pixelSize: 10
padding: 4
background: Rectangle {
color: MPalette.banner
}
}
}
Label {
@@ -139,10 +192,67 @@ Dialog {
wrapMode: Text.NoWrap
}
}
}
RippleEffect {
anchors.fill: parent
MaterialIcon {
Layout.preferredWidth: 16
Layout.preferredHeight: 16
icon: "\ue7fc"
color: MPalette.lighter
font.pixelSize: 16
}
Label {
Layout.preferredWidth: 36
text: memberCount
color: MPalette.lighter
font.pixelSize: 12
}
Control {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
visible: isJoined
contentItem: MaterialIcon {
icon: "\ue89e"
color: MPalette.lighter
font.pixelSize: 20
}
background: RippleEffect {
circular: true
onClicked: {
roomListForm.joinRoom(connection.room(roomID))
root.close()
}
}
}
Control {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
visible: !isJoined
contentItem: MaterialIcon {
icon: "\ue7f0"
color: MPalette.lighter
font.pixelSize: 20
}
background: RippleEffect {
circular: true
onClicked: {
spectralController.joinRoom(connection, roomID)
root.close()
}
}
}
}
}
@@ -155,17 +265,5 @@ Dialog {
}
}
// standardButtons: Dialog.Ok | Dialog.Cancel
// onAccepted: {
// var identifier = identifierField.text
// var firstChar = identifier.charAt(0)
// if (firstChar == "@") {
// spectralController.createDirectChat(spectralController.connection, identifier)
// } else if (firstChar == "!" || firstChar == "#") {
// spectralController.joinRoom(spectralController.connection, identifier)
// }
// }
onClosed: destroy()
}