From 75ad42d5e80e673d09cd34bf46dc57861c7af92c Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Mon, 15 Dec 2025 14:41:10 +0100 Subject: [PATCH] hide current call in transfer call list #LINQT-2256 --- Linphone/core/call/CallProxy.cpp | 34 +++++++++++++------ Linphone/core/call/CallProxy.hpp | 15 +++++--- Linphone/data/languages/de.ts | 18 +++++----- Linphone/data/languages/en.ts | 18 +++++----- Linphone/data/languages/fr.ts | 18 +++++----- .../Control/Display/Call/CallListView.qml | 16 +++++---- Linphone/view/Page/Form/Call/NewCallForm.qml | 1 + 7 files changed, 71 insertions(+), 49 deletions(-) diff --git a/Linphone/core/call/CallProxy.cpp b/Linphone/core/call/CallProxy.cpp index 03a12bdde..743944e77 100644 --- a/Linphone/core/call/CallProxy.cpp +++ b/Linphone/core/call/CallProxy.cpp @@ -25,20 +25,32 @@ DEFINE_ABSTRACT_OBJECT(CallProxy) -CallProxy::CallProxy(QObject *parent) : LimitProxy(parent) { +CallProxy::CallProxy() : SortFilterProxy() { + mShowCurrentCall = true; } CallProxy::~CallProxy() { } CallGui *CallProxy::getCurrentCall() { - auto model = getListModel(); + auto model = qobject_cast(sourceModel()); if (!mCurrentCall && model) mCurrentCall = model->getCurrentCall(); return mCurrentCall; } +void CallProxy::setShowCurrentCall(bool show) { + if (mShowCurrentCall != show) { + mShowCurrentCall = show; + emit showCurrentCallChanged(); + } +} + +bool CallProxy::showCurrentCall() const { + return mShowCurrentCall; +} + void CallProxy::setCurrentCall(CallGui *call) { - getListModel()->setCurrentCall(call); + qobject_cast(sourceModel())->setCurrentCall(call); } // Reset the default account to let UI build its new object if needed. @@ -48,12 +60,12 @@ void CallProxy::resetCurrentCall() { } bool CallProxy::getHaveCall() const { - auto model = getListModel(); + auto model = qobject_cast(sourceModel()); return model ? model->getHaveCall() : false; } void CallProxy::setSourceModel(QAbstractItemModel *model) { - auto oldCallList = getListModel(); + auto oldCallList = qobject_cast(sourceModel()); if (oldCallList) { disconnect(oldCallList); } @@ -63,24 +75,24 @@ void CallProxy::setSourceModel(QAbstractItemModel *model) { connect(newCallList, &CallList::haveCallChanged, this, &CallProxy::haveCallChanged, Qt::QueuedConnection); connect(this, &CallProxy::lMergeAll, newCallList, &CallList::lMergeAll); } - setSourceModels(new SortFilterList(model)); + QSortFilterProxyModel::setSourceModel(model); } -bool CallProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { +bool CallProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { bool show = (mFilterText.isEmpty() || mFilterText == "*"); + auto callList = qobject_cast(sourceModel()); + auto call = callList->getAt(sourceRow); + if (!mShowCurrentCall && call == callList->getCurrentCallCore()) return false; if (!show) { QRegularExpression search(QRegularExpression::escape(mFilterText), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); - auto call = qobject_cast(sourceModel())->getAt(sourceRow); - show = call->getRemoteAddress().contains(search); } - return show; } -bool CallProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { +bool CallProxy::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { auto l = getItemAtSource(sourceLeft.row()); auto r = getItemAtSource(sourceRight.row()); diff --git a/Linphone/core/call/CallProxy.hpp b/Linphone/core/call/CallProxy.hpp index 591d0a06f..86ba42870 100644 --- a/Linphone/core/call/CallProxy.hpp +++ b/Linphone/core/call/CallProxy.hpp @@ -28,15 +28,14 @@ // ============================================================================= -class CallProxy : public LimitProxy, public AbstractObject { +class CallProxy : public SortFilterProxy, public AbstractObject { Q_OBJECT Q_PROPERTY(CallGui *currentCall READ getCurrentCall WRITE setCurrentCall NOTIFY currentCallChanged) Q_PROPERTY(bool haveCall READ getHaveCall NOTIFY haveCallChanged) + Q_PROPERTY(bool showCurrentCall READ showCurrentCall WRITE setShowCurrentCall NOTIFY showCurrentCallChanged) public: - DECLARE_SORTFILTER_CLASS() - - CallProxy(QObject *parent = Q_NULLPTR); + CallProxy(); ~CallProxy(); // Get a new object from List or give the stored one. @@ -48,15 +47,23 @@ public: bool getHaveCall() const; + void setShowCurrentCall(bool show); + bool showCurrentCall() const; + void setSourceModel(QAbstractItemModel *sourceModel) override; + virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; + virtual bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override; + signals: void lMergeAll(); void currentCallChanged(); void haveCallChanged(); + void showCurrentCallChanged(); protected: CallGui *mCurrentCall = nullptr; // When null, a new UI object is build from List + bool mShowCurrentCall = false; DECLARE_ABSTRACT_OBJECT }; diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 252ba4587..567ffd282 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -1105,49 +1105,49 @@ CallListView - + meeting "Réunion Besprechung - + call "Appel" Anruf - + paused_call_or_meeting "%1 en pause" %1 pausiert - + ongoing_call_or_meeting "%1 en cours" %1 laufend - + transfer_call_name_accessible_name Transfer call %1 Anruf %1 weiterleiten - + resume_call_name_accessible_name Resume %1 call Anruf %1 fortsetzen - + pause_call_name_accessible_name Pause %1 call Anruf %1 pausieren - + end_call_name_accessible_name End %1 call Anruf %1 beenden @@ -4996,7 +4996,7 @@ Ablauf: %1 NewCallForm - + call_transfer_active_calls_label "Appels en cours" Laufender Anruf diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index d06262eaa..6d73e9034 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -1086,49 +1086,49 @@ CallListView - + meeting "Réunion Meeting - + call "Appel" Call - + paused_call_or_meeting "%1 en pause" %1 paused - + ongoing_call_or_meeting "%1 en cours" Ongoing %1 - + transfer_call_name_accessible_name Transfer call %1 Transfer call %1 - + resume_call_name_accessible_name Resume %1 call Resume %1 call - + pause_call_name_accessible_name Pause %1 call Pause %1 call - + end_call_name_accessible_name End %1 call End %1 call @@ -4890,7 +4890,7 @@ Expiration : %1 NewCallForm - + call_transfer_active_calls_label "Appels en cours" Ongoing call diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 212adc53b..15dbabbb2 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -1081,49 +1081,49 @@ CallListView - + meeting "Réunion Réunion - + call "Appel" Appel - + paused_call_or_meeting "%1 en pause" %1 en pause - + ongoing_call_or_meeting "%1 en cours" %1 en cours - + transfer_call_name_accessible_name Transfer call %1 Transférer l'appel %1 - + resume_call_name_accessible_name Resume %1 call Reprendre l'appel %1 - + pause_call_name_accessible_name Pause %1 call Mettre l'appel %1 en pause - + end_call_name_accessible_name End %1 call Terminer l'appel %1 @@ -4885,7 +4885,7 @@ Expiration : %1 NewCallForm - + call_transfer_active_calls_label "Appels en cours" Appels en cours diff --git a/Linphone/view/Control/Display/Call/CallListView.qml b/Linphone/view/Control/Display/Call/CallListView.qml index 454d4eb70..ef6fee3be 100644 --- a/Linphone/view/Control/Display/Call/CallListView.qml +++ b/Linphone/view/Control/Display/Call/CallListView.qml @@ -11,19 +11,21 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils ListView { id: mainItem - model: CallProxy { - id: callProxy - sourceModel: AppCpp.calls - } implicitHeight: contentHeight spacing: Utils.getSizeWithScreenRatio(15) clip: true - onCountChanged: forceLayout() - - signal transferCallToAnotherRequested(CallGui dest) property bool isTransferList: false property string currentRemoteAddress: AppCpp.calls.currentCall ? AppCpp.calls.currentCall.core.remoteAddress : "" + signal transferCallToAnotherRequested(CallGui dest) + + onCountChanged: forceLayout() + + model: CallProxy { + id: callProxy + sourceModel: AppCpp.calls + showCurrentCall: !mainItem.isTransferList + } delegate: RowLayout { id: callInformationItem diff --git a/Linphone/view/Page/Form/Call/NewCallForm.qml b/Linphone/view/Page/Form/Call/NewCallForm.qml index 29801021c..cbbd9ae6c 100644 --- a/Linphone/view/Page/Form/Call/NewCallForm.qml +++ b/Linphone/view/Page/Form/Call/NewCallForm.qml @@ -20,6 +20,7 @@ CreationFormLayout { topLayoutVisible: mainItem.displayCurrentCalls && callList.count > 0 topContent: [ Text { + visible: callList.count > 0 //: "Appels en cours" text: qsTr("call_transfer_active_calls_label") font {