Commit a0e49580 authored by Ronan's avatar Ronan
Browse files

fix(src/components/call/CallModel): coding style

parent 40a929a0
......@@ -253,19 +253,19 @@
<translation>Invalid</translation>
</message>
<message>
<source>User declined the call</source>
<source>callErrorDeclined</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User not found</source>
<source>callErrorNotFound</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User is busy</source>
<source>callErrorBusy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Incompatible media params</source>
<source>callErrorNotAcceptable</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -253,19 +253,19 @@
<translation>Invalide</translation>
</message>
<message>
<source>User declined the call</source>
<source>callErrorDeclined</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User not found</source>
<source>callErrorNotFound</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User is busy</source>
<source>callErrorBusy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Incompatible media params</source>
<source>callErrorNotAcceptable</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -40,7 +40,6 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) {
Q_ASSERT(call != nullptr);
mCall = call;
mCall->setData("call-model", *this);
mReason = "";
// Deal with auto-answer.
{
......@@ -194,7 +193,7 @@ void CallModel::handleCallStateChanged (const std::shared_ptr<linphone::Call> &c
switch (state) {
case linphone::CallStateError:
setReason(call->getReason());
setCallErrorFromReason(call->getReason());
case linphone::CallStateEnd:
stopAutoAnswerTimer();
mPausedByRemote = false;
......@@ -290,27 +289,29 @@ CallModel::CallStatus CallModel::getStatus () const {
// -----------------------------------------------------------------------------
void CallModel::setReason (linphone::Reason reason) {
void CallModel::setCallErrorFromReason (linphone::Reason reason) {
switch (reason) {
case linphone::ReasonDeclined:
mReason = tr("User declined the call");
mCallError = tr("callErrorDeclined");
break;
case linphone::ReasonNotFound:
mReason = tr("User not found");
mCallError = tr("callErrorNotFound");
break;
case linphone::ReasonBusy:
mReason = tr("User is busy");
mCallError = tr("callErrorBusy");
break;
case linphone::ReasonNotAcceptable:
mReason = tr("Incompatible media params");
mCallError = tr("callErrorNotAcceptable");
break;
default:
break;
}
emit callErrorChanged(mCallError);
}
QString CallModel::getReason () const {
return mReason;
QString CallModel::getCallError () const {
return mCallError;
}
// -----------------------------------------------------------------------------
......
......@@ -33,7 +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(QString callError READ getCallError NOTIFY callErrorChanged);
Q_PROPERTY(bool isOutgoing READ isOutgoing CONSTANT);
......@@ -91,11 +91,12 @@ public:
Q_INVOKABLE void sendDtmf (const QString &dtmf);
signals:
void statusChanged (CallStatus status);
void callErrorChanged (const QString &callError);
void microMutedChanged (bool status);
void videoRequested ();
void recordingChanged (bool status);
void statsUpdated ();
void statusChanged (CallStatus status);
void videoRequested ();
private:
void handleCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::CallState state);
......@@ -109,9 +110,8 @@ private:
return mCall->getDir() == linphone::CallDirOutgoing;
}
QString mReason;
void setReason (linphone::Reason reason);
QString getReason () const;
void setCallErrorFromReason (linphone::Reason reason);
QString getCallError () const;
int getDuration () const;
float getQuality () const;
......@@ -141,6 +141,8 @@ private:
bool mPausedByUser = false;
bool mRecording = false;
QString mCallError;
QVariantList mAudioStats;
QVariantList mVideoStats;
......
......@@ -84,7 +84,7 @@ Rectangle {
text: {
var call = endedCall.call
return call ? call.reason : ''
return call ? call.callError : ''
}
}
}
......
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