diff options
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/MessageView.qml | 184 | ||||
-rw-r--r-- | resources/qml/delegates/Encrypted.qml | 33 | ||||
-rw-r--r-- | resources/qml/delegates/EncryptionEnabled.qml | 47 | ||||
-rw-r--r-- | resources/qml/delegates/FileMessage.qml | 36 | ||||
-rw-r--r-- | resources/qml/delegates/Redacted.qml | 1 |
5 files changed, 249 insertions, 52 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 417a4f5a..2f50789f 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -203,7 +203,7 @@ Item { color: type == MtxEvent.NoticeMessage ? palette.buttonText : palette.text font.italic: type == MtxEvent.NoticeMessage - formatted: formattedBody + "a" + formatted: formattedBody Layout.fillWidth: true //Layout.maximumWidth: implicitWidth @@ -262,6 +262,7 @@ Item { text: formattedStateEvent formatted: '' body: '' + horizontalAlignment: Text.AlignHCenter color: palette.buttonText font.italic: true @@ -274,6 +275,79 @@ Item { EventDelegateChoice { roleValues: [ + MtxEvent.CallInvite, + ] + TextMessage { + keepFullText: true + + required property string userId + required property string userName + required property string callType + + isOnlyEmoji: false + body: formatted + formatted: { + switch (callType) { + case "voice": + return qsTr("%1 placed a voice call.").arg(TimelineManager.escapeEmoji(userName)); + case "video": + return qsTr("%1 placed a video call.").arg(TimelineManager.escapeEmoji(userName)); + default: + return qsTr("%1 placed a call.").arg(TimelineManager.escapeEmoji(userName)); + } + } + + color: palette.buttonText + font.italic: true + + Layout.fillWidth: true + } + } + + EventDelegateChoice { + roleValues: [ + MtxEvent.CallAnswer, + MtxEvent.CallReject, + MtxEvent.CallSelectAnswer, + MtxEvent.CallHangUp, + MtxEvent.CallCandidates, + MtxEvent.CallNegotiate, + ] + TextMessage { + keepFullText: true + + required property string userId + required property string userName + required property int type + + isOnlyEmoji: false + body: formatted + formatted: { + switch (type) { + case MtxEvent.CallAnswer: + return qsTr("%1 answered the call.").arg(TimelineManager.escapeEmoji(userName)); + case MtxEvent.CallReject: + return qsTr("%1 rejected the call.").arg(TimelineManager.escapeEmoji(userName)); + case MtxEvent.CallSelectAnswer: + return qsTr("%1 selected answer.").arg(TimelineManager.escapeEmoji(userName)); + case MtxEvent.CallHangUp: + return qsTr("%1 ended the call.").arg(TimelineManager.escapeEmoji(userName)); + case MtxEvent.CallCandidates: + return qsTr("%1 is negotiating the call...").arg(TimelineManager.escapeEmoji(userName)); + case MtxEvent.CallNegotiate: + return qsTr("%1 is negotiating the call...").arg(TimelineManager.escapeEmoji(userName)); + } + } + + color: palette.buttonText + font.italic: true + + Layout.fillWidth: true + } + } + + EventDelegateChoice { + roleValues: [ MtxEvent.ImageMessage, MtxEvent.Sticker, ] @@ -287,6 +361,44 @@ Item { EventDelegateChoice { roleValues: [ + MtxEvent.FileMessage, + ] + FileMessage { + Layout.fillWidth: true + } + } + + EventDelegateChoice { + roleValues: [ + MtxEvent.VideoMessage, + MtxEvent.AudioMessage, + ] + PlayableMediaMessage { + Layout.fillWidth: true + } + } + + EventDelegateChoice { + roleValues: [ + MtxEvent.Encrypted, + ] + Encrypted { + Layout.fillWidth: true + } + } + + EventDelegateChoice { + roleValues: [ + MtxEvent.Encryption, + ] + EncryptionEnabled { + Layout.fillWidth: true + } + } + + + EventDelegateChoice { + roleValues: [ MtxEvent.Redacted ] @@ -300,6 +412,76 @@ Item { EventDelegateChoice { roleValues: [ + MtxEvent.Member + ] + + ColumnLayout { + id: member + + required property string userId + required property string userName + + required property bool isReply + required property Room room + required property string formattedStateEvent + + NoticeMessage { + body: formatted + isOnlyEmoji: false + isReply: tombstone.isReply + keepFullText: true + isStateEvent: true + Layout.fillWidth: true + formatted: member.formattedStateEvent + } + + Button { + visible: room.showAcceptKnockButton(eventId) + Layout.alignment: Qt.AlignHCenter + text: qsTr("Allow them in") + onClicked: room.acceptKnock(member.eventId) + } + + } + } + + EventDelegateChoice { + roleValues: [ + MtxEvent.Tombstone + ] + + ColumnLayout { + id: tombstone + + required property string userId + required property string userName + + required property string body + required property bool isReply + required property Room room + required property string eventId + + NoticeMessage { + body: formatted + isOnlyEmoji: false + isReply: tombstone.isReply + keepFullText: true + isStateEvent: true + Layout.fillWidth: true + formatted: qsTr("This room was replaced for the following reason: %1").arg(tombstone.body) + } + + Button { + Layout.alignment: Qt.AlignHCenter + text: qsTr("Go to replacement room") + onClicked: tombstone.room.joinReplacementRoom(tombstone.eventId) + } + + } + } + + EventDelegateChoice { + roleValues: [ ] MatrixText { Layout.fillWidth: true diff --git a/resources/qml/delegates/Encrypted.qml b/resources/qml/delegates/Encrypted.qml index fdfe958e..7aeeb28a 100644 --- a/resources/qml/delegates/Encrypted.qml +++ b/resources/qml/delegates/Encrypted.qml @@ -8,37 +8,34 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import im.nheko 1.0 -Rectangle { +Control { id: r required property int encryptionError required property string eventId - radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium - width: parent.width? parent.width : 0 - implicitWidth: encryptedText.implicitWidth+24+Nheko.paddingMedium*3 // Column doesn't provide a useful implicitWidth, should be replaced by ColumnLayout - height: contents.implicitHeight + Nheko.paddingMedium * 2 - color: palette.alternateBase + padding: Nheko.paddingMedium + implicitHeight: contents.implicitHeight + Nheko.paddingMedium * 2 + Layout.maximumWidth: contents.Layout.maximumWidth + padding * 2 + Layout.fillWidth: true - RowLayout { + contentItem: RowLayout { id: contents - anchors.fill: parent - anchors.margins: Nheko.paddingMedium spacing: Nheko.paddingMedium Image { source: "image://colorimage/:/icons/icons/ui/shield-filled-cross.svg?" + Nheko.theme.error Layout.alignment: Qt.AlignVCenter - width: 24 - height: width + Layout.preferredWidth: 24 + Layout.preferredHeight: 24 } - Column { + ColumnLayout { spacing: Nheko.paddingSmall Layout.fillWidth: true - MatrixText { + Label { id: encryptedText text: { switch (encryptionError) { @@ -58,8 +55,11 @@ Rectangle { return qsTr("Unknown decryption error"); } } + textFormat: Text.PlainText + wrapMode: Label.WordWrap color: palette.text - width: parent.width + Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + 1 } Button { @@ -72,4 +72,9 @@ Rectangle { } + background: Rectangle { + color: palette.alternateBase + radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingMedium + visible: !Settings.bubbles // the bubble in a bubble looks odd + } } diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml index 0e2b7fc0..40894543 100644 --- a/resources/qml/delegates/EncryptionEnabled.qml +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -3,27 +3,24 @@ // SPDX-License-Identifier: GPL-3.0-or-later import ".." -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import im.nheko 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import im.nheko -Rectangle { +Control { id: r - required property string username + required property string userName - radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium - width: parent.width ? Math.min(parent.width, 700) : 0 - height: contents.implicitHeight + Nheko.paddingMedium * 2 - color: palette.alternateBase - border.color: Nheko.theme.green - border.width: 2 + padding: Nheko.paddingMedium + //implicitHeight: contents.implicitHeight + padd * 2 + Layout.maximumWidth: contents.Layout.maximumWidth + padding * 2 + Layout.fillWidth: true - RowLayout { + contentItem: RowLayout { id: contents - anchors.fill: parent - anchors.margins: Nheko.paddingMedium spacing: Nheko.paddingMedium Image { @@ -33,26 +30,36 @@ Rectangle { Layout.preferredHeight: 24 } - Column { + ColumnLayout { spacing: Nheko.paddingSmall Layout.fillWidth: true MatrixText { - text: qsTr("%1 enabled end-to-end encryption").arg(r.username) + text: qsTr("%1 enabled end-to-end encryption").arg(r.userName) font.bold: true font.pointSize: 14 color: palette.text - width: parent.width + Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + 1 } - MatrixText { + Label { text: qsTr("Encryption keeps your messages safe by only allowing the people you sent the message to to read it. For extra security, if you want to make sure you are talking to the right people, you can verify them in real life.") - color: palette.text - width: parent.width + textFormat: Text.PlainText + wrapMode: Label.WordWrap + Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + 1 } } } + background: Rectangle { + radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium + height: contents.implicitHeight + Nheko.paddingMedium * 2 + color: palette.alternateBase + border.color: Nheko.theme.green + border.width: 2 + } } diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml index 82b82c1b..9f350123 100644 --- a/resources/qml/delegates/FileMessage.qml +++ b/resources/qml/delegates/FileMessage.qml @@ -2,26 +2,30 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.12 -import QtQuick.Layouts 1.2 -import im.nheko 1.0 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import im.nheko + +Control { + id: evRoot -Item { required property string eventId required property string filename required property string filesize - height: rowa.height + (Settings.bubbles? 16: 24) - implicitWidth: rowa.implicitWidth + metadataWidth - property int metadataWidth - property bool fitsMetadata: true + padding: Settings.bubbles? 8 : 12 + //Layout.preferredHeight: rowa.implicitHeight + padding + //Layout.maximumWidth: rowa.Layout.maximumWidth + metadataWidth + padding + property int metadataWidth: 0 + property bool fitsMetadata: false + + Layout.maximumWidth: rowa.Layout.maximumWidth + padding * 2 - RowLayout { + contentItem: RowLayout { id: rowa - anchors.centerIn: parent - width: parent.width - (Settings.bubbles? 16 : 24) - spacing: 15 + spacing: 16 Rectangle { id: button @@ -63,6 +67,7 @@ Item { id: filename_ Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + 1 text: filename textFormat: Text.PlainText elide: Text.ElideRight @@ -73,6 +78,7 @@ Item { id: filesize_ Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + 1 text: filesize textFormat: Text.PlainText elide: Text.ElideRight @@ -83,11 +89,9 @@ Item { } - Rectangle { + background: Rectangle { color: palette.alternateBase - z: -1 - radius: 10 - anchors.fill: parent + radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall visible: !Settings.bubbles // the bubble in a bubble looks odd } diff --git a/resources/qml/delegates/Redacted.qml b/resources/qml/delegates/Redacted.qml index 1bb3209f..3c496f08 100644 --- a/resources/qml/delegates/Redacted.qml +++ b/resources/qml/delegates/Redacted.qml @@ -36,7 +36,6 @@ Control { property var redactedPair: room.formatRedactedEvent(msgRoot.eventId) text: redactedPair["first"] wrapMode: Label.WordWrap - color: palette.text ToolTip.text: redactedPair["second"] ToolTip.visible: hh.hovered |