2023-02-22 01:48:49 +03:00
// SPDX-FileCopyrightText: Nheko Contributors
2021-03-07 07:57:56 +03:00
//
2021-03-05 02:35:15 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
2021-09-25 06:27:57 +03:00
import ".."
import "../ui"
2021-02-23 07:24:34 +03:00
import Qt . labs . platform 1.1 as Platform
2021-07-21 17:08:04 +03:00
import QtQuick 2.15
2021-02-09 20:41:39 +03:00
import QtQuick . Controls 2.3
import QtQuick . Layouts 1.2
2021-08-04 03:27:50 +03:00
import QtQuick . Window 2.13
2021-02-09 20:41:39 +03:00
import im . nheko 1.0
ApplicationWindow {
2021-02-20 04:53:14 +03:00
id: roomSettingsDialog
2021-02-09 20:41:39 +03:00
property var roomSettings
2023-06-02 02:29:05 +03:00
color: palette . window
2021-08-19 17:55:54 +03:00
flags: Qt . Dialog | Qt . WindowCloseButtonHint | Qt . WindowTitleHint
2023-10-31 05:11:03 +03:00
height: 680
minimumHeight: 450
minimumWidth: 340
modality: Qt . NonModal
2021-04-17 21:40:31 +03:00
title: qsTr ( "Room Settings" )
2023-10-31 05:11:03 +03:00
width: 450
footer: DialogButtonBox {
standardButtons: DialogButtonBox . Ok
onAccepted: close ( )
}
2021-02-09 20:41:39 +03:00
Shortcut {
sequence: StandardKey . Cancel
2023-10-31 05:11:03 +03:00
2021-02-09 20:41:39 +03:00
onActivated: roomSettingsDialog . close ( )
}
2022-02-25 23:57:19 +03:00
Flickable {
id: flickable
2023-10-31 05:11:03 +03:00
2022-02-25 23:57:19 +03:00
anchors.fill: parent
2023-10-31 05:11:03 +03:00
boundsBehavior: Flickable . StopAtBounds
2022-02-25 23:57:19 +03:00
clip: true
contentHeight: contentLayout1 . height
2023-10-31 05:11:03 +03:00
contentWidth: roomSettingsDialog . width
flickableDirection: Flickable . VerticalFlick
2022-02-25 23:59:01 +03:00
ColumnLayout {
id: contentLayout1
2023-10-31 05:11:03 +03:00
2022-02-25 23:59:01 +03:00
spacing: Nheko . paddingMedium
2023-10-31 05:11:03 +03:00
width: parent . width
2022-02-25 23:59:01 +03:00
Avatar {
2022-08-22 02:01:20 +03:00
id: displayAvatar
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignHCenter
2023-10-26 17:43:09 +03:00
Layout.preferredHeight: 130
Layout.preferredWidth: 130
2023-10-31 05:11:03 +03:00
Layout.topMargin: Nheko . paddingMedium
displayName: roomSettings . roomName
roomid: roomSettings . roomId
url: roomSettings . roomAvatarUrl . replace ( "mxc://" , "image://MxcImage/" )
2022-08-22 02:01:20 +03:00
onClicked: TimelineManager . openImageOverlay ( null , roomSettings . roomAvatarUrl , "" , 0 , 0 )
ImageButton {
ToolTip.text: qsTr ( "Change room avatar." )
2023-10-31 05:11:03 +03:00
ToolTip.visible: hovered
2022-08-22 02:01:20 +03:00
anchors.left: displayAvatar . left
anchors.leftMargin: Nheko . paddingMedium
2023-10-31 05:11:03 +03:00
anchors.top: displayAvatar . top
2022-08-22 02:01:20 +03:00
anchors.topMargin: Nheko . paddingMedium
2023-10-31 05:11:03 +03:00
hoverEnabled: true
2022-08-22 02:01:20 +03:00
image: ":/icons/icons/ui/edit.svg"
2023-10-31 05:11:03 +03:00
visible: roomSettings . canChangeAvatar
2022-08-22 02:01:20 +03:00
onClicked: {
2022-02-25 23:59:01 +03:00
roomSettings . updateAvatar ( ) ;
2022-08-22 02:01:20 +03:00
}
2022-02-25 23:59:01 +03:00
}
2021-02-11 21:09:11 +03:00
}
2022-02-25 23:59:01 +03:00
Spinner {
Layout.alignment: Qt . AlignHCenter
2023-06-02 02:29:05 +03:00
foreground: palette . mid
2022-02-25 23:59:01 +03:00
running: roomSettings . isLoading
2023-10-31 05:11:03 +03:00
visible: roomSettings . isLoading
2022-02-25 23:59:01 +03:00
}
Text {
id: errorText
2021-02-11 21:09:11 +03:00
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignHCenter
Layout.fillWidth: true
2022-02-25 23:59:01 +03:00
color: "red"
opacity: 0
2023-10-31 05:11:03 +03:00
visible: opacity > 0
2022-02-25 23:59:01 +03:00
wrapMode: Text . Wrap // somehow still doesn't wrap
}
SequentialAnimation {
id: hideErrorAnimation
2021-02-20 04:53:14 +03:00
2022-02-25 23:59:01 +03:00
running: false
2021-02-20 04:53:14 +03:00
2022-02-25 23:59:01 +03:00
PauseAnimation {
duration: 4000
}
NumberAnimation {
2023-10-31 05:11:03 +03:00
duration: 1000
2022-02-25 23:59:01 +03:00
property: 'opacity'
2023-10-31 05:11:03 +03:00
target: errorText
2022-02-25 23:59:01 +03:00
to: 0
}
2021-02-11 21:09:11 +03:00
}
2022-02-25 23:59:01 +03:00
Connections {
function onDisplayError ( errorMessage ) {
errorText . text = errorMessage ;
errorText . opacity = 1 ;
hideErrorAnimation . restart ( ) ;
}
2022-03-30 07:45:31 +03:00
2023-10-31 05:11:03 +03:00
target: roomSettings
}
2022-03-30 07:45:31 +03:00
TextEdit {
id: roomName
property bool isNameEditingAllowed: false
Layout.alignment: Qt . AlignHCenter
Layout.maximumWidth: parent . width - ( Nheko . paddingSmall * 2 ) - nameChangeButton . anchors . leftMargin - ( nameChangeButton . width * 2 )
2023-10-31 05:11:03 +03:00
color: palette . text
font.pixelSize: fontMetrics . font . pixelSize * 2
2022-03-30 07:45:31 +03:00
horizontalAlignment: TextEdit . AlignHCenter
2023-10-31 05:11:03 +03:00
readOnly: ! isNameEditingAllowed
2022-03-30 07:45:31 +03:00
selectByMouse: true
2023-10-31 05:11:03 +03:00
text: isNameEditingAllowed ? roomSettings.plainRoomName : roomSettings . roomName
textFormat: isNameEditingAllowed ? TextEdit.PlainText : TextEdit . RichText
wrapMode: TextEdit . Wrap
2022-03-30 07:45:31 +03:00
Keys.onPressed: {
if ( event . matches ( StandardKey . InsertLineSeparator ) || event . matches ( StandardKey . InsertParagraphSeparator ) ) {
roomSettings . changeName ( roomName . text ) ;
roomName . isNameEditingAllowed = false ;
event . accepted = true ;
}
}
2023-10-31 05:11:03 +03:00
Keys.onShortcutOverride: event . key === Qt . Key_Enter
2022-03-30 07:45:31 +03:00
ImageButton {
id: nameChangeButton
2023-10-31 05:11:03 +03:00
ToolTip.delay: Nheko . tooltipDelay
ToolTip.text: qsTr ( "Change name of this room" )
ToolTip.visible: hovered
2022-03-30 07:45:31 +03:00
anchors.left: roomName . right
2023-10-31 05:11:03 +03:00
anchors.leftMargin: Nheko . paddingSmall
2022-03-30 07:45:31 +03:00
anchors.verticalCenter: roomName . verticalCenter
hoverEnabled: true
image: roomName . isNameEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
2023-10-31 05:11:03 +03:00
visible: roomSettings . canChangeName
2022-03-30 07:45:31 +03:00
onClicked: {
if ( roomName . isNameEditingAllowed ) {
roomSettings . changeName ( roomName . text ) ;
roomName . isNameEditingAllowed = false ;
} else {
roomName . isNameEditingAllowed = true ;
roomName . focus = true ;
roomName . selectAll ( ) ;
}
}
2022-02-25 23:59:01 +03:00
}
2022-03-30 07:45:31 +03:00
}
2022-04-24 01:53:22 +03:00
RowLayout {
Layout.alignment: Qt . AlignHCenter
2023-10-31 05:11:03 +03:00
spacing: Nheko . paddingMedium
2022-04-24 01:53:22 +03:00
2022-02-25 23:59:01 +03:00
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "%n member(s)" , "" , roomSettings . memberCount )
2022-04-24 01:53:22 +03:00
}
ImageButton {
ToolTip.text: qsTr ( "View members of %1" ) . arg ( roomSettings . roomName )
2023-10-31 05:11:03 +03:00
ToolTip.visible: hovered
hoverEnabled: true
image: ":/icons/icons/ui/people.svg"
2022-04-24 01:53:22 +03:00
onClicked: TimelineManager . openRoomMembers ( Rooms . getRoomById ( roomSettings . roomId ) )
2021-07-21 17:08:04 +03:00
}
2022-04-24 01:53:22 +03:00
}
2022-02-25 23:59:01 +03:00
TextArea {
2022-03-02 12:02:01 +03:00
id: roomTopic
2023-10-31 05:11:03 +03:00
2022-03-02 12:02:01 +03:00
property bool cut: implicitHeight > 100
2023-10-31 05:11:03 +03:00
property bool isTopicEditingAllowed: false
2022-03-30 07:45:31 +03:00
property bool showMore: false
2023-10-31 05:11:03 +03:00
2022-02-25 23:59:01 +03:00
Layout.alignment: Qt . AlignHCenter
Layout.fillWidth: true
Layout.leftMargin: Nheko . paddingLarge
2023-10-31 05:11:03 +03:00
Layout.maximumHeight: showMore ? Number.POSITIVE_INFINITY : 100
Layout.preferredHeight: implicitHeight
2022-02-25 23:59:01 +03:00
Layout.rightMargin: Nheko . paddingLarge
2021-02-13 18:16:40 +03:00
background: null
2023-10-31 05:11:03 +03:00
clip: true
2023-06-02 02:29:05 +03:00
color: palette . text
2021-02-23 07:24:34 +03:00
horizontalAlignment: TextEdit . AlignHCenter
2023-10-31 05:11:03 +03:00
readOnly: ! isTopicEditingAllowed
text: isTopicEditingAllowed ? roomSettings.plainRoomTopic : ( roomSettings . plainRoomTopic === "" ? ( "<i>" + qsTr ( "No topic set" ) + "</i>" ) : roomSettings . roomTopic )
textFormat: isTopicEditingAllowed ? TextEdit.PlainText : TextEdit . RichText
wrapMode: TextEdit . WordWrap
2021-05-13 09:52:02 +03:00
onLinkActivated: Nheko . openLink ( link )
2021-02-22 23:35:11 +03:00
2023-06-19 02:38:40 +03:00
NhekoCursorShape {
2021-02-23 07:24:34 +03:00
anchors.fill: parent
cursorShape: parent . hoveredLink ? Qt.PointingHandCursor : Qt . ArrowCursor
}
2022-02-25 23:59:01 +03:00
}
2022-03-30 07:45:31 +03:00
ImageButton {
id: topicChangeButton
2023-10-31 05:11:03 +03:00
2022-03-30 07:45:31 +03:00
Layout.alignment: Qt . AlignHCenter
ToolTip.delay: Nheko . tooltipDelay
2023-10-31 05:11:03 +03:00
ToolTip.text: qsTr ( "Change topic of this room" )
ToolTip.visible: hovered
hoverEnabled: true
2022-03-30 07:45:31 +03:00
image: roomTopic . isTopicEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg"
2023-10-31 05:11:03 +03:00
visible: roomSettings . canChangeTopic
2022-03-30 07:45:31 +03:00
onClicked: {
if ( roomTopic . isTopicEditingAllowed ) {
roomSettings . changeTopic ( roomTopic . text ) ;
roomTopic . isTopicEditingAllowed = false ;
} else {
roomTopic . isTopicEditingAllowed = true ;
roomTopic . showMore = true ;
roomTopic . focus = true ;
//roomTopic.selectAll();
}
}
}
2022-03-02 12:02:01 +03:00
Item {
id: showMorePlaceholder
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignHCenter
2022-03-02 12:02:01 +03:00
Layout.preferredHeight: showMoreButton . height
Layout.preferredWidth: showMoreButton . width
visible: roomTopic . cut
}
2022-02-25 23:59:01 +03:00
GridLayout {
2023-10-31 05:11:03 +03:00
Layout.fillWidth: true
Layout.margins: Nheko . paddingMedium
2022-02-25 23:59:01 +03:00
columns: 2
rowSpacing: Nheko . paddingMedium
2021-02-09 20:41:39 +03:00
2022-02-25 23:59:01 +03:00
Label {
2023-06-28 18:07:49 +03:00
Layout.columnSpan: 2
2022-02-25 23:59:01 +03:00
Layout.fillWidth: true
2023-06-28 18:07:49 +03:00
Layout.topMargin: Nheko . paddingLarge
2023-10-31 05:11:03 +03:00
color: palette . text
font.bold: true
text: qsTr ( "NOTIFICATIONS" )
2022-02-25 23:59:01 +03:00
}
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Notifications" )
2022-02-25 23:59:01 +03:00
}
ComboBox {
2023-10-31 05:11:03 +03:00
Layout.fillWidth: true
2022-02-25 23:59:01 +03:00
currentIndex: roomSettings . notifications
2023-10-31 05:11:03 +03:00
model: [ qsTr ( "Muted" ) , qsTr ( "Mentions only" ) , qsTr ( "All messages" ) ]
2022-02-25 23:59:01 +03:00
onActivated: {
roomSettings . changeNotifications ( index ) ;
}
2021-02-09 20:41:39 +03:00
2023-10-31 05:11:03 +03:00
WheelHandler {
} // suppress scrolling changing values
}
2023-06-28 18:07:49 +03:00
Label {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.topMargin: Nheko . paddingLarge
2023-10-31 05:11:03 +03:00
color: palette . text
font.bold: true
text: qsTr ( "ENTRY PERMISSIONS" )
2023-06-28 18:07:49 +03:00
}
2022-02-25 23:59:01 +03:00
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Anyone can join" )
2022-02-25 23:59:01 +03:00
}
2022-09-19 22:39:37 +03:00
ToggleButton {
id: publicRoomButton
Layout.alignment: Qt . AlignRight
2023-10-31 05:11:03 +03:00
checked: ! roomSettings . privateAccess
enabled: roomSettings . canChangeJoinRules
2022-09-19 22:39:37 +03:00
}
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Allow knocking" )
2022-09-19 22:39:37 +03:00
visible: knockingButton . visible
}
ToggleButton {
id: knockingButton
2022-06-18 01:17:24 +03:00
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-09-19 22:39:37 +03:00
checked: roomSettings . knockingEnabled
2023-10-31 05:11:03 +03:00
enabled: roomSettings . canChangeJoinRules && roomSettings . supportsKnocking
visible: ! publicRoomButton . checked
2022-09-19 22:39:37 +03:00
onCheckedChanged: {
2023-10-31 05:11:03 +03:00
if ( checked && ! roomSettings . supportsKnockRestricted )
restrictedButton . checked = false ;
2022-02-25 23:59:01 +03:00
}
2022-09-19 22:39:37 +03:00
}
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Allow joining via other rooms" )
2022-09-19 22:39:37 +03:00
visible: restrictedButton . visible
}
ToggleButton {
id: restrictedButton
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-09-19 22:39:37 +03:00
checked: roomSettings . restrictedEnabled
2023-10-31 05:11:03 +03:00
enabled: roomSettings . canChangeJoinRules && roomSettings . supportsRestricted
visible: ! publicRoomButton . checked
2022-09-19 22:39:37 +03:00
onCheckedChanged: {
2023-10-31 05:11:03 +03:00
if ( checked && ! roomSettings . supportsKnockRestricted )
knockingButton . checked = false ;
2022-02-25 23:59:01 +03:00
}
2022-09-19 22:39:37 +03:00
}
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Rooms to join via" )
2022-09-19 22:39:37 +03:00
visible: allowedRoomsButton . visible
}
Button {
id: allowedRoomsButton
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
ToolTip.text: qsTr ( "Change the list of rooms users can join this room via. Usually this is the official community of this room." )
2022-09-19 22:39:37 +03:00
enabled: roomSettings . canChangeJoinRules && roomSettings . supportsRestricted
text: qsTr ( "Change" )
2023-10-31 05:11:03 +03:00
visible: restrictedButton . checked && restrictedButton . visible
2022-09-19 22:39:37 +03:00
onClicked: timelineRoot . showAllowedRoomsEditor ( roomSettings )
}
Label {
Layout.fillWidth: true
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Allow guests to join" )
2022-09-19 22:39:37 +03:00
}
ToggleButton {
id: guestAccessButton
Layout.alignment: Qt . AlignRight
2023-10-31 05:11:03 +03:00
checked: roomSettings . guestAccess
enabled: roomSettings . canChangeJoinRules
2022-09-19 22:39:37 +03:00
}
Button {
2023-10-31 05:11:03 +03:00
Layout.columnSpan: 2
Layout.fillWidth: true
2022-09-19 22:39:37 +03:00
enabled: roomSettings . canChangeJoinRules
text: qsTr ( "Apply access rules" )
2023-10-31 05:11:03 +03:00
visible: publicRoomButton . checked == roomSettings . privateAccess || knockingButton . checked != roomSettings . knockingEnabled || restrictedButton . checked != roomSettings . restrictedEnabled || guestAccessButton . checked != roomSettings . guestAccess || roomSettings . allowedRoomsModified
2022-09-19 22:39:37 +03:00
onClicked: roomSettings . changeAccessRules ( ! publicRoomButton . checked , guestAccessButton . checked , knockingButton . checked , restrictedButton . checked )
2021-02-11 17:24:09 +03:00
}
2023-06-24 02:04:54 +03:00
Label {
2023-06-28 18:07:49 +03:00
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.topMargin: Nheko . paddingLarge
2023-10-31 05:11:03 +03:00
color: palette . text
font.bold: true
text: qsTr ( "MESSAGE VISIBILITY" )
2023-06-28 18:07:49 +03:00
}
Label {
2023-06-24 02:04:54 +03:00
Layout.fillWidth: true
2023-10-31 05:11:03 +03:00
ToolTip.delay: Nheko . tooltipDelay
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "This is useful to see previews of the room or view it on public websites." )
ToolTip.visible: publicHistoryHover . hovered
2023-10-31 05:11:03 +03:00
color: palette . text
text: qsTr ( "Allow viewing history without joining" )
2023-06-28 18:07:49 +03:00
HoverHandler {
id: publicHistoryHover
}
2023-06-24 02:04:54 +03:00
}
2023-06-28 18:07:49 +03:00
ToggleButton {
id: publicHistoryButton
Layout.alignment: Qt . AlignRight
2023-10-31 05:11:03 +03:00
checked: roomSettings . historyVisibility == RoomSettings . WorldReadable
enabled: roomSettings . canChangeHistoryVisibility
2023-06-28 18:07:49 +03:00
}
Label {
Layout.alignment: Qt . AlignTop | Qt . AlignLeft
2023-10-31 05:11:03 +03:00
Layout.fillWidth: true
ToolTip.delay: Nheko . tooltipDelay
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "How much of the history is visible to joined members. Changing this won't affect the visibility of already sent messages. It only applies to new messages." )
ToolTip.visible: privateHistoryHover . hovered
2023-10-31 05:11:03 +03:00
color: palette . text
text: qsTr ( "Members can see messages since" )
visible: ! publicHistoryButton . checked
2023-06-28 18:07:49 +03:00
HoverHandler {
id: privateHistoryHover
2023-06-24 02:04:54 +03:00
}
2023-06-28 18:07:49 +03:00
}
ColumnLayout {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignTop | Qt . AlignRight
2023-06-24 02:04:54 +03:00
Layout.fillWidth: true
enabled: roomSettings . canChangeHistoryVisibility
2023-10-31 05:11:03 +03:00
visible: ! publicHistoryButton . checked
2023-06-24 02:04:54 +03:00
2023-06-28 18:07:49 +03:00
RadioButton {
id: sharedHistory
2023-10-31 05:11:03 +03:00
ToolTip.delay: Nheko . tooltipDelay
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "As long as the user joined, they can see all previous messages." )
ToolTip.visible: hovered
2023-10-31 05:11:03 +03:00
checked: roomSettings . historyVisibility == RoomSettings . Shared
text: qsTr ( "Everything" )
2023-06-28 18:07:49 +03:00
}
RadioButton {
id: invitedHistory
2023-10-31 05:11:03 +03:00
ToolTip.delay: Nheko . tooltipDelay
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "Members can only see messages from when they got invited going forward." )
2023-06-24 02:04:54 +03:00
ToolTip.visible: hovered
2023-10-31 05:11:03 +03:00
checked: roomSettings . historyVisibility == RoomSettings . Invited
text: qsTr ( "They got invited" )
2023-06-24 02:04:54 +03:00
}
2023-06-28 18:07:49 +03:00
RadioButton {
id: joinedHistory
2023-10-31 05:11:03 +03:00
ToolTip.delay: Nheko . tooltipDelay
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "Members can only see messages since after they joined." )
ToolTip.visible: hovered
2023-10-31 05:11:03 +03:00
checked: roomSettings . historyVisibility == RoomSettings . Joined || roomSettings . historyVisibility == RoomSettings . WorldReadable
text: qsTr ( "They joined" )
2023-06-28 18:07:49 +03:00
}
}
Button {
property int selectedVisibility: {
if ( publicHistoryButton . checked )
return RoomSettings . WorldReadable ;
else if ( sharedHistory . checked )
return RoomSettings . Shared ;
else if ( invitedHistory . checked )
return RoomSettings . Invited ;
return RoomSettings . Joined ;
}
2023-10-31 05:11:03 +03:00
2023-06-28 18:07:49 +03:00
Layout.columnSpan: 2
Layout.fillWidth: true
2023-10-31 05:11:03 +03:00
enabled: roomSettings . canChangeHistoryVisibility
text: qsTr ( "Apply visibility changes" )
visible: roomSettings . historyVisibility != selectedVisibility
2023-06-28 18:07:49 +03:00
2023-10-31 05:11:03 +03:00
onClicked: roomSettings . changeHistoryVisibility ( selectedVisibility )
}
2023-06-28 18:07:49 +03:00
Label {
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Locally hidden events" )
2023-06-28 18:07:49 +03:00
}
HiddenEventsDialog {
id: hiddenEventsDialog
2023-10-31 05:11:03 +03:00
2023-06-28 18:07:49 +03:00
roomName: roomSettings . roomName
2023-10-31 05:11:03 +03:00
roomid: roomSettings . roomId
2023-06-28 18:07:49 +03:00
}
Button {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2023-06-28 18:07:49 +03:00
ToolTip.text: qsTr ( "Select events to hide in this room" )
2023-10-31 05:11:03 +03:00
text: qsTr ( "Configure" )
2023-06-28 18:07:49 +03:00
onClicked: hiddenEventsDialog . show ( )
}
2023-07-05 01:08:37 +03:00
Label {
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Automatic event deletion" )
2023-07-05 01:08:37 +03:00
}
EventExpirationDialog {
id: eventExpirationDialog
2023-10-31 05:11:03 +03:00
2023-07-05 01:08:37 +03:00
roomName: roomSettings . roomName
2023-10-31 05:11:03 +03:00
roomid: roomSettings . roomId
2023-07-05 01:08:37 +03:00
}
Button {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2023-07-05 01:08:37 +03:00
ToolTip.text: qsTr ( "Select if your events get automatically deleted in this room." )
2023-10-31 05:11:03 +03:00
text: qsTr ( "Configure" )
2023-07-05 01:08:37 +03:00
onClicked: eventExpirationDialog . show ( )
}
2023-06-28 18:07:49 +03:00
Label {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.topMargin: Nheko . paddingLarge
2023-10-31 05:11:03 +03:00
color: palette . text
font.bold: true
text: qsTr ( "GENERAL SETTINGS" )
2023-06-24 02:04:54 +03:00
}
2022-02-25 23:59:01 +03:00
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Encryption" )
2022-02-25 23:59:01 +03:00
}
ToggleButton {
id: encryptionToggle
2021-02-11 17:24:09 +03:00
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-02-25 23:59:01 +03:00
checked: roomSettings . isEncryptionEnabled
2023-10-31 05:11:03 +03:00
2022-02-25 23:59:01 +03:00
onCheckedChanged: {
if ( roomSettings . isEncryptionEnabled ) {
checked = true ;
2023-10-31 05:11:03 +03:00
return ;
2022-02-25 23:59:01 +03:00
}
2023-03-01 22:39:16 +03:00
if ( checked === true )
confirmEncryptionDialog . open ( ) ;
2021-02-11 17:24:09 +03:00
}
}
2022-02-25 23:59:01 +03:00
Platform . MessageDialog {
id: confirmEncryptionDialog
2021-02-20 04:53:14 +03:00
2023-10-31 05:11:03 +03:00
buttons: Platform . MessageDialog . Ok | Platform . MessageDialog . Cancel
modality: Qt . NonModal
2023-10-26 02:51:45 +03:00
text: qsTr ( ` Encryption is currently experimental and things might break unexpectedly . < br >
Please take note that it can ' t be disabled afterwards . ` )
2023-10-31 05:11:03 +03:00
title: qsTr ( "End-to-End Encryption" )
2022-02-25 23:59:01 +03:00
onAccepted: {
if ( roomSettings . isEncryptionEnabled )
2023-10-31 05:11:03 +03:00
return ;
2022-02-25 23:59:01 +03:00
roomSettings . enableEncryption ( ) ;
}
onRejected: {
encryptionToggle . checked = false ;
}
2021-02-11 17:24:09 +03:00
}
2022-05-27 17:31:54 +03:00
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Permission" )
2022-05-27 17:31:54 +03:00
}
Button {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-05-27 17:31:54 +03:00
ToolTip.text: qsTr ( "View and change the permissions in this room" )
2023-10-31 05:11:03 +03:00
text: qsTr ( "Configure" )
2022-05-27 17:31:54 +03:00
onClicked: timelineRoot . showPLEditor ( roomSettings )
2022-07-08 18:28:28 +03:00
}
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Aliases" )
2022-07-08 18:28:28 +03:00
}
Button {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-07-08 18:28:28 +03:00
ToolTip.text: qsTr ( "View and change the addresses/aliases of this room" )
2023-10-31 05:11:03 +03:00
text: qsTr ( "Configure" )
2022-07-08 18:28:28 +03:00
onClicked: timelineRoot . showAliasEditor ( roomSettings )
2022-05-27 17:31:54 +03:00
}
2022-02-25 23:59:01 +03:00
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Sticker & Emote Settings" )
2021-02-11 17:24:09 +03:00
}
2022-02-25 23:59:01 +03:00
Button {
2023-10-31 05:11:03 +03:00
Layout.alignment: Qt . AlignRight
2022-09-30 07:23:39 +03:00
ToolTip.text: qsTr ( "Change what packs are enabled, remove packs, or create new ones" )
2023-10-31 05:11:03 +03:00
text: qsTr ( "Change" )
2022-02-25 23:59:01 +03:00
onClicked: TimelineManager . openImagePackSettings ( roomSettings . roomId )
}
Label {
2023-06-28 18:07:49 +03:00
Layout.columnSpan: 2
2022-02-25 23:59:01 +03:00
Layout.fillWidth: true
2023-10-31 05:11:03 +03:00
Layout.topMargin: Nheko . paddingLarge
color: palette . text
font.bold: true
text: qsTr ( "INFO" )
2022-02-25 23:59:01 +03:00
}
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Internal ID" )
2022-02-25 23:59:01 +03:00
}
2023-10-31 05:11:03 +03:00
AbstractButton {
// AbstractButton does not allow setting text color
2022-02-25 23:59:01 +03:00
Layout.alignment: Qt . AlignRight
2022-03-02 12:02:01 +03:00
Layout.fillWidth: true
2022-03-03 23:51:26 +03:00
Layout.preferredHeight: idLabel . height
2023-10-31 05:11:03 +03:00
onClicked: {
textEdit . selectAll ( ) ;
textEdit . copy ( ) ;
toolTipTimer . start ( ) ;
}
Label {
// TextEdit does not trigger onClicked
2022-03-03 23:51:26 +03:00
id: idLabel
2023-10-31 05:11:03 +03:00
ToolTip.text: qsTr ( "Copied to clipboard" )
ToolTip.visible: toolTipTimer . running
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
font.pixelSize: Math . floor ( fontMetrics . font . pixelSize * 0.8 )
2022-03-04 15:40:44 +03:00
horizontalAlignment: Text . AlignRight
2023-10-31 05:11:03 +03:00
text: roomSettings . roomId
width: parent . width
2022-03-03 23:51:26 +03:00
wrapMode: Text . WrapAnywhere
}
2023-10-31 05:11:03 +03:00
TextEdit {
// label does not allow selection
2022-03-03 23:51:26 +03:00
id: textEdit
2023-10-31 05:11:03 +03:00
2022-03-03 23:51:26 +03:00
text: roomSettings . roomId
2023-10-31 05:11:03 +03:00
visible: false
2022-03-03 23:51:26 +03:00
}
Timer {
id: toolTipTimer
2023-10-31 05:11:03 +03:00
2022-03-03 23:51:26 +03:00
}
2022-02-25 23:59:01 +03:00
}
Label {
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
text: qsTr ( "Room Version" )
2022-02-25 23:59:01 +03:00
}
Label {
Layout.alignment: Qt . AlignRight
2023-06-02 02:29:05 +03:00
color: palette . text
2023-10-31 05:11:03 +03:00
font.pixelSize: fontMetrics . font . pixelSize
text: roomSettings . roomVersion
2022-02-25 23:59:01 +03:00
}
2021-02-09 20:41:39 +03:00
}
}
2022-02-25 23:57:19 +03:00
}
2022-03-02 12:02:01 +03:00
Button {
id: showMoreButton
2023-10-31 05:11:03 +03:00
2022-03-04 13:19:58 +03:00
anchors.horizontalCenter: flickable . horizontalCenter
2023-10-31 05:11:03 +03:00
text: roomTopic . showMore ? qsTr ( "show less" ) : qsTr ( "show more" )
2022-03-02 12:02:01 +03:00
visible: roomTopic . cut
2023-10-31 05:11:03 +03:00
y: Math . min ( showMorePlaceholder . y + contentLayout1 . y - flickable . contentY , flickable . height - height )
onClicked: {
roomTopic . showMore = ! roomTopic . showMore ;
console . log ( flickable . visibleArea ) ;
2022-03-02 12:02:01 +03:00
}
}
2021-02-20 04:53:14 +03:00
}