diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/icons/ui/building-shop.svg | 1 | ||||
-rw-r--r-- | resources/icons/ui/room-directory.svg | 1 | ||||
-rw-r--r-- | resources/qml/RoomList.qml | 2 | ||||
-rw-r--r-- | resources/qml/Root.qml | 27 | ||||
-rw-r--r-- | resources/qml/dialogs/AliasEditor.qml | 172 | ||||
-rw-r--r-- | resources/qml/dialogs/RoomSettings.qml | 12 | ||||
-rw-r--r-- | resources/res.qrc | 3 |
7 files changed, 211 insertions, 7 deletions
diff --git a/resources/icons/ui/building-shop.svg b/resources/icons/ui/building-shop.svg new file mode 100644 index 00000000..32e1d9d9 --- /dev/null +++ b/resources/icons/ui/building-shop.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18 2a.75.75 0 0 1 .474.169l.076.07 3.272 3.53.03.038c.102.136.148.29.148.44L22 8.168c0 .994-.379 1.9-1 2.58V21.25a.75.75 0 0 1-.649.743L20.25 22H3.75a.75.75 0 0 1-.743-.648l-.007-.102V10.748a3.818 3.818 0 0 1-.993-2.353L2 8.167V6.29a.728.728 0 0 1 .096-.408l.065-.095.04-.046L5.45 2.24a.75.75 0 0 1 .447-.233L6 2h12Zm-2.918 8.442-.012.018A3.827 3.827 0 0 1 11.999 12a3.827 3.827 0 0 1-3.083-1.556A3.825 3.825 0 0 1 5.834 12c-.47 0-.919-.084-1.334-.238v8.738H6v-6.748a.75.75 0 0 1 .648-.743L6.75 13h4.496a.75.75 0 0 1 .743.648l.007.102v6.748h7.502v-8.737a3.827 3.827 0 0 1-4.416-1.32Zm-4.587 4.059H7.5v5.998h2.995v-5.998Zm6.76-1.5a.75.75 0 0 1 .743.648l.007.102v3.502a.75.75 0 0 1-.649.743l-.101.007h-3.502a.75.75 0 0 1-.743-.648l-.007-.102v-3.502a.75.75 0 0 1 .648-.743l.102-.007h3.502Zm-.751 1.5h-2.001v2.002h2v-2.002ZM8.166 7.002H3.5v1.165l.006.17.029.232.032.156.05.172.054.148.04.094c.032.068.066.134.104.198l.102.162.055.074.129.156.141.144.097.085.042.034c.314.25.695.422 1.111.483l.18.019.16.005c1.235 0 2.246-.959 2.328-2.173l.005-.16V7.003Zm6.165 0H9.666v1.165c0 1.18.878 2.157 2.016 2.311l.157.016.16.005c1.234 0 2.245-.959 2.327-2.173l.005-.16V7.003Zm6.167 0h-4.665v1.165c0 1.18.878 2.157 2.017 2.311l.156.016.16.005c.564 0 1.082-.2 1.485-.534l.09-.078.116-.113.146-.17c.054-.069.105-.14.15-.216l.104-.186.063-.138.058-.155.03-.096.038-.152.029-.157.018-.167.006-.17-.001-1.165ZM9.062 3.499H6.327L4.469 5.502h3.977l.616-2.003Zm4.306 0H10.63l-.616 2.003h3.97l-.616-2.003Zm4.304 0h-2.735l.617 2.003h3.976l-1.858-2.003Z" fill="#212121"/></svg> \ No newline at end of file diff --git a/resources/icons/ui/room-directory.svg b/resources/icons/ui/room-directory.svg new file mode 100644 index 00000000..30820243 --- /dev/null +++ b/resources/icons/ui/room-directory.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8.5 5.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM7.5 13.5a1 1 0 1 1 2 0 1 1 0 0 1-2 0ZM8.5 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM11 6.5a1 1 0 1 1 2 0 1 1 0 0 1-2 0ZM12 12.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM14.5 13.5a1 1 0 1 1 2 0 1 1 0 0 1-2 0ZM12 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" fill="#212121"/><path d="M6.25 2A2.25 2.25 0 0 0 4 4.25v16.5c0 .414.336.75.75.75h14.503a.75.75 0 0 0 .75-.75v-9a2.25 2.25 0 0 0-2.25-2.25H16.5V4.25A2.25 2.25 0 0 0 14.25 2h-8ZM5.5 4.25a.75.75 0 0 1 .75-.75h8a.75.75 0 0 1 .75.75v6c0 .414.336.75.75.75h2.003a.75.75 0 0 1 .75.75V20H16.5v-2.75a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0-.75.75V20h-2V4.25ZM15 18v2h-2.25v-2H15Zm-3.75 0v2H9v-2h2.25Z" fill="#212121"/></svg> \ No newline at end of file diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index f3509f06..a86ca725 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -750,7 +750,7 @@ Page { hoverEnabled: true width: 22 height: 22 - image: ":/icons/icons/ui/speech-bubbles.svg" + image: ":/icons/icons/ui/room-directory.svg" ToolTip.visible: hovered ToolTip.delay: Nheko.tooltipDelay ToolTip.text: qsTr("Room directory") diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index 1ea26742..7cc41db9 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -55,13 +55,28 @@ Pane { } - function showPLEditor(settings) { - var dialog = plEditor.createObject(timelineRoot, { - "roomSettings": settings - }); - dialog.show(); - destroyOnClose(dialog); + function showAliasEditor(settings) { + var dialog = aliasEditor.createObject(timelineRoot, { + "roomSettings": settings + }); + dialog.show(); + destroyOnClose(dialog); + } + + Component { + id: aliasEditor + + AliasEditor { } + } + + function showPLEditor(settings) { + var dialog = plEditor.createObject(timelineRoot, { + "roomSettings": settings + }); + dialog.show(); + destroyOnClose(dialog); + } Component { id: plEditor diff --git a/resources/qml/dialogs/AliasEditor.qml b/resources/qml/dialogs/AliasEditor.qml new file mode 100644 index 00000000..0d7b73fd --- /dev/null +++ b/resources/qml/dialogs/AliasEditor.qml @@ -0,0 +1,172 @@ +// SPDX-FileCopyrightText: 2022 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import ".." +import "../components" +import QtQuick 2.12 +import QtQuick.Controls 2.5 +import QtQuick.Layouts 1.3 +import im.nheko 1.0 + + +ApplicationWindow { + id: aliasEditorW + + property var roomSettings + property var editingModel: Nheko.editAliases(roomSettings.roomId) + + modality: Qt.NonModal + flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint + minimumWidth: 300 + minimumHeight: 400 + height: 600 + width: 500 + + title: qsTr("Aliases to %1").arg(roomSettings.roomName); + + // Shortcut { + // sequence: StandardKey.Cancel + // onActivated: dbb.rejected() + // } + + ColumnLayout { + anchors.margins: Nheko.paddingMedium + anchors.fill: parent + spacing: 0 + + + MatrixText { + text: qsTr("List of aliases to this room. Usually you can only add aliases on your server. You can have one canonical alias and many alternate aliases.") + font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 1.1) + Layout.fillWidth: true + Layout.fillHeight: false + color: Nheko.colors.text + Layout.bottomMargin: Nheko.paddingMedium + } + + ListView { + Layout.fillWidth: true + Layout.fillHeight: true + + id: view + + clip: true + + ScrollHelper { + flickable: parent + anchors.fill: parent + } + + model: editingModel + spacing: 4 + cacheBuffer: 50 + + delegate: RowLayout { + anchors.left: parent.left + anchors.right: parent.right + + Text { + Layout.fillWidth: true + text: model.name + color: model.isPublished ? Nheko.colors.text : Nheko.theme.error + textFormat: Text.PlainText + } + + ImageButton { + Layout.alignment: Qt.AlignRight + Layout.margins: 2 + image: ":/icons/icons/ui/star.svg" + hoverEnabled: true + buttonTextColor: model.isCanonical ? Nheko.colors.highlight : Nheko.colors.text + highlightColor: editingModel.canAdvertize ? Nheko.colors.highlight : buttonTextColor + + ToolTip.visible: hovered + ToolTip.text: model.isCanonical ? qsTr("Primary alias") : qsTr("Make primary alias") + + onClicked: editingModel.makeCanonical(model.index) + } + + ImageButton { + Layout.alignment: Qt.AlignRight + Layout.margins: 2 + image: ":/icons/icons/ui/building-shop.svg" + hoverEnabled: true + buttonTextColor: model.isAdvertized ? Nheko.colors.highlight : Nheko.colors.text + highlightColor: editingModel.canAdvertize ? Nheko.colors.highlight : buttonTextColor + + ToolTip.visible: hovered + ToolTip.text: qsTr("Advertise as an alias in this room") + + onClicked: editingModel.toggleAdvertize(model.index) + } + + ImageButton { + Layout.alignment: Qt.AlignRight + Layout.margins: 2 + image: ":/icons/icons/ui/room-directory.svg" + hoverEnabled: true + buttonTextColor: model.isPublished ? Nheko.colors.highlight : Nheko.colors.text + + ToolTip.visible: hovered + ToolTip.text: qsTr("Publish in room directory") + + onClicked: editingModel.togglePublish(model.index) + } + + ImageButton { + Layout.alignment: Qt.AlignRight + Layout.margins: 2 + image: ":/icons/icons/ui/dismiss.svg" + hoverEnabled: true + + ToolTip.visible: hovered + ToolTip.text: qsTr("Remove this alias") + + onClicked: editingModel.deleteAlias(model.index) + } + } + } + + RowLayout { + spacing: Nheko.paddingMedium + Layout.fillWidth: true + + TextField { + id: newAliasVal + + Layout.fillWidth: true + + placeholderText: qsTr("#new-alias:server.tld") + + Keys.onPressed: { + if (event.matches(StandardKey.InsertParagraphSeparator)) { + editingModel.addAlias(newAliasVal.text); + newAliasVal.clear(); + } + } + } + + Button { + text: qsTr("Add") + Layout.preferredWidth: 100 + onClicked: { + editingModel.addAlias(newAliasVal.text); + newAliasVal.clear(); + } + } + } + } + + footer: DialogButtonBox { + id: dbb + + standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel + onAccepted: { + editingModel.commit(); + aliasEditorW.close(); + } + onRejected: aliasEditorW.close(); + } + +} diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml index 2818a79a..431c9dd6 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml @@ -353,6 +353,18 @@ ApplicationWindow { } Label { + text: qsTr("Addresses") + color: Nheko.colors.text + } + + Button { + text: qsTr("Configure") + ToolTip.text: qsTr("View and change the addresses/aliases of this room") + onClicked: timelineRoot.showAliasEditor(roomSettings) + Layout.alignment: Qt.AlignRight + } + + Label { text: qsTr("Sticker & Emote Settings") color: Nheko.colors.text } diff --git a/resources/res.qrc b/resources/res.qrc index 6e3023ea..3ec24238 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -4,6 +4,7 @@ <file>icons/ui/angle-arrow-left.svg</file> <file>icons/ui/attach.svg</file> <file>icons/ui/ban.svg</file> + <file>icons/ui/building-shop.svg</file> <file>icons/ui/chat.svg</file> <file>icons/ui/checkmark.svg</file> <file>icons/ui/clock.svg</file> @@ -36,6 +37,7 @@ <file>icons/ui/reply.svg</file> <file>icons/ui/ribbon.svg</file> <file>icons/ui/ribbon_star.svg</file> + <file>icons/ui/room-directory.svg</file> <file>icons/ui/round-remove-button.svg</file> <file>icons/ui/screen-share.svg</file> <file>icons/ui/search.svg</file> @@ -147,6 +149,7 @@ <file>qml/device-verification/NewVerificationRequest.qml</file> <file>qml/device-verification/Success.qml</file> <file>qml/device-verification/Waiting.qml</file> + <file>qml/dialogs/AliasEditor.qml</file> <file>qml/dialogs/CreateDirect.qml</file> <file>qml/dialogs/CreateRoom.qml</file> <file>qml/dialogs/HiddenEventsDialog.qml</file> |