Commit bc6a75ad authored by Ronan Abhamon's avatar Ronan Abhamon

fix(ui/modules/Linphone/Calls/Calls): workarounds and many fixes to avoid type errors

parent ad7d3cd0
...@@ -228,7 +228,7 @@ QString ChatModel::getSipAddress () const { ...@@ -228,7 +228,7 @@ QString ChatModel::getSipAddress () const {
} }
void ChatModel::setSipAddress (const QString &sip_address) { void ChatModel::setSipAddress (const QString &sip_address) {
if (sip_address == getSipAddress()) if (sip_address == getSipAddress() || sip_address.isEmpty())
return; return;
beginResetModel(); beginResetModel();
......
...@@ -58,6 +58,7 @@ ListView { ...@@ -58,6 +58,7 @@ ListView {
} }
_mapStatusToParams[CallModel.CallStatusEnded] = { _mapStatusToParams[CallModel.CallStatusEnded] = {
icon: 'hangup',
string: 'ended' string: 'ended'
} }
...@@ -157,7 +158,7 @@ ListView { ...@@ -157,7 +158,7 @@ ListView {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Update the current selected call and the current index. // SmartConnect that updates the current selected call and the current index.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
SmartConnect { SmartConnect {
......
...@@ -10,8 +10,6 @@ import App.Styles 1.0 ...@@ -10,8 +10,6 @@ import App.Styles 1.0
// ============================================================================= // =============================================================================
Rectangle { Rectangle {
property var call
default property alias _actionArea: actionArea.data default property alias _actionArea: actionArea.data
property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress) property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress)
......
...@@ -16,12 +16,10 @@ Window { ...@@ -16,12 +16,10 @@ Window {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
readonly property bool chatIsOpened: !rightPaned.isClosed() readonly property bool chatIsOpened: !rightPaned.isClosed()
readonly property var call: calls.selectedCall
readonly property var sipAddress: { // `{}` is a workaround to avoid `TypeError: Cannot read property...` in `Incall` component.
if (call) { property var call: calls.selectedCall || {}
return call.sipAddress property string sipAddress: call.sipAddress || ''
}
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -124,25 +122,19 @@ Window { ...@@ -124,25 +122,19 @@ Window {
Component { Component {
id: incomingCall id: incomingCall
IncomingCall { IncomingCall {}
call: window.call
}
} }
Component { Component {
id: outgoingCall id: outgoingCall
OutgoingCall { OutgoingCall {}
call: window.call
}
} }
Component { Component {
id: incall id: incall
Incall { Incall {}
call: window.call
}
} }
Component { Component {
...@@ -158,15 +150,13 @@ Window { ...@@ -158,15 +150,13 @@ Window {
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
childA: Loader { childA: Loader {
active: Boolean(window.call)
anchors.fill: parent anchors.fill: parent
sourceComponent: { sourceComponent: {
var call = window.call var status = window.call.status
if (!call) { if (!status) {
return null return null
} }
var status = call.status
if (status === CallModel.CallStatusIncoming) { if (status === CallModel.CallStatusIncoming) {
return incomingCall return incomingCall
} }
...@@ -180,7 +170,6 @@ Window { ...@@ -180,7 +170,6 @@ Window {
} }
childB: Loader { childB: Loader {
active: Boolean(window.sipAddress)
anchors.fill: parent anchors.fill: parent
sourceComponent: window.sipAddress ? chat : null sourceComponent: window.sipAddress ? chat : null
} }
......
...@@ -15,8 +15,6 @@ Rectangle { ...@@ -15,8 +15,6 @@ Rectangle {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
property var call
property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress) property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -58,6 +56,10 @@ Rectangle { ...@@ -58,6 +56,10 @@ Rectangle {
triggeredOnStart: true triggeredOnStart: true
onTriggered: { onTriggered: {
if (!call.getQuality) {
return
}
var quality = call.getQuality() var quality = call.getQuality()
callQuality.icon = 'call_quality_' + ( callQuality.icon = 'call_quality_' + (
// Note: `quality` is in the [0, 5] interval. // Note: `quality` is in the [0, 5] interval.
...@@ -73,8 +75,8 @@ Rectangle { ...@@ -73,8 +75,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
horizontalTextAlignment: Text.AlignHCenter horizontalTextAlignment: Text.AlignHCenter
sipAddress: call.sipAddress sipAddress: _contactObserver.sipAddress
username: LinphoneUtils.getContactUsername(_contactObserver.contact || call.sipAddress) username: LinphoneUtils.getContactUsername(_contactObserver.contact || sipAddress)
height: parent.height height: parent.height
width: parent.width - cameraActions.width - callQuality.width - CallStyle.header.contactDescription.width width: parent.width - cameraActions.width - callQuality.width - CallStyle.header.contactDescription.width
...@@ -84,7 +86,7 @@ Rectangle { ...@@ -84,7 +86,7 @@ Rectangle {
id: cameraActions id: cameraActions
anchors.right: parent.right anchors.right: parent.right
active: call.videoInputEnabled active: Boolean(call.videoInputEnabled)
sourceComponent: ActionBar { sourceComponent: ActionBar {
iconSize: CallStyle.header.iconSize iconSize: CallStyle.header.iconSize
...@@ -203,7 +205,7 @@ Rectangle { ...@@ -203,7 +205,7 @@ Rectangle {
Item { Item {
anchors.centerIn: parent anchors.centerIn: parent
height: CallStyle.actionArea.userVideo.height height: CallStyle.actionArea.userVideo.height
visible: incall.width >= CallStyle.actionArea.lowWidth && call.videoOutputEnabled visible: Boolean(incall.width >= CallStyle.actionArea.lowWidth && call.videoOutputEnabled)
width: CallStyle.actionArea.userVideo.width width: CallStyle.actionArea.userVideo.width
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment