| 1 |
// SPDX-FileCopyrightText: Nheko Contributors |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
import ".." |
| 6 |
import "../ui" |
| 7 |
import QtQuick 2.15 |
| 8 |
import QtQuick.Controls 2.3 |
| 9 |
import QtQuick.Layouts 1.2 |
| 10 |
import QtQuick.Window 2.13 |
| 11 |
import QtQuick.Dialogs |
| 12 |
import im.nheko 1.0 |
| 13 |
|
| 14 |
ApplicationWindow { |
| 15 |
id: roomSettingsDialog |
| 16 |
|
| 17 |
property var roomSettings |
| 18 |
|
| 19 |
minimumWidth: 340 |
| 20 |
minimumHeight: 450 |
| 21 |
width: 450 |
| 22 |
height: 680 |
| 23 |
Layout.preferredWidth: scroll.availableWidth |
| 24 |
color: palette.window |
| 25 |
modality: Qt.NonModal |
| 26 |
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint |
| 27 |
title: qsTr("Room Settings") |
| 28 |
|
| 29 |
Shortcut { |
| 30 |
sequence: StandardKey.Cancel |
| 31 |
onActivated: roomSettingsDialog.close() |
| 32 |
} |
| 33 |
|
| 34 |
Flickable { |
| 35 |
id: flickable |
| 36 |
boundsBehavior: Flickable.StopAtBounds |
| 37 |
anchors.fill: parent |
| 38 |
clip: true |
| 39 |
flickableDirection: Flickable.VerticalFlick |
| 40 |
contentWidth: roomSettingsDialog.width |
| 41 |
contentHeight: contentLayout1.height |
| 42 |
ColumnLayout { |
| 43 |
id: contentLayout1 |
| 44 |
width: parent.width |
| 45 |
spacing: Nheko.paddingMedium |
| 46 |
|
| 47 |
Avatar { |
| 48 |
id: displayAvatar |
| 49 |
|
| 50 |
Layout.topMargin: Nheko.paddingMedium |
| 51 |
url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/") |
| 52 |
roomid: roomSettings.roomId |
| 53 |
displayName: roomSettings.roomName |
| 54 |
Layout.preferredHeight: 130 |
| 55 |
Layout.preferredWidth: 130 |
| 56 |
Layout.alignment: Qt.AlignHCenter |
| 57 |
onClicked: TimelineManager.openImageOverlay(null, roomSettings.roomAvatarUrl, "", 0, 0) |
| 58 |
|
| 59 |
ImageButton { |
| 60 |
hoverEnabled: true |
| 61 |
ToolTip.visible: hovered |
| 62 |
ToolTip.text: qsTr("Change room avatar.") |
| 63 |
anchors.left: displayAvatar.left |
| 64 |
anchors.top: displayAvatar.top |
| 65 |
anchors.leftMargin: Nheko.paddingMedium |
| 66 |
anchors.topMargin: Nheko.paddingMedium |
| 67 |
visible: roomSettings.canChangeAvatar |
| 68 |
image: ":/icons/icons/ui/edit.svg" |
| 69 |
onClicked: { |
| 70 |
roomSettings.updateAvatar(); |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
Spinner { |
| 77 |
Layout.alignment: Qt.AlignHCenter |
| 78 |
visible: roomSettings.isLoading |
| 79 |
foreground: palette.mid |
| 80 |
running: roomSettings.isLoading |
| 81 |
} |
| 82 |
|
| 83 |
Text { |
| 84 |
id: errorText |
| 85 |
|
| 86 |
color: "red" |
| 87 |
visible: opacity > 0 |
| 88 |
opacity: 0 |
| 89 |
Layout.alignment: Qt.AlignHCenter |
| 90 |
wrapMode: Text.Wrap // somehow still doesn't wrap |
| 91 |
Layout.fillWidth: true |
| 92 |
} |
| 93 |
|
| 94 |
SequentialAnimation { |
| 95 |
id: hideErrorAnimation |
| 96 |
|
| 97 |
running: false |
| 98 |
|
| 99 |
PauseAnimation { |
| 100 |
duration: 4000 |
| 101 |
} |
| 102 |
|
| 103 |
NumberAnimation { |
| 104 |
target: errorText |
| 105 |
property: 'opacity' |
| 106 |
to: 0 |
| 107 |
duration: 1000 |
| 108 |
} |
| 109 |
|
| 110 |
} |
| 111 |
|
| 112 |
Connections { |
| 113 |
target: roomSettings |
| 114 |
function onDisplayError(errorMessage) { |
| 115 |
errorText.text = errorMessage; |
| 116 |
errorText.opacity = 1; |
| 117 |
hideErrorAnimation.restart(); |
| 118 |
} |
| 119 |
} |
| 120 |
|
| 121 |
TextEdit { |
| 122 |
id: roomName |
| 123 |
|
| 124 |
property bool isNameEditingAllowed: false |
| 125 |
|
| 126 |
readOnly: !isNameEditingAllowed |
| 127 |
textFormat: isNameEditingAllowed ? TextEdit.PlainText : TextEdit.RichText |
| 128 |
text: isNameEditingAllowed ? roomSettings.plainRoomName : roomSettings.roomName |
| 129 |
font.pixelSize: fontMetrics.font.pixelSize * 2 |
| 130 |
color: palette.text |
| 131 |
|
| 132 |
Layout.alignment: Qt.AlignHCenter |
| 133 |
Layout.maximumWidth: parent.width - (Nheko.paddingSmall + roomNameButtons.anchors.leftMargin + roomNameButtons.implicitWidth) * 2 |
| 134 |
horizontalAlignment: TextEdit.AlignHCenter |
| 135 |
wrapMode: TextEdit.Wrap |
| 136 |
selectByMouse: true |
| 137 |
|
| 138 |
Keys.onShortcutOverride: event.key === Qt.Key_Enter |
| 139 |
Keys.onPressed: { |
| 140 |
if (event.matches(StandardKey.InsertLineSeparator) || event.matches(StandardKey.InsertParagraphSeparator)) { |
| 141 |
roomSettings.changeName(roomName.text); |
| 142 |
roomName.isNameEditingAllowed = false; |
| 143 |
event.accepted = true; |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
RowLayout { |
| 148 |
id: roomNameButtons |
| 149 |
|
| 150 |
anchors.leftMargin: Nheko.paddingSmall |
| 151 |
anchors.left: roomName.right |
| 152 |
anchors.verticalCenter: roomName.verticalCenter |
| 153 |
|
| 154 |
ImageButton { |
| 155 |
id: nameChangeButton |
| 156 |
visible: roomSettings.canChangeName |
| 157 |
hoverEnabled: true |
| 158 |
ToolTip.visible: hovered |
| 159 |
ToolTip.text: qsTr("Change name of this room") |
| 160 |
ToolTip.delay: Nheko.tooltipDelay |
| 161 |
image: roomName.isNameEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg" |
| 162 |
onClicked: { |
| 163 |
if (roomName.isNameEditingAllowed) { |
| 164 |
roomSettings.changeName(roomName.text); |
| 165 |
roomName.isNameEditingAllowed = false; |
| 166 |
} else { |
| 167 |
roomName.isNameEditingAllowed = true; |
| 168 |
roomName.focus = true; |
| 169 |
roomName.selectAll(); |
| 170 |
} |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
EncryptionIndicator { |
| 175 |
Layout.preferredHeight: 16 |
| 176 |
Layout.preferredWidth: 16 |
| 177 |
sourceSize.width: width |
| 178 |
sourceSize.height: height |
| 179 |
encrypted: true |
| 180 |
visible: roomSettings.isEncryptionEnabled && (roomSettings.isRoomNameSet || !roomName.readOnly) |
| 181 |
trust: Crypto.Unverified |
| 182 |
ToolTip.text: qsTr("Since room state can't be encrypted, make sure no confidential information is stored in the room name!") |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
} |
| 187 |
|
| 188 |
RowLayout { |
| 189 |
spacing: Nheko.paddingMedium |
| 190 |
Layout.alignment: Qt.AlignHCenter |
| 191 |
|
| 192 |
Label { |
| 193 |
text: qsTr("%n member(s)", "", roomSettings.memberCount) |
| 194 |
color: palette.text |
| 195 |
} |
| 196 |
|
| 197 |
ImageButton { |
| 198 |
image: ":/icons/icons/ui/people.svg" |
| 199 |
hoverEnabled: true |
| 200 |
ToolTip.visible: hovered |
| 201 |
ToolTip.text: qsTr("View members of %1").arg(roomSettings.roomName) |
| 202 |
onClicked: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId)) |
| 203 |
} |
| 204 |
|
| 205 |
} |
| 206 |
|
| 207 |
TextArea { |
| 208 |
id: roomTopic |
| 209 |
property bool cut: implicitHeight > 100 |
| 210 |
property bool showMore: false |
| 211 |
clip: true |
| 212 |
Layout.maximumHeight: showMore? Number.POSITIVE_INFINITY : 100 |
| 213 |
Layout.preferredHeight: implicitHeight |
| 214 |
Layout.alignment: Qt.AlignHCenter |
| 215 |
Layout.fillWidth: true |
| 216 |
Layout.leftMargin: Nheko.paddingLarge |
| 217 |
Layout.rightMargin: Nheko.paddingLarge |
| 218 |
|
| 219 |
property bool isTopicEditingAllowed: false |
| 220 |
|
| 221 |
readOnly: !isTopicEditingAllowed |
| 222 |
textFormat: isTopicEditingAllowed ? TextEdit.PlainText : TextEdit.RichText |
| 223 |
text: isTopicEditingAllowed |
| 224 |
? roomSettings.plainRoomTopic |
| 225 |
: (roomSettings.plainRoomTopic === "" ? ("<i>" + qsTr("No topic set") + "</i>") : roomSettings.roomTopic) |
| 226 |
wrapMode: TextEdit.WordWrap |
| 227 |
background: null |
| 228 |
color: palette.text |
| 229 |
horizontalAlignment: TextEdit.AlignHCenter |
| 230 |
onLinkActivated: Nheko.openLink(link) |
| 231 |
|
| 232 |
NhekoCursorShape { |
| 233 |
anchors.fill: parent |
| 234 |
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor |
| 235 |
} |
| 236 |
|
| 237 |
} |
| 238 |
|
| 239 |
RowLayout { |
| 240 |
spacing: Nheko.paddingMedium |
| 241 |
Layout.alignment: Qt.AlignHCenter |
| 242 |
|
| 243 |
ImageButton { |
| 244 |
id: topicChangeButton |
| 245 |
|
| 246 |
visible: roomSettings.canChangeTopic |
| 247 |
hoverEnabled: true |
| 248 |
ToolTip.visible: hovered |
| 249 |
ToolTip.text: qsTr("Change topic of this room") |
| 250 |
ToolTip.delay: Nheko.tooltipDelay |
| 251 |
image: roomTopic.isTopicEditingAllowed ? ":/icons/icons/ui/checkmark.svg" : ":/icons/icons/ui/edit.svg" |
| 252 |
onClicked: { |
| 253 |
if (roomTopic.isTopicEditingAllowed) { |
| 254 |
roomSettings.changeTopic(roomTopic.text); |
| 255 |
roomTopic.isTopicEditingAllowed = false; |
| 256 |
} else { |
| 257 |
roomTopic.isTopicEditingAllowed = true; |
| 258 |
roomTopic.showMore = true; |
| 259 |
roomTopic.focus = true; |
| 260 |
//roomTopic.selectAll(); |
| 261 |
} |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
EncryptionIndicator { |
| 266 |
Layout.preferredHeight: 16 |
| 267 |
Layout.preferredWidth: 16 |
| 268 |
sourceSize.width: width |
| 269 |
sourceSize.height: height |
| 270 |
encrypted: true |
| 271 |
visible: roomSettings.isEncryptionEnabled && (roomSettings.plainRoomTopic != "" || !roomTopic.readOnly) |
| 272 |
trust: Crypto.Unverified |
| 273 |
ToolTip.text: qsTr("Since room state can't be encrypted, make sure no confidential information is stored in the room topic!") |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
Item { |
| 278 |
Layout.alignment: Qt.AlignHCenter |
| 279 |
id: showMorePlaceholder |
| 280 |
Layout.preferredHeight: showMoreButton.height |
| 281 |
Layout.preferredWidth: showMoreButton.width |
| 282 |
visible: roomTopic.cut |
| 283 |
} |
| 284 |
|
| 285 |
GridLayout { |
| 286 |
columns: 2 |
| 287 |
rowSpacing: Nheko.paddingMedium |
| 288 |
Layout.margins: Nheko.paddingMedium |
| 289 |
Layout.fillWidth: true |
| 290 |
|
| 291 |
Label { |
| 292 |
text: qsTr("NOTIFICATIONS") |
| 293 |
font.bold: true |
| 294 |
color: palette.text |
| 295 |
Layout.columnSpan: 2 |
| 296 |
Layout.fillWidth: true |
| 297 |
Layout.topMargin: Nheko.paddingLarge |
| 298 |
} |
| 299 |
|
| 300 |
Label { |
| 301 |
text: qsTr("Notifications") |
| 302 |
Layout.fillWidth: true |
| 303 |
color: palette.text |
| 304 |
} |
| 305 |
|
| 306 |
ComboBox { |
| 307 |
model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")] |
| 308 |
currentIndex: roomSettings.notifications |
| 309 |
onActivated: (index) => { |
| 310 |
roomSettings.changeNotifications(index); |
| 311 |
} |
| 312 |
Layout.fillWidth: true |
| 313 |
WheelHandler{} // suppress scrolling changing values |
| 314 |
} |
| 315 |
|
| 316 |
Label { |
| 317 |
text: qsTr("ENTRY PERMISSIONS") |
| 318 |
font.bold: true |
| 319 |
color: palette.text |
| 320 |
Layout.columnSpan: 2 |
| 321 |
Layout.fillWidth: true |
| 322 |
Layout.topMargin: Nheko.paddingLarge |
| 323 |
} |
| 324 |
|
| 325 |
Label { |
| 326 |
text: qsTr("Anyone can join") |
| 327 |
Layout.fillWidth: true |
| 328 |
color: palette.text |
| 329 |
} |
| 330 |
|
| 331 |
ToggleButton { |
| 332 |
id: publicRoomButton |
| 333 |
|
| 334 |
enabled: roomSettings.canChangeJoinRules |
| 335 |
checked: !roomSettings.privateAccess |
| 336 |
Layout.alignment: Qt.AlignRight |
| 337 |
} |
| 338 |
|
| 339 |
Label { |
| 340 |
text: qsTr("Allow knocking") |
| 341 |
Layout.fillWidth: true |
| 342 |
color: palette.text |
| 343 |
visible: knockingButton.visible |
| 344 |
} |
| 345 |
|
| 346 |
ToggleButton { |
| 347 |
id: knockingButton |
| 348 |
|
| 349 |
visible: !publicRoomButton.checked |
| 350 |
enabled: roomSettings.canChangeJoinRules && roomSettings.supportsKnocking |
| 351 |
checked: roomSettings.knockingEnabled |
| 352 |
onCheckedChanged: { |
| 353 |
if (checked && !roomSettings.supportsKnockRestricted) restrictedButton.checked = false; |
| 354 |
} |
| 355 |
Layout.alignment: Qt.AlignRight |
| 356 |
} |
| 357 |
|
| 358 |
Label { |
| 359 |
text: qsTr("Allow joining via other rooms") |
| 360 |
Layout.fillWidth: true |
| 361 |
color: palette.text |
| 362 |
visible: restrictedButton.visible |
| 363 |
} |
| 364 |
|
| 365 |
ToggleButton { |
| 366 |
id: restrictedButton |
| 367 |
|
| 368 |
visible: !publicRoomButton.checked |
| 369 |
enabled: roomSettings.canChangeJoinRules && roomSettings.supportsRestricted |
| 370 |
checked: roomSettings.restrictedEnabled |
| 371 |
onCheckedChanged: { |
| 372 |
if (checked && !roomSettings.supportsKnockRestricted) knockingButton.checked = false; |
| 373 |
} |
| 374 |
Layout.alignment: Qt.AlignRight |
| 375 |
} |
| 376 |
|
| 377 |
Label { |
| 378 |
text: qsTr("Rooms to join via") |
| 379 |
Layout.fillWidth: true |
| 380 |
color: palette.text |
| 381 |
visible: allowedRoomsButton.visible |
| 382 |
} |
| 383 |
|
| 384 |
Button { |
| 385 |
id: allowedRoomsButton |
| 386 |
|
| 387 |
visible: restrictedButton.checked && restrictedButton.visible |
| 388 |
enabled: roomSettings.canChangeJoinRules && roomSettings.supportsRestricted |
| 389 |
|
| 390 |
text: qsTr("Change") |
| 391 |
ToolTip.text: qsTr("Change the list of rooms users can join this room via. Usually this is the official community of this room.") |
| 392 |
onClicked: timelineRoot.showAllowedRoomsEditor(roomSettings) |
| 393 |
Layout.alignment: Qt.AlignRight |
| 394 |
} |
| 395 |
|
| 396 |
Label { |
| 397 |
text: qsTr("Allow guests to join") |
| 398 |
Layout.fillWidth: true |
| 399 |
color: palette.text |
| 400 |
} |
| 401 |
|
| 402 |
ToggleButton { |
| 403 |
id: guestAccessButton |
| 404 |
|
| 405 |
enabled: roomSettings.canChangeJoinRules |
| 406 |
checked: roomSettings.guestAccess |
| 407 |
Layout.alignment: Qt.AlignRight |
| 408 |
} |
| 409 |
|
| 410 |
Button { |
| 411 |
visible: publicRoomButton.checked == roomSettings.privateAccess || knockingButton.checked != roomSettings.knockingEnabled || restrictedButton.checked != roomSettings.restrictedEnabled || guestAccessButton.checked != roomSettings.guestAccess || roomSettings.allowedRoomsModified |
| 412 |
enabled: roomSettings.canChangeJoinRules |
| 413 |
|
| 414 |
text: qsTr("Apply access rules") |
| 415 |
onClicked: roomSettings.changeAccessRules(!publicRoomButton.checked, guestAccessButton.checked, knockingButton.checked, restrictedButton.checked) |
| 416 |
Layout.columnSpan: 2 |
| 417 |
Layout.fillWidth: true |
| 418 |
} |
| 419 |
|
| 420 |
Label { |
| 421 |
text: qsTr("MESSAGE VISIBILITY") |
| 422 |
font.bold: true |
| 423 |
color: palette.text |
| 424 |
Layout.columnSpan: 2 |
| 425 |
Layout.fillWidth: true |
| 426 |
Layout.topMargin: Nheko.paddingLarge |
| 427 |
} |
| 428 |
|
| 429 |
Label { |
| 430 |
text: qsTr("Allow viewing history without joining") |
| 431 |
Layout.fillWidth: true |
| 432 |
color: palette.text |
| 433 |
ToolTip.text: qsTr("This is useful to see previews of the room or view it on public websites.") |
| 434 |
ToolTip.visible: publicHistoryHover.hovered |
| 435 |
ToolTip.delay: Nheko.tooltipDelay |
| 436 |
|
| 437 |
HoverHandler { |
| 438 |
id: publicHistoryHover |
| 439 |
|
| 440 |
} |
| 441 |
} |
| 442 |
|
| 443 |
ToggleButton { |
| 444 |
id: publicHistoryButton |
| 445 |
|
| 446 |
enabled: roomSettings.canChangeHistoryVisibility |
| 447 |
checked: roomSettings.historyVisibility == RoomSettings.WorldReadable |
| 448 |
Layout.alignment: Qt.AlignRight |
| 449 |
} |
| 450 |
|
| 451 |
Label { |
| 452 |
visible: !publicHistoryButton.checked |
| 453 |
text: qsTr("Members can see messages since") |
| 454 |
Layout.fillWidth: true |
| 455 |
color: palette.text |
| 456 |
Layout.alignment: Qt.AlignTop | Qt.AlignLeft |
| 457 |
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.") |
| 458 |
ToolTip.visible: privateHistoryHover.hovered |
| 459 |
ToolTip.delay: Nheko.tooltipDelay |
| 460 |
|
| 461 |
HoverHandler { |
| 462 |
id: privateHistoryHover |
| 463 |
|
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
ColumnLayout { |
| 468 |
Layout.fillWidth: true |
| 469 |
visible: !publicHistoryButton.checked |
| 470 |
enabled: roomSettings.canChangeHistoryVisibility |
| 471 |
Layout.alignment: Qt.AlignTop | Qt.AlignRight |
| 472 |
|
| 473 |
RadioButton { |
| 474 |
id: sharedHistory |
| 475 |
checked: roomSettings.historyVisibility == RoomSettings.Shared |
| 476 |
text: qsTr("Everything") |
| 477 |
ToolTip.text: qsTr("As long as the user joined, they can see all previous messages.") |
| 478 |
ToolTip.visible: hovered |
| 479 |
ToolTip.delay: Nheko.tooltipDelay |
| 480 |
} |
| 481 |
RadioButton { |
| 482 |
id: invitedHistory |
| 483 |
checked: roomSettings.historyVisibility == RoomSettings.Invited |
| 484 |
text: qsTr("They got invited") |
| 485 |
ToolTip.text: qsTr("Members can only see messages from when they got invited going forward.") |
| 486 |
ToolTip.visible: hovered |
| 487 |
ToolTip.delay: Nheko.tooltipDelay |
| 488 |
} |
| 489 |
RadioButton { |
| 490 |
id: joinedHistory |
| 491 |
checked: roomSettings.historyVisibility == RoomSettings.Joined || roomSettings.historyVisibility == RoomSettings.WorldReadable |
| 492 |
text: qsTr("They joined") |
| 493 |
ToolTip.text: qsTr("Members can only see messages since after they joined.") |
| 494 |
ToolTip.visible: hovered |
| 495 |
ToolTip.delay: Nheko.tooltipDelay |
| 496 |
} |
| 497 |
} |
| 498 |
|
| 499 |
Button { |
| 500 |
visible: roomSettings.historyVisibility != selectedVisibility |
| 501 |
enabled: roomSettings.canChangeHistoryVisibility |
| 502 |
|
| 503 |
text: qsTr("Apply visibility changes") |
| 504 |
property int selectedVisibility: { |
| 505 |
if (publicHistoryButton.checked) |
| 506 |
return RoomSettings.WorldReadable; |
| 507 |
else if (sharedHistory.checked) |
| 508 |
return RoomSettings.Shared; |
| 509 |
else if (invitedHistory.checked) |
| 510 |
return RoomSettings.Invited; |
| 511 |
return RoomSettings.Joined; |
| 512 |
} |
| 513 |
onClicked: roomSettings.changeHistoryVisibility(selectedVisibility) |
| 514 |
Layout.columnSpan: 2 |
| 515 |
Layout.fillWidth: true |
| 516 |
} |
| 517 |
|
| 518 |
Label { |
| 519 |
text: qsTr("Locally hidden events") |
| 520 |
color: palette.text |
| 521 |
} |
| 522 |
|
| 523 |
HiddenEventsDialog { |
| 524 |
id: hiddenEventsDialog |
| 525 |
roomid: roomSettings.roomId |
| 526 |
roomName: roomSettings.roomName |
| 527 |
} |
| 528 |
|
| 529 |
Button { |
| 530 |
text: qsTr("Configure") |
| 531 |
ToolTip.text: qsTr("Select events to hide in this room") |
| 532 |
onClicked: hiddenEventsDialog.show() |
| 533 |
Layout.alignment: Qt.AlignRight |
| 534 |
} |
| 535 |
|
| 536 |
Label { |
| 537 |
text: qsTr("Automatic event deletion") |
| 538 |
color: palette.text |
| 539 |
} |
| 540 |
|
| 541 |
EventExpirationDialog { |
| 542 |
id: eventExpirationDialog |
| 543 |
roomid: roomSettings.roomId |
| 544 |
roomName: roomSettings.roomName |
| 545 |
} |
| 546 |
|
| 547 |
Button { |
| 548 |
text: qsTr("Configure") |
| 549 |
ToolTip.text: qsTr("Select if your events get automatically deleted in this room.") |
| 550 |
onClicked: eventExpirationDialog.show() |
| 551 |
Layout.alignment: Qt.AlignRight |
| 552 |
} |
| 553 |
|
| 554 |
Label { |
| 555 |
text: qsTr("GENERAL SETTINGS") |
| 556 |
font.bold: true |
| 557 |
color: palette.text |
| 558 |
Layout.columnSpan: 2 |
| 559 |
Layout.fillWidth: true |
| 560 |
Layout.topMargin: Nheko.paddingLarge |
| 561 |
} |
| 562 |
|
| 563 |
Label { |
| 564 |
text: qsTr("Encryption") |
| 565 |
color: palette.text |
| 566 |
} |
| 567 |
|
| 568 |
ToggleButton { |
| 569 |
id: encryptionToggle |
| 570 |
|
| 571 |
checked: roomSettings.isEncryptionEnabled |
| 572 |
onCheckedChanged: { |
| 573 |
if (roomSettings.isEncryptionEnabled) { |
| 574 |
checked = true; |
| 575 |
return ; |
| 576 |
} |
| 577 |
if (checked === true) |
| 578 |
confirmEncryptionDialog.open(); |
| 579 |
} |
| 580 |
Layout.alignment: Qt.AlignRight |
| 581 |
} |
| 582 |
|
| 583 |
MessageDialog { |
| 584 |
id: confirmEncryptionDialog |
| 585 |
|
| 586 |
title: qsTr("End-to-End Encryption") |
| 587 |
text: qsTr(`Encryption is currently experimental and things might break unexpectedly. <br> |
| 588 |
Please take note that it can't be disabled afterwards.`) |
| 589 |
modality: Qt.NonModal |
| 590 |
onAccepted: { |
| 591 |
if (roomSettings.isEncryptionEnabled) |
| 592 |
return ; |
| 593 |
|
| 594 |
roomSettings.enableEncryption(); |
| 595 |
} |
| 596 |
onRejected: { |
| 597 |
encryptionToggle.checked = false; |
| 598 |
} |
| 599 |
buttons: MessageDialog.Ok | MessageDialog.Cancel |
| 600 |
} |
| 601 |
|
| 602 |
Label { |
| 603 |
text: qsTr("Permission") |
| 604 |
color: palette.text |
| 605 |
} |
| 606 |
|
| 607 |
Button { |
| 608 |
text: qsTr("Configure") |
| 609 |
ToolTip.text: qsTr("View and change the permissions in this room") |
| 610 |
onClicked: timelineRoot.showPLEditor(roomSettings) |
| 611 |
Layout.alignment: Qt.AlignRight |
| 612 |
} |
| 613 |
|
| 614 |
Label { |
| 615 |
text: qsTr("Aliases") |
| 616 |
color: palette.text |
| 617 |
} |
| 618 |
|
| 619 |
Button { |
| 620 |
text: qsTr("Configure") |
| 621 |
ToolTip.text: qsTr("View and change the addresses/aliases of this room") |
| 622 |
onClicked: timelineRoot.showAliasEditor(roomSettings) |
| 623 |
Layout.alignment: Qt.AlignRight |
| 624 |
} |
| 625 |
|
| 626 |
Label { |
| 627 |
text: qsTr("Sticker & Emote Settings") |
| 628 |
color: palette.text |
| 629 |
} |
| 630 |
|
| 631 |
Button { |
| 632 |
text: qsTr("Change") |
| 633 |
ToolTip.text: qsTr("Change what packs are enabled, remove packs, or create new ones") |
| 634 |
onClicked: TimelineManager.openImagePackSettings(roomSettings.roomId) |
| 635 |
Layout.alignment: Qt.AlignRight |
| 636 |
} |
| 637 |
|
| 638 |
Label { |
| 639 |
text: qsTr("INFO") |
| 640 |
font.bold: true |
| 641 |
color: palette.text |
| 642 |
Layout.columnSpan: 2 |
| 643 |
Layout.topMargin: Nheko.paddingLarge |
| 644 |
Layout.fillWidth: true |
| 645 |
} |
| 646 |
|
| 647 |
Label { |
| 648 |
text: qsTr("Internal ID") |
| 649 |
color: palette.text |
| 650 |
} |
| 651 |
|
| 652 |
AbstractButton { // AbstractButton does not allow setting text color |
| 653 |
Layout.alignment: Qt.AlignRight |
| 654 |
Layout.fillWidth: true |
| 655 |
Layout.preferredHeight: idLabel.height |
| 656 |
Label { // TextEdit does not trigger onClicked |
| 657 |
id: idLabel |
| 658 |
text: roomSettings.roomId |
| 659 |
textFormat: Text.PlainText |
| 660 |
font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8) |
| 661 |
color: palette.text |
| 662 |
width: parent.width |
| 663 |
horizontalAlignment: Text.AlignRight |
| 664 |
wrapMode: Text.WrapAnywhere |
| 665 |
ToolTip.text: qsTr("Copied to clipboard") |
| 666 |
ToolTip.visible: toolTipTimer.running |
| 667 |
} |
| 668 |
TextEdit{ // label does not allow selection |
| 669 |
id: textEdit |
| 670 |
textFormat: TextEdit.PlainText |
| 671 |
visible: false |
| 672 |
text: roomSettings.roomId |
| 673 |
} |
| 674 |
onClicked: { |
| 675 |
textEdit.selectAll() |
| 676 |
textEdit.copy() |
| 677 |
toolTipTimer.start() |
| 678 |
} |
| 679 |
Timer { |
| 680 |
id: toolTipTimer |
| 681 |
} |
| 682 |
} |
| 683 |
|
| 684 |
Label { |
| 685 |
text: qsTr("Room Version") |
| 686 |
color: palette.text |
| 687 |
} |
| 688 |
|
| 689 |
Label { |
| 690 |
text: roomSettings.roomVersion |
| 691 |
font.pixelSize: fontMetrics.font.pixelSize |
| 692 |
Layout.alignment: Qt.AlignRight |
| 693 |
color: palette.text |
| 694 |
} |
| 695 |
|
| 696 |
} |
| 697 |
} |
| 698 |
} |
| 699 |
Button { |
| 700 |
id: showMoreButton |
| 701 |
anchors.horizontalCenter: flickable.horizontalCenter |
| 702 |
y: Math.min(showMorePlaceholder.y+contentLayout1.y-flickable.contentY,flickable.height-height) |
| 703 |
visible: roomTopic.cut |
| 704 |
text: roomTopic.showMore? qsTr("show less") : qsTr("show more") |
| 705 |
onClicked: {roomTopic.showMore = !roomTopic.showMore |
| 706 |
console.log(flickable.visibleArea) |
| 707 |
} |
| 708 |
} |
| 709 |
footer: DialogButtonBox { |
| 710 |
standardButtons: DialogButtonBox.Ok |
| 711 |
onAccepted: close() |
| 712 |
} |
| 713 |
} |