Skip to content
Snippets Groups Projects
Commit 9316baca authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

account: Add TURN settings

Refs #71564
parent 180d4419
Branches
Tags
No related merge requests found
...@@ -858,6 +858,16 @@ bool Account::useDefaultPort() const ...@@ -858,6 +858,16 @@ bool Account::useDefaultPort() const
return d_ptr->m_UseDefaultPort; return d_ptr->m_UseDefaultPort;
} }
bool Account::isTurnEnabled() const
{
return d_ptr->accountDetail(DRing::Account::ConfProperties::TURN::ENABLED) IS_TRUE;
}
QString Account::turnServer() const
{
return d_ptr->accountDetail(DRing::Account::ConfProperties::TURN::SERVER);
}
#define CAST(item) static_cast<int>(item) #define CAST(item) static_cast<int>(item)
QVariant Account::roleData(int role) const QVariant Account::roleData(int role) const
{ {
...@@ -971,6 +981,10 @@ QVariant Account::roleData(int role) const ...@@ -971,6 +981,10 @@ QVariant Account::roleData(int role) const
return trimesterCallCount(); return trimesterCallCount();
case CAST(Account::Role::LastUsed): case CAST(Account::Role::LastUsed):
return (int)lastUsed(); return (int)lastUsed();
case CAST(Account::Role::SipTurnServer):
return turnServer();
case CAST(Account::Role::SipTurnEnabled):
return isTurnEnabled();
default: default:
return QVariant(); return QVariant();
} }
...@@ -1467,7 +1481,7 @@ void Account::setUseDefaultPort(bool value) ...@@ -1467,7 +1481,7 @@ void Account::setUseDefaultPort(bool value)
switch (protocol()) { switch (protocol()) {
case Account::Protocol::SIP: case Account::Protocol::SIP:
case Account::Protocol::IAX: case Account::Protocol::IAX:
setLocalPort(5060); setLocalPort(5060); //FIXME check is TLS is used
break; break;
case Account::Protocol::RING: case Account::Protocol::RING:
setLocalPort(5061); setLocalPort(5061);
...@@ -1479,6 +1493,16 @@ void Account::setUseDefaultPort(bool value) ...@@ -1479,6 +1493,16 @@ void Account::setUseDefaultPort(bool value)
d_ptr->m_UseDefaultPort = value; d_ptr->m_UseDefaultPort = value;
} }
void Account::setTurnEnabled(bool value)
{
d_ptr->setAccountProperty(DRing::Account::ConfProperties::TURN::ENABLED, (value)TO_BOOL);
}
void Account::setTurnServer(const QString& value)
{
d_ptr->setAccountProperty(DRing::Account::ConfProperties::TURN::SERVER, value);
}
///Set the DTMF type ///Set the DTMF type
void Account::setDTMFType(DtmfType type) void Account::setDTMFType(DtmfType type)
{ {
......
...@@ -230,6 +230,8 @@ class LIB_EXPORT Account : public QObject { ...@@ -230,6 +230,8 @@ class LIB_EXPORT Account : public QObject {
WeekCallCount = 148, WeekCallCount = 148,
TrimesterCallCount = 149, TrimesterCallCount = 149,
LastUsed = 150, LastUsed = 150,
SipTurnServer = 151,
SipTurnEnabled = 152,
}; };
enum class Protocol { enum class Protocol {
...@@ -323,6 +325,8 @@ class LIB_EXPORT Account : public QObject { ...@@ -323,6 +325,8 @@ class LIB_EXPORT Account : public QObject {
QString lastTransportErrorMessage () const; QString lastTransportErrorMessage () const;
QString userAgent () const; QString userAgent () const;
bool useDefaultPort () const; bool useDefaultPort () const;
bool isTurnEnabled () const;
QString turnServer () const;
RegistrationState registrationState () const; RegistrationState registrationState () const;
Protocol protocol () const; Protocol protocol () const;
KeyExchangeModel::Type keyExchange () const; KeyExchangeModel::Type keyExchange () const;
...@@ -358,6 +362,7 @@ class LIB_EXPORT Account : public QObject { ...@@ -358,6 +362,7 @@ class LIB_EXPORT Account : public QObject {
void setLocalInterface (const QString& detail ); void setLocalInterface (const QString& detail );
void setRingtonePath (const QString& detail ); void setRingtonePath (const QString& detail );
void setLastErrorMessage (const QString& message ); void setLastErrorMessage (const QString& message );
void setTurnServer (const QString& value );
void setKeyExchange (KeyExchangeModel::Type detail); void setKeyExchange (KeyExchangeModel::Type detail);
void setLastErrorCode (int code ); void setLastErrorCode (int code );
void setVoiceMailCount (int count ); void setVoiceMailCount (int count );
...@@ -391,6 +396,7 @@ class LIB_EXPORT Account : public QObject { ...@@ -391,6 +396,7 @@ class LIB_EXPORT Account : public QObject {
void setUpnpEnabled (bool enable); void setUpnpEnabled (bool enable);
void setHasCustomUserAgent (bool enable); void setHasCustomUserAgent (bool enable);
void setUseDefaultPort (bool value ); void setUseDefaultPort (bool value );
void setTurnEnabled (bool value );
void setRoleData(int role, const QVariant& value); void setRoleData(int role, const QVariant& value);
......
...@@ -147,6 +147,8 @@ QHash<int,QByteArray> AccountModel::roleNames() const ...@@ -147,6 +147,8 @@ QHash<int,QByteArray> AccountModel::roleNames() const
roles.insert(CAST(Account::Role::WeekCallCount ) ,QByteArray("weekCallCount" )); roles.insert(CAST(Account::Role::WeekCallCount ) ,QByteArray("weekCallCount" ));
roles.insert(CAST(Account::Role::TrimesterCallCount ) ,QByteArray("trimesterCallCount" )); roles.insert(CAST(Account::Role::TrimesterCallCount ) ,QByteArray("trimesterCallCount" ));
roles.insert(CAST(Account::Role::LastUsed ) ,QByteArray("lastUsed" )); roles.insert(CAST(Account::Role::LastUsed ) ,QByteArray("lastUsed" ));
roles.insert(CAST(Account::Role::SipTurnServer ) ,QByteArray("sipTurnServer" ));
roles.insert(CAST(Account::Role::SipTurnEnabled ) ,QByteArray("sipTurnEnabled" ));
} }
return roles; return roles;
} }
......
...@@ -96,7 +96,7 @@ int KeyExchangeModel::rowCount( const QModelIndex& parent ) const ...@@ -96,7 +96,7 @@ int KeyExchangeModel::rowCount( const QModelIndex& parent ) const
Qt::ItemFlags KeyExchangeModel::flags( const QModelIndex& index ) const Qt::ItemFlags KeyExchangeModel::flags( const QModelIndex& index ) const
{ {
if (!index.isValid()) return Qt::NoItemFlags; if (!index.isValid()) return Qt::NoItemFlags;
return Qt::ItemIsEnabled|Qt::ItemIsSelectable; return index.row()!=(int)KeyExchangeModel::Type::ZRTP?(Qt::ItemIsEnabled|Qt::ItemIsSelectable):Qt::NoItemFlags;
} }
bool KeyExchangeModel::setData( const QModelIndex& index, const QVariant &value, int role) bool KeyExchangeModel::setData( const QModelIndex& index, const QVariant &value, int role)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment