Commit ffae0a80 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

advancedSIPSetting: add published addresses section into sip settings

Change-Id: I9bd5a3d50694b0226d1743c7b474d02d29396122
parent 0fc72ba7
......@@ -96,6 +96,14 @@ AdvancedSIPSettingsWidget::AdvancedSIPSettingsWidget(QWidget* parent)
ui->lineEditSTUNAddressSIP->setEnabled((bool)state);
});
// published address
connect(ui->checkBoxCustomAddressPort, &QAbstractButton::clicked, this, &AdvancedSIPSettingsWidget::setUseCustomAddressAndPort);
connect(ui->checkBoxCustomAddressPort, &QAbstractButton::clicked, [this](int state) {
ui->lineEditSIPCustomAddress->setEnabled((bool)state);
ui->customPortSIPSpinBox->setEnabled((bool)state);
});
connect(ui->lineEditSIPCustomAddress, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::lineEditSIPCustomAddressLineEditTextChanged);
// codecs
connect(ui->audioListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::audioCodecsStateChange);
connect(ui->videoListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::videoCodecsStateChange);
......@@ -194,6 +202,13 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->networkInterfaceSpinBox->setValue(config.localPort);
connect(ui->networkInterfaceSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged);
// published address
ui->checkBoxCustomAddressPort->setChecked(config.publishedSameAsLocal);
ui->lineEditSIPCustomAddress->setText(QString::fromStdString(config.publishedAddress));
ui->customPortSIPSpinBox->setValue(config.publishedPort);
connect(ui->customPortSIPSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged);
// codecs
ui->videoCheckBoxSIP->setChecked(config.Video.videoEnabled);
disconnect(ui->audioListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::audioCodecsStateChange);
......@@ -578,3 +593,27 @@ AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged(const int& value)
confProps.localPort = value;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::setUseCustomAddressAndPort(bool state)
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.publishedSameAsLocal = state;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::lineEditSIPCustomAddressLineEditTextChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.publishedAddress = ui->lineEditSIPCustomAddress->text().toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged(const int& value)
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.publishedPort = value;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -85,6 +85,12 @@ private slots:
void setTURNRealm();
void setSTUNAddress();
// published address
void setUseCustomAddressAndPort(bool state);
void lineEditSIPCustomAddressLineEditTextChanged();
void customPortSIPSpinBoxValueChanged(const int& value);
// codecs
void updateAudioCodecs();
void updateVideoCodecs();
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>731</width>
<height>1424</height>
<height>1532</height>
</rect>
</property>
<property name="windowTitle">
......@@ -1113,6 +1113,205 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string>Published Address</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_17">
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_28">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_24">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_27">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="customPortSIPSpinBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="maximum">
<number>65536</number>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_27">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="ToggleSwitch" name="checkBoxCustomAddressPort" native="true">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Use Custom Address/Port</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lineEditSIPCustomAddress">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
......
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