2019-11-07 09:50:59 -04:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../../Base"
|
2019-11-07 11:08:47 -04:00
|
|
|
import "../../utils.js" as Utils
|
2019-11-07 09:50:59 -04:00
|
|
|
|
|
|
|
HBox {
|
|
|
|
id: addChatBox
|
|
|
|
clickButtonOnEnter: "create"
|
|
|
|
|
|
|
|
onFocusChanged: nameField.forceActiveFocus()
|
|
|
|
|
|
|
|
buttonModel: [
|
|
|
|
{ name: "apply", text: qsTr("Create"), iconName: "apply" },
|
|
|
|
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
|
|
|
]
|
|
|
|
|
|
|
|
buttonCallbacks: ({
|
|
|
|
})
|
|
|
|
|
2019-11-07 11:08:47 -04:00
|
|
|
HRoomAvatar {
|
|
|
|
// TODO: click to change the avatar
|
|
|
|
id: avatar
|
|
|
|
clientUserId: addChatPage.userId
|
|
|
|
displayName: nameField.text
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: 128
|
|
|
|
Layout.preferredHeight: Layout.preferredWidth
|
|
|
|
|
|
|
|
HUserAvatar {
|
|
|
|
anchors.fill: parent
|
|
|
|
z: 10
|
|
|
|
opacity: nameField.text ? 0 : 1
|
|
|
|
visible: opacity > 0
|
|
|
|
clientUserId: parent.clientUserId
|
|
|
|
userId: clientUserId
|
|
|
|
displayName: account ? account.display_name : ""
|
|
|
|
mxc: account ? account.avatar_url : ""
|
|
|
|
|
|
|
|
readonly property var account:
|
|
|
|
Utils.getItem(modelSources["Account"] || [], "user_id", userId)
|
|
|
|
|
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-07 09:50:59 -04:00
|
|
|
HTextField {
|
|
|
|
id: nameField
|
2019-11-07 10:41:10 -04:00
|
|
|
placeholderText: qsTr("Name")
|
2019-11-07 09:50:59 -04:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HTextField {
|
|
|
|
id: topicField
|
|
|
|
placeholderText: qsTr("Topic (optional)")
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HCheckBox {
|
|
|
|
id: publicCheckBox
|
|
|
|
text: qsTr("Make this room public")
|
2019-11-07 10:41:10 -04:00
|
|
|
subtitle.text: qsTr("Anyone will be able to join without invitation.")
|
2019-11-07 09:50:59 -04:00
|
|
|
spacing: addChatBox.horizontalSpacing
|
|
|
|
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
}
|
|
|
|
|
|
|
|
HCheckBox {
|
|
|
|
id: encryptCheckBox
|
|
|
|
text: qsTr("Encrypt messages")
|
|
|
|
subtitle.text:
|
2019-11-07 10:41:10 -04:00
|
|
|
qsTr("Protect the room against eavesdropper. Only you " +
|
|
|
|
"and those you trust can read the conversation.") +
|
2019-11-07 09:50:59 -04:00
|
|
|
"<br><font color='" + theme.colors.middleBackground + "'>" +
|
|
|
|
qsTr("Cannot be disabled later!") +
|
|
|
|
"</font>"
|
|
|
|
subtitle.textFormat: Text.StyledText
|
|
|
|
spacing: addChatBox.horizontalSpacing
|
|
|
|
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
}
|
|
|
|
|
|
|
|
HCheckBox {
|
|
|
|
id: blockOtherServersCheckBox
|
|
|
|
text: qsTr("Reject users from other matrix servers")
|
|
|
|
subtitle.text: qsTr("Cannot be changed later!")
|
|
|
|
subtitle.color: theme.colors.middleBackground
|
|
|
|
spacing: addChatBox.horizontalSpacing
|
|
|
|
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
}
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
id: errorMessage
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
color: theme.colors.errorText
|
|
|
|
|
|
|
|
visible: Layout.maximumHeight > 0
|
|
|
|
Layout.maximumHeight: text ? implicitHeight : 0
|
|
|
|
Behavior on Layout.maximumHeight { HNumberAnimation {} }
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
}
|