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 {
}
void ChatModel::setSipAddress (const QString &sip_address) {
if (sip_address == getSipAddress())
if (sip_address == getSipAddress() || sip_address.isEmpty())
return;
beginResetModel();
......
......@@ -58,6 +58,7 @@ ListView {
}
_mapStatusToParams[CallModel.CallStatusEnded] = {
icon: 'hangup',
string: 'ended'
}
......@@ -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 {
......
......@@ -10,8 +10,6 @@ import App.Styles 1.0
// =============================================================================
Rectangle {
property var call
default property alias _actionArea: actionArea.data
property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress)
......
......@@ -16,12 +16,10 @@ Window {
// ---------------------------------------------------------------------------
readonly property bool chatIsOpened: !rightPaned.isClosed()
readonly property var call: calls.selectedCall
readonly property var sipAddress: {
if (call) {
return call.sipAddress
}
}
// `{}` is a workaround to avoid `TypeError: Cannot read property...` in `Incall` component.
property var call: calls.selectedCall || {}
property string sipAddress: call.sipAddress || ''
// ---------------------------------------------------------------------------
......@@ -124,25 +122,19 @@ Window {
Component {
id: incomingCall
IncomingCall {
call: window.call
}
IncomingCall {}
}
Component {
id: outgoingCall
OutgoingCall {
call: window.call
}
OutgoingCall {}
}
Component {
id: incall
Incall {
call: window.call
}
Incall {}
}
Component {
......@@ -158,15 +150,13 @@ Window {
// -----------------------------------------------------------------------
childA: Loader {
active: Boolean(window.call)
anchors.fill: parent
sourceComponent: {
var call = window.call
if (!call) {
var status = window.call.status
if (!status) {
return null
}
var status = call.status
if (status === CallModel.CallStatusIncoming) {
return incomingCall
}
......@@ -180,7 +170,6 @@ Window {
}
childB: Loader {
active: Boolean(window.sipAddress)
anchors.fill: parent
sourceComponent: window.sipAddress ? chat : null
}
......
......@@ -15,8 +15,6 @@ Rectangle {
// ---------------------------------------------------------------------------
property var call
property var _contactObserver: SipAddressesModel.getContactObserver(sipAddress)
// ---------------------------------------------------------------------------
......@@ -58,6 +56,10 @@ Rectangle {
triggeredOnStart: true
onTriggered: {
if (!call.getQuality) {
return
}
var quality = call.getQuality()
callQuality.icon = 'call_quality_' + (
// Note: `quality` is in the [0, 5] interval.
......@@ -73,8 +75,8 @@ Rectangle {
anchors.centerIn: parent
horizontalTextAlignment: Text.AlignHCenter
sipAddress: call.sipAddress
username: LinphoneUtils.getContactUsername(_contactObserver.contact || call.sipAddress)
sipAddress: _contactObserver.sipAddress
username: LinphoneUtils.getContactUsername(_contactObserver.contact || sipAddress)
height: parent.height
width: parent.width - cameraActions.width - callQuality.width - CallStyle.header.contactDescription.width
......@@ -84,7 +86,7 @@ Rectangle {
id: cameraActions
anchors.right: parent.right
active: call.videoInputEnabled
active: Boolean(call.videoInputEnabled)
sourceComponent: ActionBar {
iconSize: CallStyle.header.iconSize
......@@ -203,7 +205,7 @@ Rectangle {
Item {
anchors.centerIn: parent
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
}
......
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