diff options
Diffstat (limited to 'resources/qml/dialogs/RoomSettings.qml')
-rw-r--r-- | resources/qml/dialogs/RoomSettings.qml | 408 |
1 files changed, 204 insertions, 204 deletions
diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml index 199f23e8..04e964a9 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml @@ -41,105 +41,105 @@ ApplicationWindow { flickableDirection: Flickable.VerticalFlick contentWidth: contentLayout1.width contentHeight: contentLayout1.height - ColumnLayout { - id: contentLayout1 - width: flickable.width - spacing: Nheko.paddingMedium - - Avatar { - Layout.topMargin: Nheko.paddingMedium - url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/") - roomid: roomSettings.roomId - displayName: roomSettings.roomName - height: 130 - width: 130 - Layout.alignment: Qt.AlignHCenter - onClicked: { - if (roomSettings.canChangeAvatar) - roomSettings.updateAvatar(); + ColumnLayout { + id: contentLayout1 + width: flickable.width + spacing: Nheko.paddingMedium + + Avatar { + Layout.topMargin: Nheko.paddingMedium + url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/") + roomid: roomSettings.roomId + displayName: roomSettings.roomName + height: 130 + width: 130 + Layout.alignment: Qt.AlignHCenter + onClicked: { + if (roomSettings.canChangeAvatar) + roomSettings.updateAvatar(); + } } - } - - Spinner { - Layout.alignment: Qt.AlignHCenter - visible: roomSettings.isLoading - foreground: Nheko.colors.mid - running: roomSettings.isLoading - } - Text { - id: errorText + Spinner { + 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 - wrapMode: Text.Wrap // somehow still doesn't wrap - } + Text { + id: errorText - SequentialAnimation { - id: hideErrorAnimation + color: "red" + visible: opacity > 0 + opacity: 0 + Layout.alignment: Qt.AlignHCenter + wrapMode: Text.Wrap // somehow still doesn't wrap + } - running: false + SequentialAnimation { + id: hideErrorAnimation - PauseAnimation { - duration: 4000 - } + running: false - NumberAnimation { - target: errorText - property: 'opacity' - to: 0 - duration: 1000 - } + PauseAnimation { + duration: 4000 + } - } + NumberAnimation { + target: errorText + property: 'opacity' + to: 0 + duration: 1000 + } - Connections { - target: roomSettings - function onDisplayError(errorMessage) { - errorText.text = errorMessage; - errorText.opacity = 1; - hideErrorAnimation.restart(); } - } - Label { - text: roomSettings.roomName - Layout.alignment: Qt.AlignHCenter - font.pixelSize: fontMetrics.font.pixelSize * 2 - Layout.fillWidth: true - horizontalAlignment: TextEdit.AlignHCenter + + Connections { + target: roomSettings + function onDisplayError(errorMessage) { + errorText.text = errorMessage; + errorText.opacity = 1; + hideErrorAnimation.restart(); + } } + Label { + text: roomSettings.roomName + Layout.alignment: Qt.AlignHCenter + font.pixelSize: fontMetrics.font.pixelSize * 2 + Layout.fillWidth: true + horizontalAlignment: TextEdit.AlignHCenter + } - Label { - text: qsTr("%n member(s)", "", roomSettings.memberCount) - Layout.alignment: Qt.AlignHCenter + Label { + text: qsTr("%n member(s)", "", roomSettings.memberCount) + Layout.alignment: Qt.AlignHCenter - TapHandler { - onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId)) - } + TapHandler { + onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId)) + } + + CursorShape { + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + } - CursorShape { - cursorShape: Qt.PointingHandCursor - anchors.fill: parent } + ImageButton { + Layout.alignment: Qt.AlignHCenter + image: ":/icons/icons/ui/edit.svg" + visible: roomSettings.canChangeNameAndTopic + onClicked: roomSettings.openEditModal() } - ImageButton { - Layout.alignment: Qt.AlignHCenter - image: ":/icons/icons/ui/edit.svg" - visible: roomSettings.canChangeNameAndTopic - onClicked: roomSettings.openEditModal() - } - - TextArea { - Layout.fillHeight: true - Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - Layout.leftMargin: Nheko.paddingLarge - Layout.rightMargin: Nheko.paddingLarge + TextArea { + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + Layout.leftMargin: Nheko.paddingLarge + Layout.rightMargin: Nheko.paddingLarge text: TimelineManager.escapeEmoji(roomSettings.roomTopic) wrapMode: TextEdit.WordWrap @@ -156,167 +156,167 @@ ApplicationWindow { cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } - } + } - GridLayout { - columns: 2 - rowSpacing: Nheko.paddingMedium - Layout.margins: Nheko.paddingMedium + GridLayout { + columns: 2 + rowSpacing: Nheko.paddingMedium + Layout.margins: Nheko.paddingMedium - Label { - text: qsTr("SETTINGS") - font.bold: true - } + Label { + text: qsTr("SETTINGS") + font.bold: true + } - Item { - Layout.fillWidth: true - } + Item { + Layout.fillWidth: true + } - Label { - text: qsTr("Notifications") - Layout.fillWidth: true - } + Label { + text: qsTr("Notifications") + Layout.fillWidth: true + } - ComboBox { - model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")] - currentIndex: roomSettings.notifications - onActivated: { - roomSettings.changeNotifications(index); + ComboBox { + model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")] + currentIndex: roomSettings.notifications + onActivated: { + roomSettings.changeNotifications(index); + } + Layout.fillWidth: true } - Layout.fillWidth: true - } - Label { - text: qsTr("Room access") - Layout.fillWidth: true - } + Label { + text: qsTr("Room access") + Layout.fillWidth: true + } - ComboBox { - enabled: roomSettings.canChangeJoinRules - model: { - let opts = [qsTr("Anyone and guests"), qsTr("Anyone"), qsTr("Invited users")]; - if (roomSettings.supportsKnocking) - opts.push(qsTr("By knocking")); + ComboBox { + enabled: roomSettings.canChangeJoinRules + model: { + let opts = [qsTr("Anyone and guests"), qsTr("Anyone"), qsTr("Invited users")]; + if (roomSettings.supportsKnocking) + opts.push(qsTr("By knocking")); - if (roomSettings.supportsRestricted) - opts.push(qsTr("Restricted by membership in other rooms")); + if (roomSettings.supportsRestricted) + opts.push(qsTr("Restricted by membership in other rooms")); - return opts; - } - currentIndex: roomSettings.accessJoinRules - onActivated: { - roomSettings.changeAccessRules(index); + return opts; + } + currentIndex: roomSettings.accessJoinRules + onActivated: { + roomSettings.changeAccessRules(index); + } + Layout.fillWidth: true } - Layout.fillWidth: true - } - Label { - text: qsTr("Encryption") - } + Label { + text: qsTr("Encryption") + } - ToggleButton { - id: encryptionToggle + ToggleButton { + id: encryptionToggle - checked: roomSettings.isEncryptionEnabled - onCheckedChanged: { - if (roomSettings.isEncryptionEnabled) { - checked = true; - return ; + checked: roomSettings.isEncryptionEnabled + onCheckedChanged: { + if (roomSettings.isEncryptionEnabled) { + checked = true; + return ; + } + confirmEncryptionDialog.open(); } - confirmEncryptionDialog.open(); + Layout.alignment: Qt.AlignRight } - Layout.alignment: Qt.AlignRight - } - Platform.MessageDialog { - id: confirmEncryptionDialog + 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 - onAccepted: { - if (roomSettings.isEncryptionEnabled) - return ; + 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 + onAccepted: { + if (roomSettings.isEncryptionEnabled) + return ; - roomSettings.enableEncryption(); + roomSettings.enableEncryption(); + } + onRejected: { + encryptionToggle.checked = false; + } + buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel } - onRejected: { - encryptionToggle.checked = false; + + Label { + text: qsTr("Sticker & Emote Settings") } - buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel - } - Label { - text: qsTr("Sticker & Emote Settings") - } + Button { + text: qsTr("Change") + ToolTip.text: qsTr("Change what packs are enabled, remove packs or create new ones") + onClicked: TimelineManager.openImagePackSettings(roomSettings.roomId) + Layout.alignment: Qt.AlignRight + } - Button { - text: qsTr("Change") - ToolTip.text: qsTr("Change what packs are enabled, remove packs or create new ones") - onClicked: TimelineManager.openImagePackSettings(roomSettings.roomId) - Layout.alignment: Qt.AlignRight - } + Label { + text: qsTr("Hidden events") + } - Label { - text: qsTr("Hidden events") - } + HiddenEventsDialog { + id: hiddenEventsDialog + roomid: roomSettings.roomId + roomName: roomSettings.roomName + } - HiddenEventsDialog { - id: hiddenEventsDialog - roomid: roomSettings.roomId - roomName: roomSettings.roomName - } + Button { + text: qsTr("Configure") + ToolTip.text: qsTr("Select events to hide in this room") + onClicked: hiddenEventsDialog.show() + Layout.alignment: Qt.AlignRight + } - Button { - text: qsTr("Configure") - ToolTip.text: qsTr("Select events to hide in this room") - onClicked: hiddenEventsDialog.show() - Layout.alignment: Qt.AlignRight - } + Item { + // for adding extra space between sections + Layout.fillWidth: true + } - Item { - // for adding extra space between sections - Layout.fillWidth: true - } + Item { + // for adding extra space between sections + Layout.fillWidth: true + } - Item { - // for adding extra space between sections - Layout.fillWidth: true - } + Label { + text: qsTr("INFO") + font.bold: true + } - Label { - text: qsTr("INFO") - font.bold: true - } + Item { + Layout.fillWidth: true + } - Item { - Layout.fillWidth: true - } + Label { + text: qsTr("Internal ID") + } - Label { - text: qsTr("Internal ID") - } + Label { + text: roomSettings.roomId + font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8) + Layout.alignment: Qt.AlignRight + } - Label { - text: roomSettings.roomId - font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8) - Layout.alignment: Qt.AlignRight - } + Label { + text: qsTr("Room Version") + } - Label { - text: qsTr("Room Version") - } + Label { + text: roomSettings.roomVersion + font.pixelSize: fontMetrics.font.pixelSize + Layout.alignment: Qt.AlignRight + } - Label { - text: roomSettings.roomVersion - font.pixelSize: fontMetrics.font.pixelSize - Layout.alignment: Qt.AlignRight } - } } - } footer: DialogButtonBox { standardButtons: DialogButtonBox.Ok onAccepted: close() |