2021-02-09 20:41:39 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import QtQuick.Window 2.3
|
2021-02-11 17:24:09 +03:00
|
|
|
import QtQuick.Dialogs 1.2
|
2021-02-09 20:41:39 +03:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: roomSettingsDialog
|
|
|
|
|
|
|
|
property var roomSettings
|
|
|
|
|
|
|
|
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
|
|
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
2021-02-14 08:56:10 +03:00
|
|
|
minimumWidth: 420
|
2021-02-13 16:38:52 +03:00
|
|
|
minimumHeight: 650
|
2021-02-09 20:41:39 +03:00
|
|
|
palette: colors
|
|
|
|
color: colors.window
|
2021-02-11 17:24:09 +03:00
|
|
|
modality: Qt.WindowModal
|
2021-02-09 20:41:39 +03:00
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
|
|
|
onActivated: roomSettingsDialog.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2021-02-13 16:38:52 +03:00
|
|
|
id: contentLayout1
|
2021-02-09 20:41:39 +03:00
|
|
|
|
2021-02-13 18:16:40 +03:00
|
|
|
anchors.fill: parent
|
2021-02-09 20:41:39 +03:00
|
|
|
anchors.margins: 10
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
Avatar {
|
2021-02-11 21:09:11 +03:00
|
|
|
url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
|
2021-02-09 20:41:39 +03:00
|
|
|
height: 130
|
|
|
|
width: 130
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2021-02-11 21:09:11 +03:00
|
|
|
onClicked: {
|
|
|
|
if(roomSettings.canChangeAvatar) {
|
|
|
|
roomSettings.updateAvatar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
running: roomSettings.isLoading
|
|
|
|
visible: roomSettings.isLoading
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: errorText
|
|
|
|
text: "Error Text"
|
|
|
|
color: "red"
|
|
|
|
visible: opacity > 0
|
|
|
|
opacity: 0
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
SequentialAnimation {
|
|
|
|
id: hideErrorAnimation
|
|
|
|
running: false
|
|
|
|
PauseAnimation {
|
|
|
|
duration: 4000
|
|
|
|
}
|
|
|
|
NumberAnimation {
|
|
|
|
target: errorText
|
|
|
|
property: 'opacity'
|
|
|
|
to: 0
|
|
|
|
duration: 1000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections{
|
|
|
|
target: roomSettings
|
|
|
|
onDisplayError: {
|
|
|
|
errorText.text = errorMessage
|
|
|
|
errorText.opacity = 1
|
|
|
|
hideErrorAnimation.restart()
|
|
|
|
}
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
|
|
|
MatrixText {
|
2021-02-11 18:53:33 +03:00
|
|
|
text: roomSettings.roomName
|
2021-02-09 20:41:39 +03:00
|
|
|
font.pixelSize: 24
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
2021-02-11 18:53:33 +03:00
|
|
|
text: "%1 member(s)".arg(roomSettings.memberCount)
|
2021-02-09 20:41:39 +03:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
image: ":/icons/icons/ui/edit.png"
|
2021-02-12 10:18:12 +03:00
|
|
|
visible: roomSettings.canChangeNameAndTopic
|
|
|
|
onClicked: roomSettings.openEditModal()
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
2021-02-13 16:38:52 +03:00
|
|
|
|
2021-02-13 18:16:40 +03:00
|
|
|
ScrollView {
|
|
|
|
Layout.maximumHeight: 75
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.fillWidth: true
|
2021-02-13 16:38:52 +03:00
|
|
|
|
2021-02-13 18:16:40 +03:00
|
|
|
TextArea {
|
|
|
|
text: roomSettings.roomTopic
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
readOnly: true
|
|
|
|
background: null
|
2021-02-14 08:56:10 +03:00
|
|
|
selectByMouse: true
|
2021-02-16 09:22:03 +03:00
|
|
|
color: colors.text
|
|
|
|
horizontalAlignment: TextEdit.AlignHCenter
|
2021-02-13 18:16:40 +03:00
|
|
|
}
|
2021-02-13 16:38:52 +03:00
|
|
|
}
|
2021-02-09 20:41:39 +03:00
|
|
|
|
2021-02-14 08:56:10 +03:00
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
2021-02-16 19:52:55 +03:00
|
|
|
rowSpacing: 10
|
2021-02-09 20:41:39 +03:00
|
|
|
|
|
|
|
MatrixText {
|
2021-02-14 08:56:10 +03:00
|
|
|
text: "SETTINGS"
|
2021-02-16 19:52:55 +03:00
|
|
|
font.bold: true
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2021-02-14 08:56:10 +03:00
|
|
|
MatrixText {
|
|
|
|
text: "Notifications"
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2021-02-09 20:41:39 +03:00
|
|
|
ComboBox {
|
|
|
|
model: [ "Muted", "Mentions only", "All messages" ]
|
2021-02-11 17:24:09 +03:00
|
|
|
currentIndex: roomSettings.notifications
|
|
|
|
onActivated: {
|
|
|
|
roomSettings.changeNotifications(index)
|
|
|
|
}
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.fillWidth: true
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: "Room access"
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.fillWidth: true
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
2021-02-11 17:24:09 +03:00
|
|
|
enabled: roomSettings.canChangeJoinRules
|
2021-02-09 20:41:39 +03:00
|
|
|
model: [ "Anyone and guests", "Anyone", "Invited users" ]
|
2021-02-11 17:24:09 +03:00
|
|
|
currentIndex: roomSettings.accessJoinRules
|
|
|
|
onActivated: {
|
|
|
|
roomSettings.changeAccessRules(index)
|
|
|
|
}
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.fillWidth: true
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: "Encryption"
|
|
|
|
}
|
|
|
|
|
2021-02-13 18:16:40 +03:00
|
|
|
ToggleButton {
|
|
|
|
id: encryptionToggle
|
2021-02-11 17:24:09 +03:00
|
|
|
|
|
|
|
checked: roomSettings.isEncryptionEnabled
|
2021-02-13 19:19:21 +03:00
|
|
|
onClicked: {
|
2021-02-11 17:24:09 +03:00
|
|
|
if(roomSettings.isEncryptionEnabled) {
|
|
|
|
checked=true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
confirmEncryptionDialog.open();
|
|
|
|
}
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2021-02-11 17:24:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
id: confirmEncryptionDialog
|
|
|
|
title: qsTr("End-to-End Encryption")
|
|
|
|
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
|
|
|
|
Please take note that it can't be disabled afterwards.")
|
|
|
|
modality: Qt.WindowModal
|
|
|
|
icon: StandardIcon.Question
|
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
if(roomSettings.isEncryptionEnabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
roomSettings.enableEncryption();
|
|
|
|
}
|
|
|
|
|
|
|
|
onRejected: {
|
2021-02-13 18:16:40 +03:00
|
|
|
encryptionToggle.checked = false
|
2021-02-11 17:24:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
2021-02-11 17:24:09 +03:00
|
|
|
|
2021-02-09 20:41:39 +03:00
|
|
|
MatrixText {
|
2021-02-14 08:56:10 +03:00
|
|
|
visible: roomSettings.isEncryptionEnabled
|
2021-02-09 20:41:39 +03:00
|
|
|
text: "Respond to key requests"
|
|
|
|
}
|
|
|
|
|
2021-02-13 18:16:40 +03:00
|
|
|
ToggleButton {
|
2021-02-14 08:56:10 +03:00
|
|
|
visible: roomSettings.isEncryptionEnabled
|
2021-02-11 17:24:09 +03:00
|
|
|
ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys
|
|
|
|
upon request. Use with caution, this is a temporary measure to test the
|
|
|
|
E2E implementation until device verification is completed.")
|
|
|
|
|
|
|
|
checked: roomSettings.respondsToKeyRequests
|
|
|
|
|
2021-02-13 19:19:21 +03:00
|
|
|
onClicked: {
|
2021-02-11 17:24:09 +03:00
|
|
|
roomSettings.changeKeyRequestsPreference(checked)
|
|
|
|
}
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
2021-02-16 19:52:55 +03:00
|
|
|
Item {
|
|
|
|
// for adding extra space between sections
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
// for adding extra space between sections
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2021-02-09 20:41:39 +03:00
|
|
|
MatrixText {
|
2021-02-14 08:56:10 +03:00
|
|
|
text: "INFO"
|
2021-02-16 19:52:55 +03:00
|
|
|
font.bold: true
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2021-02-14 08:56:10 +03:00
|
|
|
MatrixText {
|
|
|
|
text: "Internal ID"
|
|
|
|
}
|
|
|
|
|
2021-02-09 20:41:39 +03:00
|
|
|
MatrixText {
|
2021-02-11 18:53:33 +03:00
|
|
|
text: roomSettings.roomId
|
2021-02-16 19:52:55 +03:00
|
|
|
font.pixelSize: 14
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: "Room Version"
|
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
2021-02-11 18:53:33 +03:00
|
|
|
text: roomSettings.roomVersion
|
2021-02-16 19:52:55 +03:00
|
|
|
font.pixelSize: 14
|
2021-02-14 08:56:10 +03:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
text: "Ok"
|
2021-02-12 10:18:12 +03:00
|
|
|
onClicked: close()
|
2021-02-09 20:41:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|