2023-02-22 01:48:49 +03:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2022-01-11 09:38:27 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import ".."
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: hiddenEventsDialog
|
|
|
|
|
2022-02-12 21:27:51 +03:00
|
|
|
property string roomid: ""
|
|
|
|
property string roomName: ""
|
2022-01-11 09:38:27 +03:00
|
|
|
property var onAccepted: undefined
|
|
|
|
|
|
|
|
modality: Qt.NonModal
|
2022-01-13 01:26:50 +03:00
|
|
|
flags: Qt.Dialog | Qt.WindowTitleHint
|
2022-04-22 06:19:14 +03:00
|
|
|
width: 275
|
|
|
|
height: 220
|
2022-01-11 09:38:27 +03:00
|
|
|
minimumWidth: 250
|
|
|
|
minimumHeight: 220
|
2022-02-12 21:27:51 +03:00
|
|
|
|
|
|
|
HiddenEvents {
|
|
|
|
id: hiddenEvents
|
|
|
|
|
|
|
|
roomid: hiddenEventsDialog.roomid
|
|
|
|
}
|
|
|
|
|
2022-01-13 01:52:32 +03:00
|
|
|
title: {
|
2022-02-12 21:27:51 +03:00
|
|
|
if (roomid) {
|
|
|
|
return qsTr("Hidden events for %1").arg(roomName);
|
2022-01-13 01:52:32 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return qsTr("Hidden events");
|
|
|
|
}
|
|
|
|
}
|
2022-01-11 09:38:27 +03:00
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
|
|
|
onActivated: dbb.rejected()
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: Nheko.paddingMedium
|
|
|
|
anchors.margins: Nheko.paddingMedium
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
id: promptLabel
|
2022-01-13 01:52:32 +03:00
|
|
|
text: {
|
2022-02-12 21:27:51 +03:00
|
|
|
if (roomid) {
|
2022-03-03 00:52:34 +03:00
|
|
|
return qsTr("These events will be <b>shown</b> in %1:").arg(roomName);
|
2022-01-13 01:52:32 +03:00
|
|
|
}
|
|
|
|
else {
|
2022-03-03 00:52:34 +03:00
|
|
|
return qsTr("These events will be <b>shown</b> in all rooms:");
|
2022-01-13 01:52:32 +03:00
|
|
|
}
|
|
|
|
}
|
2022-01-11 09:38:27 +03:00
|
|
|
font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 1.2)
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: false
|
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
|
|
|
rowSpacing: Nheko.paddingMedium
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: qsTr("User events")
|
2022-01-12 12:03:47 +03:00
|
|
|
ToolTip.text: qsTr("Joins, leaves, avatar and name changes, bans, …")
|
2022-01-11 09:38:27 +03:00
|
|
|
ToolTip.visible: hh1.hovered
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hh1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Member)
|
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.Member)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: qsTr("Power level changes")
|
2022-01-12 12:03:47 +03:00
|
|
|
ToolTip.text: qsTr("Sent when a moderator is added/removed or the permissions of a room are changed.")
|
2022-01-11 09:38:27 +03:00
|
|
|
ToolTip.visible: hh2.hovered
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hh2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.PowerLevels)
|
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.PowerLevels)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
text: qsTr("Stickers")
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Sticker)
|
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.Sticker)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
|
|
|
id: dbb
|
|
|
|
|
|
|
|
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
|
|
|
|
onAccepted: {
|
2022-02-12 21:27:51 +03:00
|
|
|
hiddenEvents.save();
|
2022-01-11 09:38:27 +03:00
|
|
|
hiddenEventsDialog.close();
|
|
|
|
}
|
2022-02-12 21:27:51 +03:00
|
|
|
onRejected: hiddenEventsDialog.close();
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|