diff --git a/tests/src/components/call/CallModel.cpp b/tests/src/components/call/CallModel.cpp index c45450912..a32127d63 100644 --- a/tests/src/components/call/CallModel.cpp +++ b/tests/src/components/call/CallModel.cpp @@ -57,6 +57,10 @@ void CallModel::transfer () { // TODO } +float CallModel::getQuality () const { + return m_linphone_call->getCurrentQuality(); +} + // ----------------------------------------------------------------------------- QString CallModel::getSipAddress () const { diff --git a/tests/src/components/call/CallModel.hpp b/tests/src/components/call/CallModel.hpp index 53b1d8b6f..1eab7af76 100644 --- a/tests/src/components/call/CallModel.hpp +++ b/tests/src/components/call/CallModel.hpp @@ -37,6 +37,8 @@ public: Q_INVOKABLE void terminate (); Q_INVOKABLE void transfer (); + Q_INVOKABLE float getQuality () const; + signals: void statusChanged (CallStatus status); void microMutedChanged (bool status); diff --git a/tests/ui/views/App/Calls/Incall.qml b/tests/ui/views/App/Calls/Incall.qml index 88c64f4f8..34c3ca959 100644 --- a/tests/ui/views/App/Calls/Incall.qml +++ b/tests/ui/views/App/Calls/Incall.qml @@ -47,8 +47,25 @@ Rectangle { id: callQuality anchors.left: parent.left - icon: 'call_quality_' + 2 + icon: 'call_quality_0' iconSize: CallStyle.header.iconSize + onIconChanged: console.log(icon) + // See: http://www.linphone.org/docs/liblinphone/group__call__misc.html#ga62c7d3d08531b0cc634b797e273a0a73 + Timer { + interval: 5000 + repeat: true + running: true + triggeredOnStart: true + + onTriggered: { + var quality = call.getQuality() + callQuality.icon = 'call_quality_' + ( + // Note: `quality` is in the [0, 5] interval. + // It's necessary to map in the `call_quality_` interval. ([0, 3]) + quality >= 0 ? Math.round(quality / (5 / 3)) : 0 + ) + } + } } ContactDescription {