hide current call in transfer call list #LINQT-2256

This commit is contained in:
Gaelle Braud 2025-12-15 14:41:10 +01:00
parent 6657c26b87
commit 75ad42d5e8
7 changed files with 71 additions and 49 deletions

View file

@ -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<CallList>();
auto model = qobject_cast<CallList *>(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<CallList>()->setCurrentCall(call);
qobject_cast<CallList *>(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<CallList>();
auto model = qobject_cast<CallList *>(sourceModel());
return model ? model->getHaveCall() : false;
}
void CallProxy::setSourceModel(QAbstractItemModel *model) {
auto oldCallList = getListModel<CallList>();
auto oldCallList = qobject_cast<CallList *>(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<CallList *>(sourceModel());
auto call = callList->getAt<CallCore>(sourceRow);
if (!mShowCurrentCall && call == callList->getCurrentCallCore()) return false;
if (!show) {
QRegularExpression search(QRegularExpression::escape(mFilterText),
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption);
auto call = qobject_cast<CallList *>(sourceModel())->getAt<CallCore>(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<CallList, CallCore>(sourceLeft.row());
auto r = getItemAtSource<CallList, CallCore>(sourceRight.row());

View file

@ -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
};

View file

@ -1105,49 +1105,49 @@
<context>
<name>CallListView</name>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="60"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<source>meeting</source>
<extracomment>&quot;Réunion</extracomment>
<translation>Besprechung</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="64"/>
<source>call</source>
<extracomment>&quot;Appel&quot;</extracomment>
<translation>Anruf</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="67"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<source>paused_call_or_meeting</source>
<extracomment>&quot;%1 en pause&quot;</extracomment>
<translation>%1 pausiert</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="71"/>
<source>ongoing_call_or_meeting</source>
<extracomment>&quot;%1 en cours&quot;</extracomment>
<translation>%1 laufend</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="89"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="91"/>
<source>transfer_call_name_accessible_name</source>
<extracomment>Transfer call %1</extracomment>
<translation>Anruf %1 weiterleiten</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="117"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<source>resume_call_name_accessible_name</source>
<extracomment>Resume %1 call</extracomment>
<translation>Anruf %1 fortsetzen</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="121"/>
<source>pause_call_name_accessible_name</source>
<extracomment>Pause %1 call</extracomment>
<translation>Anruf %1 pausieren</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="142"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="144"/>
<source>end_call_name_accessible_name</source>
<extracomment>End %1 call</extracomment>
<translation>Anruf %1 beenden</translation>
@ -4996,7 +4996,7 @@ Ablauf: %1</translation>
<context>
<name>NewCallForm</name>
<message>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="24"/>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="25"/>
<source>call_transfer_active_calls_label</source>
<extracomment>&quot;Appels en cours&quot;</extracomment>
<translation>Laufender Anruf</translation>

View file

@ -1086,49 +1086,49 @@
<context>
<name>CallListView</name>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="60"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<source>meeting</source>
<extracomment>&quot;Réunion</extracomment>
<translation>Meeting</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="64"/>
<source>call</source>
<extracomment>&quot;Appel&quot;</extracomment>
<translation>Call</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="67"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<source>paused_call_or_meeting</source>
<extracomment>&quot;%1 en pause&quot;</extracomment>
<translation>%1 paused</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="71"/>
<source>ongoing_call_or_meeting</source>
<extracomment>&quot;%1 en cours&quot;</extracomment>
<translation>Ongoing %1</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="89"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="91"/>
<source>transfer_call_name_accessible_name</source>
<extracomment>Transfer call %1</extracomment>
<translation>Transfer call %1</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="117"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<source>resume_call_name_accessible_name</source>
<extracomment>Resume %1 call</extracomment>
<translation>Resume %1 call</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="121"/>
<source>pause_call_name_accessible_name</source>
<extracomment>Pause %1 call</extracomment>
<translation>Pause %1 call</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="142"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="144"/>
<source>end_call_name_accessible_name</source>
<extracomment>End %1 call</extracomment>
<translation>End %1 call</translation>
@ -4890,7 +4890,7 @@ Expiration : %1</translation>
<context>
<name>NewCallForm</name>
<message>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="24"/>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="25"/>
<source>call_transfer_active_calls_label</source>
<extracomment>&quot;Appels en cours&quot;</extracomment>
<translation>Ongoing call</translation>

View file

@ -1081,49 +1081,49 @@
<context>
<name>CallListView</name>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="60"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<source>meeting</source>
<extracomment>&quot;Réunion</extracomment>
<translation>Réunion</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="62"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="64"/>
<source>call</source>
<extracomment>&quot;Appel&quot;</extracomment>
<translation>Appel</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="67"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<source>paused_call_or_meeting</source>
<extracomment>&quot;%1 en pause&quot;</extracomment>
<translation>%1 en pause</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="69"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="71"/>
<source>ongoing_call_or_meeting</source>
<extracomment>&quot;%1 en cours&quot;</extracomment>
<translation>%1 en cours</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="89"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="91"/>
<source>transfer_call_name_accessible_name</source>
<extracomment>Transfer call %1</extracomment>
<translation>Transférer l&apos;appel %1</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="117"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<source>resume_call_name_accessible_name</source>
<extracomment>Resume %1 call</extracomment>
<translation>Reprendre l&apos;appel %1</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="119"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="121"/>
<source>pause_call_name_accessible_name</source>
<extracomment>Pause %1 call</extracomment>
<translation>Mettre l&apos;appel %1 en pause</translation>
</message>
<message>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="142"/>
<location filename="../../view/Control/Display/Call/CallListView.qml" line="144"/>
<source>end_call_name_accessible_name</source>
<extracomment>End %1 call</extracomment>
<translation>Terminer l&apos;appel %1</translation>
@ -4885,7 +4885,7 @@ Expiration : %1</translation>
<context>
<name>NewCallForm</name>
<message>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="24"/>
<location filename="../../view/Page/Form/Call/NewCallForm.qml" line="25"/>
<source>call_transfer_active_calls_label</source>
<extracomment>&quot;Appels en cours&quot;</extracomment>
<translation>Appels en cours</translation>

View file

@ -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

View file

@ -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 {