Implement (read-only for now) room settings

This commit is contained in:
miruka
2019-12-13 08:32:18 -04:00
parent f8d5260fd7
commit d240de702f
4 changed files with 139 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../Base"
@@ -43,19 +44,32 @@ HDrawer {
height: theme.baseElementsHeight
backgroundColor: "transparent"
icon.name: "room-view-" + modelData
autoExclusive: true
checked: modelData === "members"
enabled: modelData === "members"
toolTip.text: qsTr(
modelData.charAt(0).toUpperCase() + modelData.slice(1)
)
autoExclusive: true
checked: swipeView.currentIndex === index
enabled: ["members", "settings"].includes(modelData)
onClicked: swipeView.currentIndex = index
}
}
}
MemberView {
SwipeView {
id: swipeView
interactive: ! roomPane.collapsed
currentIndex: 4 // XXX
Layout.fillWidth: true
Layout.fillHeight: true
MemberView {}
Item {}
Item {}
Item {}
SettingsView {}
}
}
}

View File

@@ -0,0 +1,88 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../../Base"
import "../../utils.js" as Utils
// TODO: hide roompane until room is loaded & expand if too small
HBox {
color: "transparent"
Component.onCompleted: Utils.debug(this) // XXX
HRoomAvatar {
id: avatar
displayName: chat.roomInfo.display_name
mxc: chat.roomInfo.avatar_url
// enabled: chat.roomInfo.can_set_avatar # put this in "change avatar"
Layout.fillWidth: true
Layout.preferredHeight: width
Layout.maximumWidth: 256 * theme.uiScale
}
HTextField {
id: nameField
placeholderText: qsTr("Room name")
maximumLength: 255
text: chat.roomInfo.given_name
enabled: chat.roomInfo.can_set_name
Layout.fillWidth: true
}
HScrollableTextArea {
id: topicField
placeholderText: qsTr("Room topic")
text: chat.roomInfo.plain_topic
enabled: chat.roomInfo.can_set_topic
Layout.fillWidth: true
}
HCheckBox {
id: encryptCheckBox
text: qsTr("Encrypt messages")
subtitle.text:
qsTr("Only you and those you trust will be able to read the " +
"conversation") +
`<br><font color="${theme.colors.middleBackground}">` +
(
chat.roomInfo.encrypted ?
qsTr("Cannot be disabled") :
qsTr("Cannot be disabled later!")
) +
"</font>"
subtitle.textFormat: Text.StyledText
checked: chat.roomInfo.encrypted
enabled: chat.roomInfo.can_set_encryption && ! chat.roomInfo.encrypted
Layout.fillWidth: true
}
HCheckBox {
id: requireInviteCheckbox
text: qsTr("Require being invited")
subtitle.text: qsTr("Users will need an invite to join the room")
checked: chat.roomInfo.invite_required
enabled: chat.roomInfo.can_set_join_rules
Layout.fillWidth: true
}
HCheckBox {
text: qsTr("Forbid guests")
subtitle.text: qsTr("Users without an account won't be able to join")
checked: ! chat.roomInfo.guests_allowed
enabled: chat.roomInfo.can_set_guest_access
Layout.fillWidth: true
}
// HCheckBox { TODO
// text: qsTr("Make this room visible in the public room directory")
// checked: chat.roomInfo.published_in_directory
// Layout.fillWidth: true
// }
}