fix call proxy connect already connected to call list model when model changes...

This commit is contained in:
Gaëlle Braud 2025-02-27 18:02:34 +00:00
parent 5853314f28
commit d9fcdf6af6
3 changed files with 80 additions and 82 deletions

View file

@ -26,8 +26,6 @@
DEFINE_ABSTRACT_OBJECT(CallProxy) DEFINE_ABSTRACT_OBJECT(CallProxy)
CallProxy::CallProxy(QObject *parent) : LimitProxy(parent) { CallProxy::CallProxy(QObject *parent) : LimitProxy(parent) {
connect(this, &CallProxy::sourceModelChanged, this, &CallProxy::resetCurrentCall);
connect(this, &CallProxy::sourceModelChanged, this, &CallProxy::haveCallChanged);
} }
CallProxy::~CallProxy() { CallProxy::~CallProxy() {

View file

@ -486,8 +486,8 @@ ConferenceInfoGui{
Component { Component {
id: contactDetailComp id: contactDetailComp
FocusScope { FocusScope {
width: parent?.width // width: parent?.width
height: parent?.height // height: parent?.height
CallHistoryLayout { CallHistoryLayout {
id: contactDetail id: contactDetail
anchors.fill: parent anchors.fill: parent
@ -605,102 +605,102 @@ ConferenceInfoGui{
} }
} }
} }
detailContent: RoundedPane { detailContent: Item {
id: detailControl
Layout.preferredWidth: 360 * DefaultStyle.dp Layout.preferredWidth: 360 * DefaultStyle.dp
Layout.fillHeight: true Layout.fillHeight: true
RoundedPane {
// height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) + topPadding + bottomPadding id: detailControl
background: Rectangle { width: parent.width
id: detailListBackground height: Math.min(
anchors.fill: parent parent.height,
color: DefaultStyle.grey_0 detailListView.contentHeight) + topPadding + bottomPadding
radius: 15 * DefaultStyle.dp background: Rectangle {
} id: detailListBackground
anchors.fill: parent
contentItem: CallHistoryListView { color: DefaultStyle.grey_0
id: detailListView radius: 15 * DefaultStyle.dp
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 14 * DefaultStyle.dp
clip: true
searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : ""
busyIndicatorSize: 40 * DefaultStyle.dp
BusyIndicator {
anchors.horizontalCenter: detailListView.horizontalCenter
visible: detailListView.loading
&& detailListView.count === 0
height: visible ? detailListView.busyIndicatorSize : 0
width: detailListView.busyIndicatorSize
indicatorHeight: detailListView.busyIndicatorSize
indicatorWidth: detailListView.busyIndicatorSize
indicatorColor: DefaultStyle.main1_500_main
} }
delegate: Item { contentItem: CallHistoryListView {
width: detailListView.width id: detailListView
height: 56 * DefaultStyle.dp Layout.fillWidth: true
RowLayout { Layout.fillHeight: true
anchors.fill: parent spacing: 14 * DefaultStyle.dp
anchors.leftMargin: 20 * DefaultStyle.dp clip: true
anchors.rightMargin: 20 * DefaultStyle.dp searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : ""
anchors.verticalCenter: parent.verticalCenter busyIndicatorSize: 40 * DefaultStyle.dp
ColumnLayout {
Layout.alignment: Qt.AlignVCenter BusyIndicator {
RowLayout { anchors.horizontalCenter: detailListView.horizontalCenter
EffectImage { visible: detailListView.loading
id: statusIcon && detailListView.count === 0
imageSource: modelData.core.status height: visible ? detailListView.busyIndicatorSize : 0
=== LinphoneEnums.CallStatus.Declined width: detailListView.busyIndicatorSize
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere indicatorHeight: detailListView.busyIndicatorSize
|| modelData.core.status indicatorWidth: detailListView.busyIndicatorSize
=== LinphoneEnums.CallStatus.Aborted indicatorColor: DefaultStyle.main1_500_main
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft }
colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500main
Layout.preferredWidth: 16 * DefaultStyle.dp delegate: Item {
Layout.preferredHeight: 16 * DefaultStyle.dp width: detailListView.width
transform: Rotation { height: 56 * DefaultStyle.dp
angle: modelData.core.isOutgoing RowLayout {
&& (modelData.core.status anchors.fill: parent
=== LinphoneEnums.CallStatus.Declined anchors.leftMargin: 20 * DefaultStyle.dp
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 anchors.rightMargin: 20 * DefaultStyle.dp
origin { anchors.verticalCenter: parent.verticalCenter
x: statusIcon.width / 2 ColumnLayout {
y: statusIcon.height / 2 Layout.alignment: Qt.AlignVCenter
RowLayout {
EffectImage {
id: statusIcon
imageSource: modelData.core.status
=== LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft
colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500main
Layout.preferredWidth: 16 * DefaultStyle.dp
Layout.preferredHeight: 16 * DefaultStyle.dp
transform: Rotation {
angle: modelData.core.isOutgoing
&& (modelData.core.status === LinphoneEnums.CallStatus.Declined || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0
origin {
x: statusIcon.width / 2
y: statusIcon.height / 2
}
}
}
Text {
text: modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("Appel manqué") : modelData.core.isOutgoing ? qsTr("Appel sortant") : qsTr("Appel entrant")
font {
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
} }
} }
} }
Text { Text {
text: modelData.core.status === LinphoneEnums.CallStatus.Missed ? qsTr("Appel manqué") : modelData.core.isOutgoing ? qsTr("Appel sortant") : qsTr("Appel entrant") text: UtilsCpp.formatDate(
modelData.core.date)
color: modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : DefaultStyle.main2_500main
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
} }
} }
} }
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
Text { Text {
text: UtilsCpp.formatDate( text: UtilsCpp.formatElapsedTime(
modelData.core.date) modelData.core.duration,
color: modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : DefaultStyle.main2_500main false)
font { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
} }
} }
} }
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
Text {
text: UtilsCpp.formatElapsedTime(
modelData.core.duration, false)
font {
pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp
}
}
} }
} }
} }

View file

@ -104,7 +104,7 @@ AbstractWindow {
// mainWin.goToCallHistory() // mainWin.goToCallHistory()
} }
function callEnded(call) { function callEnded(call) {
if (call.core.state === LinphoneEnums.CallState.Error) { if (call && call.core.state === LinphoneEnums.CallState.Error) {
middleItemStackView.replace(inCallItem) middleItemStackView.replace(inCallItem)
} }
if (!callsModel.haveCall) { if (!callsModel.haveCall) {