summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2020-05-14 20:53:01 -0400
committerJoseph Donofry <joedonofry@gmail.com>2020-05-14 20:53:01 -0400
commit6d2789f4d5ffcd4e3e6ad8dfaae6925b0bf7d6ae (patch)
tree2ce43f344f002d2747f5f68b9d87b81873ed87ce /resources/qml
parentUpdate emoji picker and translations (diff)
parentMerge branch 'master' of ssh://github.com/Nheko-Reborn/nheko (diff)
downloadnheko-6d2789f4d5ffcd4e3e6ad8dfaae6925b0bf7d6ae.tar.xz
Merge master into reactions
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/EncryptionIndicator.qml19
-rw-r--r--resources/qml/ScrollHelper.qml2
-rw-r--r--resources/qml/TimelineRow.qml3
-rw-r--r--resources/qml/TimelineView.qml2
-rw-r--r--resources/qml/delegates/ImageMessage.qml7
-rw-r--r--resources/qml/delegates/MessageDelegate.qml2
-rw-r--r--resources/qml/delegates/NoticeMessage.qml2
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml10
-rw-r--r--resources/qml/delegates/Reply.qml1
-rw-r--r--resources/qml/delegates/TextMessage.qml2
10 files changed, 42 insertions, 8 deletions
diff --git a/resources/qml/EncryptionIndicator.qml b/resources/qml/EncryptionIndicator.qml

index 00fe2ee4..428c2fae 100644 --- a/resources/qml/EncryptionIndicator.qml +++ b/resources/qml/EncryptionIndicator.qml
@@ -3,13 +3,14 @@ import QtQuick.Controls 2.1 import im.nheko 1.0 Rectangle { + property bool encrypted: false id: indicator color: "transparent" width: 16 height: 16 ToolTip.visible: ma.containsMouse && indicator.visible - ToolTip.text: qsTr("Encrypted") + ToolTip.text: getEncryptionTooltip() MouseArea{ id: ma @@ -20,7 +21,21 @@ Rectangle { Image { id: stateImg anchors.fill: parent - source: "image://colorimage/:/icons/icons/ui/lock.png?"+colors.buttonText + source: getEncryptionImage() + } + + function getEncryptionImage() { + if (encrypted) + return "image://colorimage/:/icons/icons/ui/lock.png?"+colors.buttonText + else + return "image://colorimage/:/icons/icons/ui/unlock.png?#dd3d3d" + } + + function getEncryptionTooltip() { + if (encrypted) + return qsTr("Encrypted") + else + return qsTr("This message is not encrypted!") } } diff --git a/resources/qml/ScrollHelper.qml b/resources/qml/ScrollHelper.qml
index 3a8868f5..cdb4a23a 100644 --- a/resources/qml/ScrollHelper.qml +++ b/resources/qml/ScrollHelper.qml
@@ -71,6 +71,8 @@ MouseArea { pixelDelta = wheel.pixelDelta.y } + pixelDelta = Math.round(pixelDelta) + if (!pixelDelta) { return flickableItem.contentY; } diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 214f2002..9fc98419 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml
@@ -67,7 +67,8 @@ MouseArea { } EncryptionIndicator { - visible: model.isEncrypted + visible: model.isRoomEncrypted + encrypted: model.isEncrypted Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index edb25441..ea5e6d60 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -125,6 +125,8 @@ Page { visible: timelineManager.timeline != null + cacheBuffer: 500 + anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index c7e6d127..62d9de60 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml
@@ -6,10 +6,11 @@ Item { property double tempWidth: Math.min(parent ? parent.width : undefined, model.data.width < 1 ? parent.width : model.data.width) property double tempHeight: tempWidth * model.data.proportionalHeight - property bool tooHigh: tempHeight > timelineRoot.height / 2 + property double divisor: model.isReply ? 4 : 2 + property bool tooHigh: tempHeight > timelineRoot.height / divisor - height: tooHigh ? timelineRoot.height / 2 : tempHeight - width: tooHigh ? (timelineRoot.height / 2) / model.data.proportionalHeight : tempWidth + height: tooHigh ? timelineRoot.height / divisor : tempHeight + width: tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth Image { id: blurhash diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index ff103459..17fe7360 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -6,9 +6,11 @@ Item { Item { id: model property var data; + property bool isReply: false } property alias modelData: model.data + property alias isReply: model.isReply height: chooser.childrenRect.height property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width diff --git a/resources/qml/delegates/NoticeMessage.qml b/resources/qml/delegates/NoticeMessage.qml
index 62ada6d1..be348329 100644 --- a/resources/qml/delegates/NoticeMessage.qml +++ b/resources/qml/delegates/NoticeMessage.qml
@@ -1,4 +1,6 @@ TextMessage { font.italic: true color: colors.buttonText + height: isReply ? Math.min(chat.height / 8, implicitHeight) : undefined + clip: true } diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 20177a04..bab524eb 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -20,8 +20,14 @@ Rectangle { Rectangle { id: videoContainer visible: model.data.type == MtxEvent.VideoMessage - width: Math.min(parent.width, model.data.width ? model.data.width : 400) // some media has 0 as size... - height: width*model.data.proportionalHeight + property double tempWidth: Math.min(parent ? parent.width : undefined, model.data.width < 1 ? 400 : model.data.width) + property double tempHeight: tempWidth * model.data.proportionalHeight + + property double divisor: model.isReply ? 4 : 2 + property bool tooHigh: tempHeight > timelineRoot.height / divisor + + height: tooHigh ? timelineRoot.height / divisor : tempHeight + width: tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth Image { anchors.fill: parent source: model.data.thumbnailUrl.replace("mxc://", "image://MxcImage/") diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 90013de9..f9fd3f11 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -51,6 +51,7 @@ Item { MessageDelegate { id: reply width: parent.width + isReply: true } } diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index 7e4b1f29..bef4f76d 100644 --- a/resources/qml/delegates/TextMessage.qml +++ b/resources/qml/delegates/TextMessage.qml
@@ -4,4 +4,6 @@ MatrixText { property string formatted: model.data.formattedBody text: "<style type=\"text/css\">a { color:"+colors.link+";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap'>") width: parent ? parent.width : undefined + height: isReply ? Math.min(chat.height / 8, implicitHeight) : undefined + clip: true }