diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-10-09 00:36:03 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-11-23 20:06:15 +0100 |
commit | 8ebef4eed2134179e5609104eb72fe8f055a35f1 (patch) | |
tree | 7941398fe157409e3c0cb2a9663604ec12d0b72c /resources | |
parent | Misc layout fixes (diff) | |
download | nheko-8ebef4eed2134179e5609104eb72fe8f055a35f1.tar.xz |
Size images/videos by timeline width
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/delegates/ImageMessage.qml | 4 | ||||
-rw-r--r-- | resources/qml/delegates/PlayableMediaMessage.qml | 27 |
2 files changed, 22 insertions, 9 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index 70d2debe..f1e95e3d 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -3,8 +3,8 @@ import QtQuick 2.6 import com.github.nheko 1.0 Item { - width: 300 - height: 300 * model.proportionalHeight + width: Math.min(parent.width, model.width) + height: width * model.proportionalHeight Image { id: img diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml index c716d21d..3a518617 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml @@ -6,26 +6,38 @@ import QtMultimedia 5.6 import com.github.nheko 1.0 Rectangle { + id: bg radius: 10 color: colors.dark height: content.height + 24 width: parent.width - ColumnLayout { + Column { id: content width: parent.width - 24 anchors.centerIn: parent - VideoOutput { + Rectangle { + id: videoContainer visible: model.type == MtxEvent.VideoMessage - Layout.maximumHeight: 300 - Layout.minimumHeight: 300 - Layout.maximumWidth: 500 - fillMode: VideoOutput.PreserveAspectFit - source: media + width: Math.min(parent.width, model.width) + height: width*model.proportionalHeight + Image { + anchors.fill: parent + source: model.thumbnailUrl.replace("mxc://", "image://MxcImage/") + asynchronous: true + fillMode: Image.PreserveAspectFit + + VideoOutput { + anchors.fill: parent + fillMode: VideoOutput.PreserveAspectFit + source: media + } + } } RowLayout { + width: parent.width Text { id: positionText text: "--:--:--" @@ -102,6 +114,7 @@ Rectangle { id: media onError: console.log(errorString) onStatusChanged: if(status == MediaPlayer.Loaded) progress.updatePositionTexts() + onStopped: button.state = "stopped" } Connections { |