Commit a0e49580 authored by Ronan Abhamon's avatar Ronan Abhamon

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

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