summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/MessageInput.qml2
-rw-r--r--resources/qml/MessageInputWarning.qml47
-rw-r--r--resources/qml/NotificationWarning.qml38
-rw-r--r--resources/qml/TimelineView.qml15
4 files changed, 63 insertions, 39 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml

index 6029a31d..6ddbb32e 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml
@@ -14,6 +14,8 @@ import im.nheko 1.0 Rectangle { id: inputBar + readonly property string text: messageInput.text + color: Nheko.colors.window Layout.fillWidth: true Layout.preferredHeight: row.implicitHeight diff --git a/resources/qml/MessageInputWarning.qml b/resources/qml/MessageInputWarning.qml new file mode 100644
index 00000000..9b0b0907 --- /dev/null +++ b/resources/qml/MessageInputWarning.qml
@@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.2 +import im.nheko 1.0 + +Rectangle { + id: warningRoot + + required property string text + property color bubbleColor: Nheko.theme.error + + implicitHeight: visible ? warningDisplay.implicitHeight + 4 * Nheko.paddingSmall : 0 + height: implicitHeight + Layout.fillWidth: true + color: Nheko.colors.window // required to hide the timeline behind this warning + + Rectangle { + id: warningRect + + visible: warningRoot.visible + // TODO: Qt.alpha() would make more sense but it wasn't working... + color: Qt.rgba(bubbleColor.r, bubbleColor.g, bubbleColor.b, 0.3) + border.width: 1 + border.color: bubbleColor + radius: 3 + anchors.fill: parent + anchors.margins: visible ? Nheko.paddingSmall : 0 + z: 3 + + Label { + id: warningDisplay + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Nheko.paddingSmall + color: Nheko.colors.text + text: warningRoot.text + textFormat: Text.PlainText + } + + } + +} diff --git a/resources/qml/NotificationWarning.qml b/resources/qml/NotificationWarning.qml deleted file mode 100644
index cc318843..00000000 --- a/resources/qml/NotificationWarning.qml +++ /dev/null
@@ -1,38 +0,0 @@ -// SPDX-FileCopyrightText: Nheko Contributors -// -// SPDX-License-Identifier: GPL-3.0-or-later - -import QtQuick 2.9 -import QtQuick.Controls 2.3 -import QtQuick.Layouts 1.2 -import im.nheko 1.0 - -Item { - implicitHeight: warningRect.visible ? warningDisplay.implicitHeight : 0 - height: implicitHeight - Layout.fillWidth: true - - Rectangle { - id: warningRect - - visible: (room && room.permissions.canPingRoom() && room.input.containsAtRoom) - color: Nheko.colors.base - anchors.fill: parent - z: 3 - - Label { - id: warningDisplay - - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.bottom: parent.bottom - color: Nheko.theme.red - text: qsTr("You are about to notify the whole room") - textFormat: Text.PlainText - } - - } - -} diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index c7b554b8..70347009 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -153,7 +153,20 @@ Item { UploadBox { } - NotificationWarning { + MessageInputWarning { + text: qsTr("You are about to notify the whole room") + visible: (room && room.permissions.canPingRoom() && room.input.containsAtRoom) + } + + MessageInputWarning { + text: qsTr("The command /%1 is not recognized and will be sent as part of your message").arg(room ? room.input.currentCommand : "") + visible: room ? room.input.containsInvalidCommand && !room.input.containsIncompleteCommand : false + } + + MessageInputWarning { + text: qsTr("/%1 looks like an incomplete command. To send it anyway, add a space to the end of your message.").arg(room ? room.input.currentCommand : "") + visible: room ? room.input.containsIncompleteCommand : false + bubbleColor: Nheko.theme.orange } ReplyPopup {