mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-19 12:28:08 +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 {
|
||||
shared_ptr<const linphone::CallParams> params = mCall->getCurrentParams();
|
||||
linphone::MediaEncryption encryption = params->getMediaEncryption();
|
||||
switch (encryption) {
|
||||
switch (mCall->getCurrentParams()->getMediaEncryption()) {
|
||||
case linphone::MediaEncryptionSRTP:
|
||||
return CallEncryptionSRTP;
|
||||
case linphone::MediaEncryptionZRTP:
|
||||
|
|
@ -507,41 +512,30 @@ CallModel::CallEncryption CallModel::getEncryption () const {
|
|||
case linphone::MediaEncryptionDTLS:
|
||||
return CallEncryptionDTLS;
|
||||
case linphone::MediaEncryptionNone:
|
||||
default:
|
||||
return CallEncryptionNone;
|
||||
break;
|
||||
}
|
||||
|
||||
return CallEncryptionNone;
|
||||
}
|
||||
|
||||
bool CallModel::isSecured () const {
|
||||
shared_ptr<const linphone::CallParams> params = mCall->getCurrentParams();
|
||||
linphone::MediaEncryption encryption = params->getMediaEncryption();
|
||||
return (encryption == linphone::MediaEncryptionZRTP && mCall->getAuthenticationTokenVerified())
|
||||
|| encryption == linphone::MediaEncryptionSRTP || encryption == linphone::MediaEncryptionDTLS;
|
||||
return (
|
||||
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();
|
||||
if (direction == linphone::CallDirIncoming) {
|
||||
return token.left(2).toUpper();
|
||||
} else {
|
||||
return token.right(2).toUpper();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CallModel::getLocalSAS () const {
|
||||
QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
|
||||
return mCall->getDir() == linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper();
|
||||
}
|
||||
|
||||
QString CallModel::getRemoteSAS() const {
|
||||
QString token = mCall->getAuthenticationToken().c_str();
|
||||
linphone::CallDir direction = mCall->getDir();
|
||||
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();
|
||||
QString CallModel::getRemoteSAS () const {
|
||||
QString token = ::Utils::coreStringToAppString(mCall->getAuthenticationToken());
|
||||
return mCall->getDir() != linphone::CallDirIncoming ? token.left(2).toUpper() : token.right(2).toUpper();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -554,6 +548,8 @@ QVariantList CallModel::getVideoStats () const {
|
|||
return mVideoStats;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline QVariantMap createStat (const QString &key, const QString &value) {
|
||||
QVariantMap m;
|
||||
m["key"] = key;
|
||||
|
|
@ -579,13 +575,13 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
|
||||
switch (callStats->getIpFamilyOfRemote()) {
|
||||
case linphone::AddressFamilyInet:
|
||||
family = "IPv4";
|
||||
family = QStringLiteral("IPv4");
|
||||
break;
|
||||
case linphone::AddressFamilyInet6:
|
||||
family = "IPv6";
|
||||
family = QStringLiteral("IPv6");
|
||||
break;
|
||||
default:
|
||||
family = "Unknown";
|
||||
family = QStringLiteral("Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -630,6 +626,8 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CallModel::iceStateToString (linphone::IceState state) const {
|
||||
switch (state) {
|
||||
case linphone::IceStateNotActivated:
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void sendDtmf (const QString &dtmf);
|
||||
|
||||
Q_INVOKABLE void verifyAuthenticationToken(bool verify);
|
||||
Q_INVOKABLE void verifyAuthenticationToken (bool verify);
|
||||
|
||||
signals:
|
||||
void callErrorChanged (const QString &callError);
|
||||
|
|
@ -164,6 +164,7 @@ private:
|
|||
|
||||
CallEncryption getEncryption () const;
|
||||
bool isSecured () const;
|
||||
|
||||
QString getLocalSAS () const;
|
||||
QString getRemoteSAS () const;
|
||||
|
||||
|
|
@ -171,7 +172,6 @@ private:
|
|||
QVariantList getVideoStats () const;
|
||||
void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats, QVariantList &statsList);
|
||||
|
||||
|
||||
QString iceStateToString (linphone::IceState state) const;
|
||||
|
||||
bool mIsInConference = false;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ Rectangle {
|
|||
id: callSecure
|
||||
|
||||
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 {
|
||||
call: incall.call
|
||||
height: zrtp.visible ? container.height - zrtp.height : container.height
|
||||
height: container.height
|
||||
width: container.width
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue