2022-01-11 09:38:27 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2022-04-16 03:13:01 +03:00
|
|
|
import "../"
|
2022-01-11 09:38:27 +03:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import QtQuick.Layouts 1.3
|
2022-04-15 03:58:44 +03:00
|
|
|
import im.nheko
|
2022-01-11 09:38:27 +03:00
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: hiddenEventsDialog
|
|
|
|
|
|
|
|
property var onAccepted: undefined
|
2022-04-16 03:13:01 +03:00
|
|
|
property string roomName: ""
|
|
|
|
property string roomid: ""
|
2022-01-11 09:38:27 +03:00
|
|
|
|
2022-01-13 01:26:50 +03:00
|
|
|
flags: Qt.Dialog | Qt.WindowTitleHint
|
2022-01-11 09:38:27 +03:00
|
|
|
minimumHeight: 220
|
2022-04-16 03:13:01 +03:00
|
|
|
minimumWidth: 250
|
|
|
|
modality: Qt.NonModal
|
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-04-16 03:13:01 +03:00
|
|
|
} else {
|
2022-01-13 01:52:32 +03:00
|
|
|
return qsTr("Hidden events");
|
|
|
|
}
|
|
|
|
}
|
2022-01-11 09:38:27 +03:00
|
|
|
|
2022-04-16 03:13:01 +03:00
|
|
|
footer: DialogButtonBox {
|
|
|
|
id: dbb
|
|
|
|
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
|
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
hiddenEvents.save();
|
|
|
|
hiddenEventsDialog.close();
|
|
|
|
}
|
|
|
|
onRejected: hiddenEventsDialog.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
HiddenEvents {
|
|
|
|
id: hiddenEvents
|
|
|
|
roomid: hiddenEventsDialog.roomid
|
|
|
|
}
|
2022-01-11 09:38:27 +03:00
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2022-01-11 09:38:27 +03:00
|
|
|
onActivated: dbb.rejected()
|
|
|
|
}
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2022-04-16 03:13:01 +03:00
|
|
|
anchors.margins: Nheko.paddingMedium
|
|
|
|
spacing: Nheko.paddingMedium
|
2022-01-11 09:38:27 +03:00
|
|
|
|
|
|
|
MatrixText {
|
|
|
|
id: promptLabel
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.fillHeight: false
|
|
|
|
Layout.fillWidth: true
|
|
|
|
font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 1.2)
|
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-04-16 03:13:01 +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
|
|
|
}
|
|
|
|
GridLayout {
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
2022-01-11 09:38:27 +03:00
|
|
|
columns: 2
|
|
|
|
rowSpacing: Nheko.paddingMedium
|
|
|
|
|
|
|
|
MatrixText {
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.fillWidth: true
|
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
|
2022-04-16 03:13:01 +03:00
|
|
|
text: qsTr("User events")
|
2022-01-11 09:38:27 +03:00
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hh1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Member)
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2022-02-12 21:27:51 +03:00
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.Member)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
MatrixText {
|
2022-04-16 03:13:01 +03:00
|
|
|
Layout.fillWidth: true
|
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
|
2022-04-16 03:13:01 +03:00
|
|
|
text: qsTr("Power level changes")
|
2022-01-11 09:38:27 +03:00
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hh2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.PowerLevels)
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2022-02-12 21:27:51 +03:00
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.PowerLevels)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
MatrixText {
|
|
|
|
Layout.fillWidth: true
|
2022-04-16 03:13:01 +03:00
|
|
|
text: qsTr("Stickers")
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
ToggleButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2022-02-12 21:27:51 +03:00
|
|
|
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Sticker)
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2022-02-12 21:27:51 +03:00
|
|
|
onToggled: hiddenEvents.toggle(MtxEvent.Sticker)
|
2022-01-11 09:38:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|