From 7f1708dacbd1595d49b3a55cf721fbd7fa024bfc Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 15 Jan 2026 11:44:22 +0100 Subject: [PATCH 1/2] fix call history list sorting #LINQT-2346 --- .../core/call-history/CallHistoryList.cpp | 2 +- .../core/call-history/CallHistoryProxy.cpp | 5 +---- .../Display/Call/CallHistoryListView.qml | 20 +++++++------------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Linphone/core/call-history/CallHistoryList.cpp b/Linphone/core/call-history/CallHistoryList.cpp index 58dec0086..8b02d5184 100644 --- a/Linphone/core/call-history/CallHistoryList.cpp +++ b/Linphone/core/call-history/CallHistoryList.cpp @@ -70,7 +70,7 @@ void CallHistoryList::setSelf(QSharedPointer me) { for (auto it : linphoneCallLogs) { auto model = createCallHistoryCore(it); toConnect(model.get()); - callLogs->push_back(model); + callLogs->push_front(model); } mModelConnection->invokeToCore([this, callLogs]() { mustBeInMainThread(getClassName()); diff --git a/Linphone/core/call-history/CallHistoryProxy.cpp b/Linphone/core/call-history/CallHistoryProxy.cpp index 1573e6430..f60385a13 100644 --- a/Linphone/core/call-history/CallHistoryProxy.cpp +++ b/Linphone/core/call-history/CallHistoryProxy.cpp @@ -68,8 +68,5 @@ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo } bool CallHistoryProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { - auto l = getItemAtSource(sourceLeft.row()); - auto r = getItemAtSource(sourceRight.row()); - if (l && r) return l->mDate < r->mDate; - return false; + return true; } diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 9592d1f39..89c023c2d 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -21,7 +21,6 @@ ListView { onResultsReceived: { loading = false - // contentY = 0 } model: CallHistoryProxy { @@ -49,13 +48,12 @@ ListView { Component.onCompleted: cacheBuffer = Math.max(mainItem.height,0) //contentHeight>0 ? contentHeight : 0// cache all items // remove binding loop - onContentHeightChanged: Qt.callLater(function () { - if (mainItem) - mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 - }) + // onContentHeightChanged: Qt.callLater(function () { + // if (mainItem) + // mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 + // }) - onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) - currentIndex = 0 + onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) currentIndex = 0 onCountChanged: { if (currentIndex < 0 && count > 0) { mainItem.currentIndex = 0 // Select first item after loading model @@ -86,8 +84,8 @@ ListView { // Update position only if we are moving to current item and its position is changing. property var _currentItemY: currentItem?.y on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { - moveToCurrentItem() - } + moveToCurrentItem() + } Behavior on contentY { NumberAnimation { id: moveAnimation @@ -98,10 +96,6 @@ ListView { } //---------------------------------------------------------------- - onVisibleChanged: { -// if (!visible) -// currentIndex = -1 - } BusyIndicator { anchors.horizontalCenter: mainItem.horizontalCenter From c756217b1651479b36c106e500914c852a4bf9cb Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 15 Jan 2026 12:17:21 +0100 Subject: [PATCH 2/2] try to reduce memory consumption when displaying an animated image #LINQT-2343 --- .../Display/Chat/AnimatedImageFileView.qml | 3 ++- .../view/Control/Display/Chat/ChatMessage.qml | 2 +- .../Control/Display/Chat/ChatMessageContent.qml | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml b/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml index b817cc9b5..a867711f3 100644 --- a/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml +++ b/Linphone/view/Control/Display/Chat/AnimatedImageFileView.qml @@ -24,7 +24,8 @@ AnimatedImage { autoTransform: true fillMode: Image.PreserveAspectFit source: contentGui && UtilsCpp.isAnimatedImage(contentGui.core.filePath) ? ('file:/'+ contentGui.core.filePath) : "" - + // sourceSize.width: implicitWidth + // sourceSize.height: implicitHeight states: State { name: 'hovered' } diff --git a/Linphone/view/Control/Display/Chat/ChatMessage.qml b/Linphone/view/Control/Display/Chat/ChatMessage.qml index dd41a9dac..8134dea90 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessage.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessage.qml @@ -27,7 +27,7 @@ Control.Control { property var msgState: chatMessage ? chatMessage.core.messageState : LinphoneEnums.ChatMessageState.StateIdle hoverEnabled: true 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 diff --git a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml index 024ed8890..e983b0f95 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessageContent.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessageContent.qml @@ -81,6 +81,7 @@ ColumnLayout { // SINGLE FILE ImageFileView { id: singleImageFile + cache: false visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isImage(contentGui.core.filePath) contentGui: mainItem.filescontentProxy.count === 1 ? mainItem.filescontentProxy.getChatMessageContentAtIndex(0) @@ -99,6 +100,22 @@ ColumnLayout { Layout.preferredHeight: paintedHeight Layout.alignment: Qt.AlignHCenter 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 { id: singleVideoFile