From dab1c9068ac6d48a1faba54d7510deb360ae74e3 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Fri, 30 Jul 2021 22:13:58 -0400 Subject: QML the raw message dialog --- resources/qml/RawMessageDialog.qml | 46 ++++++++++++++++++++++++++++++++++++++ resources/qml/Root.qml | 8 +++++++ resources/qml/TimelineView.qml | 7 ++++++ 3 files changed, 61 insertions(+) create mode 100644 resources/qml/RawMessageDialog.qml (limited to 'resources/qml') diff --git a/resources/qml/RawMessageDialog.qml b/resources/qml/RawMessageDialog.qml new file mode 100644 index 00000000..62a5770f --- /dev/null +++ b/resources/qml/RawMessageDialog.qml @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import im.nheko 1.0 + +ApplicationWindow { + id: rawMessageRoot + + property alias rawMessage: rawMessageView.text + + x: MainWindow.x + (MainWindow.width / 2) - (width / 2) + y: MainWindow.y + (MainWindow.height / 2) - (height / 2) + height: 420 + width: 420 + palette: Nheko.colors + color: Nheko.colors.window + flags: Qt.Tool | Qt.WindowStaysOnTopHint + + Shortcut { + sequence: StandardKey.Cancel + onActivated: rawMessageRoot.close() + } + + ScrollView { + anchors.fill: parent + palette: Nheko.colors + padding: Nheko.paddingMedium + + TextArea { + id: rawMessageView + + font: Nheko.monospaceFont() + palette: Nheko.colors + readOnly: true + } + + } + + footer: DialogButtonBox { + standardButtons: DialogButtonBox.Ok + onAccepted: rawMessageRoot.close() + } +} diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index 7d91beae..70cfbda5 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -104,6 +104,14 @@ Page { } + Component { + id: rawMessageDialog + + RawMessageDialog { + } + + } + Shortcut { sequence: "Ctrl+K" onActivated: { diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index d19f2cc9..e4036eb7 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -258,6 +258,13 @@ Item { dialog.show(); } + function onShowRawMessageDialog(rawMessage) { + var dialog = rawMessageDialog.createObject(timelineRoot, { + "rawMessage": rawMessage + }); + dialog.show(); + } + target: room } -- cgit 1.5.1