Added declined call reason in ended call window

This commit is contained in:
Sylvain Berfini 2017-05-11 17:11:55 +02:00
parent 28ae7fe700
commit 054f3907e0
6 changed files with 83 additions and 1 deletions

View file

@ -252,6 +252,22 @@
<source>iceStateInvalid</source>
<translation>Invalid</translation>
</message>
<message>
<source>User declined the call</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User is busy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Incompatible media params</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CallStatistics</name>

View file

@ -252,6 +252,22 @@
<source>iceStateInvalid</source>
<translation>Invalide</translation>
</message>
<message>
<source>User declined the call</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User is busy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Incompatible media params</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CallStatistics</name>

View file

@ -40,6 +40,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) {
Q_ASSERT(call != nullptr);
mCall = call;
mCall->setData("call-model", *this);
mReason = "";
// Deal with auto-answer.
{
@ -63,8 +64,9 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) {
return;
switch (state) {
case linphone::CallStateEnd:
case linphone::CallStateError:
setReason(call->getReason());
case linphone::CallStateEnd:
stopAutoAnswerTimer();
mPausedByRemote = false;
break;
@ -284,6 +286,31 @@ CallModel::CallStatus CallModel::getStatus () const {
// -----------------------------------------------------------------------------
void CallModel::setReason (linphone::Reason reason) {
switch (reason) {
case linphone::ReasonDeclined:
mReason = tr("User declined the call");
break;
case linphone::ReasonNotFound:
mReason = tr("User not found");
break;
case linphone::ReasonBusy:
mReason = tr("User is busy");
break;
case linphone::ReasonNotAcceptable:
mReason = tr("Incompatible media params");
break;
default:
break;
}
}
QString CallModel::getReason () const {
return mReason;
}
// -----------------------------------------------------------------------------
int CallModel::getDuration () const {
return mCall->getDuration();
}

View file

@ -33,6 +33,7 @@ class CallModel : public QObject {
Q_PROPERTY(QString sipAddress READ getSipAddress CONSTANT);
Q_PROPERTY(CallStatus status READ getStatus NOTIFY statusChanged);
Q_PROPERTY(QString reason READ getReason NOTIFY statusChanged);
Q_PROPERTY(bool isOutgoing READ isOutgoing CONSTANT);
@ -106,6 +107,10 @@ private:
return mCall->getDir() == linphone::CallDirOutgoing;
}
QString mReason;
void setReason (linphone::Reason reason);
QString getReason () const;
int getDuration () const;
float getQuality () const;
float getMicroVu () const;

View file

@ -75,6 +75,19 @@ Rectangle {
Item {
Layout.fillWidth: true
Layout.preferredHeight: CallStyle.actionArea.height
Text {
width: parent.width
color: CallStyle.header.reason.color
font.pointSize: CallStyle.header.reason.fontSize
horizontalAlignment: Text.AlignHCenter
text: {
var call = endedCall.call
return call.reason
}
}
}
}
}

View file

@ -70,5 +70,10 @@ QtObject {
property QtObject stats: QtObject {
property int relativeY: 90
}
property QtObject reason: QtObject {
property color color: Colors.i
property int fontSize: 12
}
}
}