Newer
Older
// SPDX-FileCopyrightText: 2021 Nheko Contributors
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.3
import im.nheko 1.0
ApplicationWindow {
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
minimumWidth: 420
palette: Nheko.colors
color: Nheko.colors.window
modality: Qt.NonModal
Shortcut {
sequence: StandardKey.Cancel
onActivated: roomSettingsDialog.close()
}
ColumnLayout {
url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
height: 130
width: 130
Layout.alignment: Qt.AlignHCenter
if (roomSettings.canChangeAvatar)
roomSettings.updateAvatar();
Layout.alignment: Qt.AlignHCenter
visible: roomSettings.isLoading
foreground: Nheko.colors.mid
running: roomSettings.isLoading
color: "red"
visible: opacity > 0
opacity: 0
Layout.alignment: Qt.AlignHCenter
}
SequentialAnimation {
id: hideErrorAnimation
NumberAnimation {
target: errorText
property: 'opacity'
to: 0
duration: 1000
}
errorText.text = errorMessage;
errorText.opacity = 1;
hideErrorAnimation.restart();
}
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
MatrixText {
Layout.alignment: Qt.AlignHCenter
}
MatrixText {
text: qsTr("%1 member(s)").arg(roomSettings.memberCount)
}
ImageButton {
Layout.alignment: Qt.AlignHCenter
image: ":/icons/icons/ui/edit.png"
visible: roomSettings.canChangeNameAndTopic
onClicked: roomSettings.openEditModal()
Layout.fillWidth: true
Layout.leftMargin: Nheko.paddingLarge
Layout.rightMargin: Nheko.paddingLarge
text: TimelineManager.escapeEmoji(roomSettings.roomTopic)
wrapMode: TextEdit.WordWrap
textFormat: TextEdit.RichText
selectByMouse: true
CursorShape {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
GridLayout {
columns: 2
MatrixText {
Layout.fillWidth: true
}
model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")]
currentIndex: roomSettings.notifications
onActivated: {
roomSettings.changeNotifications(index);
Layout.fillWidth: true
Layout.fillWidth: true
enabled: roomSettings.canChangeJoinRules
model: [qsTr("Anyone and guests"), qsTr("Anyone"), qsTr("Invited users")]
currentIndex: roomSettings.accessJoinRules
onActivated: {
roomSettings.changeAccessRules(index);
Layout.fillWidth: true
checked: roomSettings.isEncryptionEnabled
if (roomSettings.isEncryptionEnabled) {
checked = true;
return ;
}
confirmEncryptionDialog.open();
}
Layout.alignment: Qt.AlignRight
Platform.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.NonModal
if (roomSettings.isEncryptionEnabled)
return ;
roomSettings.enableEncryption();
}
onRejected: {
encryptionToggle.checked = false;
buttons: Dialog.Ok | Dialog.Cancel
visible: roomSettings.isEncryptionEnabled
visible: roomSettings.isEncryptionEnabled
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
roomSettings.changeKeyRequestsPreference(checked);
Layout.alignment: Qt.AlignRight
Item {
// for adding extra space between sections
Layout.fillWidth: true
}
Item {
// for adding extra space between sections
Layout.fillWidth: true
}
MatrixText {
}
font.pixelSize: fontMetrics.font.pixelSize * 1.2
Layout.alignment: Qt.AlignRight
font.pixelSize: fontMetrics.font.pixelSize * 1.2
Layout.alignment: Qt.AlignRight
DialogButtonBox {
Layout.fillWidth: true
standardButtons: DialogButtonBox.Ok
onAccepted: close()