mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-30 16:06:24 +00:00
fix(src/components/call/CallModel): coding style
This commit is contained in:
parent
3582871957
commit
9ccbd52d62
3 changed files with 33 additions and 35 deletions
|
|
@ -496,10 +496,15 @@ void CallModel::sendDtmf (const QString &dtmf) {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void CallModel::verifyAuthenticationToken (bool verify) {
|
||||||
|
mCall->setAuthenticationTokenVerified(verify);
|
||||||
|
emit securityUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
CallModel::CallEncryption CallModel::getEncryption () const {
|
CallModel::CallEncryption CallModel::getEncryption () const {
|
||||||
shared_ptr<const linphone::CallParams> params = mCall->getCurrentParams();
|
switch (mCall->getCurrentParams()->getMediaEncryption()) {
|
||||||
linphone::MediaEncryption encryption = params->getMediaEncryption();
|
|
||||||
switch (encryption) {
|
|
||||||
case linphone::MediaEncryptionSRTP:
|
case linphone::MediaEncryptionSRTP:
|
||||||
return CallEncryptionSRTP;
|
return CallEncryptionSRTP;
|
||||||
case linphone::MediaEncryptionZRTP:
|
case linphone::MediaEncryptionZRTP:
|
||||||
|
|
@ -507,41 +512,30 @@ CallModel::CallEncryption CallModel::getEncryption () const {
|
||||||
case linphone::MediaEncryptionDTLS:
|
case linphone::MediaEncryptionDTLS:
|
||||||
return CallEncryptionDTLS;
|
return CallEncryptionDTLS;
|
||||||
case linphone::MediaEncryptionNone:
|
case linphone::MediaEncryptionNone:
|
||||||
default:
|
break;
|
||||||
return CallEncryptionNone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CallEncryptionNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallModel::isSecured () const {
|
bool CallModel::isSecured () const {
|
||||||
shared_ptr<const linphone::CallParams> params = mCall->getCurrentParams();
|
shared_ptr<const linphone::CallParams> params = mCall->getCurrentParams();
|
||||||
linphone::MediaEncryption encryption = params->getMediaEncryption();
|
linphone::MediaEncryption encryption = params->getMediaEncryption();
|
||||||
return (encryption == linphone::MediaEncryptionZRTP && mCall->getAuthenticationTokenVerified())
|
return (
|
||||||
|| encryption == linphone::MediaEncryptionSRTP || encryption == linphone::MediaEncryptionDTLS;
|
encryption == linphone::MediaEncryptionZRTP && mCall->getAuthenticationTokenVerified()
|
||||||
|
) || encryption == linphone::MediaEncryptionSRTP || encryption == linphone::MediaEncryptionDTLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CallModel::getLocalSAS() const {
|
// -----------------------------------------------------------------------------
|
||||||
QString token = mCall->getAuthenticationToken().c_str();
|
|
||||||
linphone::CallDir direction = mCall->getDir();
|
QString CallModel::getLocalSAS () const {
|
||||||
if (direction == linphone::CallDirIncoming) {
|
QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
|
||||||
return token.left(2).toUpper();
|
return mCall->getDir() == linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper();
|
||||||
} else {
|
|
||||||
return token.right(2).toUpper();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CallModel::getRemoteSAS() const {
|
QString CallModel::getRemoteSAS () const {
|
||||||
QString token = mCall->getAuthenticationToken().c_str();
|
QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
|
||||||
linphone::CallDir direction = mCall->getDir();
|
return mCall->getDir() != linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper();
|
||||||
if (direction == linphone::CallDirIncoming) {
|
|
||||||
return token.right(2).toUpper();
|
|
||||||
} else {
|
|
||||||
return token.left(2).toUpper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CallModel::verifyAuthenticationToken(bool verify) {
|
|
||||||
mCall->setAuthenticationTokenVerified(verify);
|
|
||||||
emit securityUpdated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
@ -554,6 +548,8 @@ QVariantList CallModel::getVideoStats () const {
|
||||||
return mVideoStats;
|
return mVideoStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
inline QVariantMap createStat (const QString &key, const QString &value) {
|
inline QVariantMap createStat (const QString &key, const QString &value) {
|
||||||
QVariantMap m;
|
QVariantMap m;
|
||||||
m["key"] = key;
|
m["key"] = key;
|
||||||
|
|
@ -579,13 +575,13 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
||||||
|
|
||||||
switch (callStats->getIpFamilyOfRemote()) {
|
switch (callStats->getIpFamilyOfRemote()) {
|
||||||
case linphone::AddressFamilyInet:
|
case linphone::AddressFamilyInet:
|
||||||
family = "IPv4";
|
family = QStringLiteral("IPv4");
|
||||||
break;
|
break;
|
||||||
case linphone::AddressFamilyInet6:
|
case linphone::AddressFamilyInet6:
|
||||||
family = "IPv6";
|
family = QStringLiteral("IPv6");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
family = "Unknown";
|
family = QStringLiteral("Unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,6 +626,8 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
QString CallModel::iceStateToString (linphone::IceState state) const {
|
QString CallModel::iceStateToString (linphone::IceState state) const {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case linphone::IceStateNotActivated:
|
case linphone::IceStateNotActivated:
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void sendDtmf (const QString &dtmf);
|
Q_INVOKABLE void sendDtmf (const QString &dtmf);
|
||||||
|
|
||||||
Q_INVOKABLE void verifyAuthenticationToken(bool verify);
|
Q_INVOKABLE void verifyAuthenticationToken (bool verify);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void callErrorChanged (const QString &callError);
|
void callErrorChanged (const QString &callError);
|
||||||
|
|
@ -164,6 +164,7 @@ private:
|
||||||
|
|
||||||
CallEncryption getEncryption () const;
|
CallEncryption getEncryption () const;
|
||||||
bool isSecured () const;
|
bool isSecured () const;
|
||||||
|
|
||||||
QString getLocalSAS () const;
|
QString getLocalSAS () const;
|
||||||
QString getRemoteSAS () const;
|
QString getRemoteSAS () const;
|
||||||
|
|
||||||
|
|
@ -171,7 +172,6 @@ private:
|
||||||
QVariantList getVideoStats () const;
|
QVariantList getVideoStats () const;
|
||||||
void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats, QVariantList &statsList);
|
void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats, QVariantList &statsList);
|
||||||
|
|
||||||
|
|
||||||
QString iceStateToString (linphone::IceState state) const;
|
QString iceStateToString (linphone::IceState state) const;
|
||||||
|
|
||||||
bool mIsInConference = false;
|
bool mIsInConference = false;
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ Rectangle {
|
||||||
id: callSecure
|
id: callSecure
|
||||||
|
|
||||||
icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure'
|
icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure'
|
||||||
onClicked: incall.call.encryption === CallModel.CallEncryptionZRTP ? zrtp.visible = true : zrtp.visible = false
|
onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZRTP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ Rectangle {
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
call: incall.call
|
call: incall.call
|
||||||
height: zrtp.visible ? container.height - zrtp.height : container.height
|
height: container.height
|
||||||
width: container.width
|
width: container.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue