mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
try to reduce memory consumption when displaying an animated image #LINQT-2343
This commit is contained in:
parent
7f1708dacb
commit
c756217b16
3 changed files with 20 additions and 2 deletions
|
|
@ -24,7 +24,8 @@ AnimatedImage {
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: contentGui && UtilsCpp.isAnimatedImage(contentGui.core.filePath) ? ('file:/'+ contentGui.core.filePath) : ""
|
source: contentGui && UtilsCpp.isAnimatedImage(contentGui.core.filePath) ? ('file:/'+ contentGui.core.filePath) : ""
|
||||||
|
// sourceSize.width: implicitWidth
|
||||||
|
// sourceSize.height: implicitHeight
|
||||||
states: State {
|
states: State {
|
||||||
name: 'hovered'
|
name: 'hovered'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Control.Control {
|
||||||
property var msgState: chatMessage ? chatMessage.core.messageState : LinphoneEnums.ChatMessageState.StateIdle
|
property var msgState: chatMessage ? chatMessage.core.messageState : LinphoneEnums.ChatMessageState.StateIdle
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
property bool linkHovered: false
|
property bool linkHovered: false
|
||||||
property real maxWidth: parent?.width || Utils.getSizeWithScreenRatio(300)
|
property real maxWidth: parent ? parent.width : Utils.getSizeWithScreenRatio(300)
|
||||||
|
|
||||||
leftPadding: isRemoteMessage ? Utils.getSizeWithScreenRatio(5) : 0
|
leftPadding: isRemoteMessage ? Utils.getSizeWithScreenRatio(5) : 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ ColumnLayout {
|
||||||
// SINGLE FILE
|
// SINGLE FILE
|
||||||
ImageFileView {
|
ImageFileView {
|
||||||
id: singleImageFile
|
id: singleImageFile
|
||||||
|
cache: false
|
||||||
visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isImage(contentGui.core.filePath)
|
visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isImage(contentGui.core.filePath)
|
||||||
contentGui: mainItem.filescontentProxy.count === 1
|
contentGui: mainItem.filescontentProxy.count === 1
|
||||||
? mainItem.filescontentProxy.getChatMessageContentAtIndex(0)
|
? mainItem.filescontentProxy.getChatMessageContentAtIndex(0)
|
||||||
|
|
@ -99,6 +100,22 @@ ColumnLayout {
|
||||||
Layout.preferredHeight: paintedHeight
|
Layout.preferredHeight: paintedHeight
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
cache: false
|
||||||
|
property int initialSourceWidth
|
||||||
|
property int initialSourceHeight
|
||||||
|
property bool initialization: true
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status == Image.Ready) {
|
||||||
|
if (singleAnimatedImageFile.initialization) {
|
||||||
|
initialSourceWidth = sourceSize.width
|
||||||
|
initialSourceHeight = sourceSize.height
|
||||||
|
singleAnimatedImageFile.initialization = false
|
||||||
|
}
|
||||||
|
var sourceW = Math.min(initialSourceWidth, mainItem.maxWidth)
|
||||||
|
sourceSize.height = Math.round((sourceW/initialSourceWidth) * initialSourceHeight)
|
||||||
|
sourceSize.width = sourceW
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
VideoFileView {
|
VideoFileView {
|
||||||
id: singleVideoFile
|
id: singleVideoFile
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue