Commit fee17c77 authored by Andreas Traczyk's avatar Andreas Traczyk

settings: use editingFinished signals for most line edit fields

Change-Id: I9101ddac038214d59731378a0e4b0ab43aad04cb
parent 1d918b71
......@@ -41,13 +41,13 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QWidget* parent)
connect(ui->checkBoxCustomRingtone, &QAbstractButton::clicked, [this](int state) { ui->btnRingtone->setEnabled((bool)state); });
// name server
connect(ui->lineEditNameServer, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setNameServer);
connect(ui->lineEditNameServer, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setNameServer);
// openDHT config
connect(ui->checkBoxEnableProxy, &QAbstractButton::clicked, this, &AdvancedSettingsWidget::setEnableProxy);
connect(ui->lineEditProxy, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setProxyAddress);
connect(ui->lineEditBootstrap, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setBootstrapAddress);
connect(ui->lineEditProxy, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setProxyAddress);
connect(ui->lineEditBootstrap, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setBootstrapAddress);
// security
connect(ui->btnCACert, &QPushButton::clicked, this, &AdvancedSettingsWidget::openFileCACert);
......@@ -59,10 +59,10 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QWidget* parent)
connect(ui->checkBoxTurnEnable, &QAbstractButton::clicked, this, &AdvancedSettingsWidget::setUseTURN);
connect(ui->checkBoxSTUNEnable, &QAbstractButton::clicked, this, &AdvancedSettingsWidget::setUseSTUN);
connect(ui->lineEditTurnAddress, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setTURNAddress);
connect(ui->lineEditTurnUsername, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setTURNUsername);
connect(ui->lineEditTurnPsswd, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setTURNPsswd);
connect(ui->lineEditSTUNAddress, &QLineEdit::textEdited, this, &AdvancedSettingsWidget::setSTUNAddress);
connect(ui->lineEditTurnAddress, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setTURNAddress);
connect(ui->lineEditTurnUsername, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setTURNUsername);
connect(ui->lineEditTurnPassword, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setTURNPassword);
connect(ui->lineEditSTUNAddress, &QLineEdit::editingFinished, this, &AdvancedSettingsWidget::setSTUNAddress);
// codecs
connect(ui->audioListWidget, &QListWidget::itemChanged, this, &AdvancedSettingsWidget::audioCodecsStateChange);
......@@ -130,7 +130,7 @@ AdvancedSettingsWidget::updateAdvancedSettings()
ui->checkBoxTurnEnable->setChecked(config.TURN.enable);
ui->lineEditTurnAddress->setText(QString::fromStdString(config.TURN.server));
ui->lineEditTurnUsername->setText(QString::fromStdString(config.TURN.username));
ui->lineEditTurnPsswd->setText(QString::fromStdString(config.TURN.password));
ui->lineEditTurnPassword->setText(QString::fromStdString(config.TURN.password));
ui->checkBoxSTUNEnable->setChecked(config.STUN.enable);
ui->lineEditSTUNAddress->setText(QString::fromStdString(config.STUN.server));
......@@ -191,10 +191,11 @@ AdvancedSettingsWidget::openFileCustomRingtone()
// name server
void
AdvancedSettingsWidget::setNameServer(const QString& name)
AdvancedSettingsWidget::setNameServer()
{
auto text = ui->lineEditNameServer->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.RingNS.uri = name.toStdString();
confProps.RingNS.uri = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -209,17 +210,19 @@ AdvancedSettingsWidget::setEnableProxy(bool state)
state ? ui->lineEditProxy->setEnabled(true) : ui->lineEditProxy->setEnabled(false);
}
void
AdvancedSettingsWidget::setProxyAddress(const QString& name)
AdvancedSettingsWidget::setProxyAddress()
{
auto text = ui->lineEditProxy->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.proxyServer = name.toStdString();
confProps.proxyServer = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSettingsWidget::setBootstrapAddress(const QString& name)
AdvancedSettingsWidget::setBootstrapAddress()
{
auto text = ui->lineEditBootstrap->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.hostname = name.toStdString();
confProps.hostname = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -251,31 +254,35 @@ AdvancedSettingsWidget::setUseSTUN(bool state)
}
void
AdvancedSettingsWidget::setTURNAddress(const QString& name)
AdvancedSettingsWidget::setTURNAddress()
{
auto text = ui->lineEditTurnAddress->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.server = name.toStdString();
confProps.TURN.server = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSettingsWidget::setTURNUsername(const QString& name)
AdvancedSettingsWidget::setTURNUsername()
{
auto text = ui->lineEditTurnUsername->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = name.toStdString();
confProps.TURN.username = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSettingsWidget::setTURNPsswd(const QString& name)
AdvancedSettingsWidget::setTURNPassword()
{
auto text = ui->lineEditTurnPassword->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = name.toStdString();
confProps.TURN.password = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSettingsWidget::setSTUNAddress(const QString& name)
AdvancedSettingsWidget::setSTUNAddress()
{
auto text = ui->lineEditSTUNAddress->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.server = name.toStdString();
confProps.STUN.server = text.toStdString();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......
......@@ -44,46 +44,29 @@ private slots:
void setCallsUntrusted(bool state);
void setAutoAnswerCalls(bool state);
void setEnableRingtone(bool state);
void openFileCustomRingtone();
// name server
void setNameServer(const QString& name);
// openDHT config
void setNameServer();
void setEnableProxy(bool state);
void setProxyAddress(const QString& name);
void setBootstrapAddress(const QString& name);
// security
void setProxyAddress();
void setBootstrapAddress();
void openFileCACert();
void openFileUserCert();
void openFilePrivateKey();
// connectivity
void setUseUPnP(bool state);
void setUseTURN(bool state);
void setUseSTUN(bool state);
void setTURNAddress(const QString& name);
void setTURNUsername(const QString& name);
void setTURNPsswd(const QString& name);
void setSTUNAddress(const QString& name);
// codecs
void setTURNAddress();
void setTURNUsername();
void setTURNPassword();
void setSTUNAddress();
void updateAudioCodecs();
void updateVideoCodecs();
void audioCodecsStateChange(QListWidgetItem* item = nullptr);
void videoCodecsStateChange(QListWidgetItem* item = nullptr);
void decreaseAudioCodecPriority();
void increaseAudioCodecPriority();
void decreaseVideoCodecPriority();
void increaseVideoCodecPriority();
void setVideoState(int state);
};
\ No newline at end of file
......@@ -870,7 +870,7 @@
</widget>
</item>
<item row="4" column="2">
<widget class="QLineEdit" name="lineEditTurnPsswd">
<widget class="QLineEdit" name="lineEditTurnPassword">
<property name="font">
<font>
<pointsize>10</pointsize>
......@@ -1436,7 +1436,7 @@
<tabstop>lineEditCertPassword</tabstop>
<tabstop>lineEditTurnAddress</tabstop>
<tabstop>lineEditTurnUsername</tabstop>
<tabstop>lineEditTurnPsswd</tabstop>
<tabstop>lineEditTurnPassword</tabstop>
<tabstop>lineEditSTUNAddress</tabstop>
<tabstop>videoDownPushButton</tabstop>
<tabstop>videoUpPushButton</tabstop>
......
......@@ -81,7 +81,7 @@ AdvancedSIPSettingsWidget::AdvancedSIPSettingsWidget(QWidget* parent)
connect(ui->lineEditTurnAddressSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNAddress);
connect(ui->lineEditTurnUsernameSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNUsername);
connect(ui->lineEditTurnPsswdSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNPsswd);
connect(ui->lineEditTurnPsswdSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNPassword);
connect(ui->lineEditTurnRealmSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setTURNRealm);
connect(ui->lineEditSTUNAddressSIP, &QLineEdit::editingFinished, this, &AdvancedSIPSettingsWidget::setSTUNAddress);
......@@ -179,7 +179,7 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->outgoingTLSServerNameLineEdit->setText(QString::fromStdString(config.TLS.serverName));
ui->negotiationTimeoutSpinBox->setValue(config.TLS.negotiationTimeoutSec);
connect(ui->negotiationTimeoutSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::negotiationTimeoutSpinBoxValueChanged);
connect(ui->negotiationTimeoutSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::negotiationTimeoutSpinBoxValueChanged);
// Connectivity
ui->checkBoxUPnPSIP->setChecked(config.upnpEnabled);
......@@ -198,16 +198,16 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->lineEditSTUNAddressSIP->setEnabled(config.STUN.enable);
ui->registrationExpireTimeoutSpinBox->setValue(config.Registration.expire);
connect(ui->registrationExpireTimeoutSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged);
connect(ui->registrationExpireTimeoutSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged);
ui->networkInterfaceSpinBox->setValue(config.localPort);
connect(ui->networkInterfaceSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged);
connect(ui->networkInterfaceSpinBox, &QSpinBox::editingFinished, 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);
connect(ui->customPortSIPSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged);
// codecs
ui->videoCheckBoxSIP->setChecked(config.Video.videoEnabled);
......@@ -303,7 +303,7 @@ void AdvancedSIPSettingsWidget::setTURNUsername()
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setTURNPsswd()
void AdvancedSIPSettingsWidget::setTURNPassword()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = ui->lineEditTurnPsswdSIP->text().toStdString();
......@@ -504,10 +504,10 @@ AdvancedSIPSettingsWidget::outgoingTLSServerNameLineEditTextChanged()
}
void
AdvancedSIPSettingsWidget::negotiationTimeoutSpinBoxValueChanged(const int& value)
AdvancedSIPSettingsWidget::negotiationTimeoutSpinBoxValueChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.negotiationTimeoutSec = value;
confProps.TLS.negotiationTimeoutSec = ui->negotiationTimeoutSpinBox->value();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -591,18 +591,18 @@ AdvancedSIPSettingsWidget::openButtonFilePath(const std::string& accConfigFilePa
}
void
AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged(const int& value)
AdvancedSIPSettingsWidget::registrationTimeoutSpinBoxValueChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Registration.expire = value;
confProps.Registration.expire = ui->registrationExpireTimeoutSpinBox->value();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged(const int& value)
AdvancedSIPSettingsWidget::networkInterfaceSpinBoxValueChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.localPort = value;
confProps.localPort = ui->networkInterfaceSpinBox->value();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -623,10 +623,10 @@ AdvancedSIPSettingsWidget::lineEditSIPCustomAddressLineEditTextChanged()
}
void
AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged(const int& value)
AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.publishedPort = value;
confProps.publishedPort = ui->customPortSIPSpinBox->value();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......
......@@ -70,18 +70,18 @@ private slots:
void lineEditSIPCertPasswordLineEditTextChanged();
void tlsProtocolComboBoxIndexChanged(const int& index);
void outgoingTLSServerNameLineEditTextChanged();
void negotiationTimeoutSpinBoxValueChanged(const int& value);
void negotiationTimeoutSpinBoxValueChanged();
// connectivity
void setUseUPnP(bool state);
void setUseTURN(bool state);
void setUseSTUN(bool state);
void registrationTimeoutSpinBoxValueChanged(const int& value);
void networkInterfaceSpinBoxValueChanged(const int& value);
void registrationTimeoutSpinBoxValueChanged();
void networkInterfaceSpinBoxValueChanged();
void setTURNAddress();
void setTURNUsername();
void setTURNPsswd();
void setTURNPassword();
void setTURNRealm();
void setSTUNAddress();
......@@ -89,7 +89,7 @@ private slots:
void setUseCustomAddressAndPort(bool state);
void lineEditSIPCustomAddressLineEditTextChanged();
void customPortSIPSpinBoxValueChanged(const int& value);
void customPortSIPSpinBoxValueChanged();
// codecs
void updateAudioCodecs();
......
......@@ -124,21 +124,11 @@ SettingsWidget::SettingsWidget(QWidget* parent)
// btnExitSettings
connect(ui->btnExitSettings, &QPushButton::clicked, this, &SettingsWidget::leaveSettingsSlot);
connect(ui->accountSettingsButton, &QPushButton::clicked, [this]() {
setSelected(Button::accountSettingsButton);
});
connect(ui->accountSettingsButton, &QPushButton::clicked, [this]() { setSelected(Button::accountSettingsButton); });
connect(ui->generalSettingsButton, &QPushButton::clicked, [this]() {
setSelected(Button::generalSettingsButton);
});
connect(ui->mediaSettingsButton, &QPushButton::clicked, [this]() {
setSelected(Button::mediaSettingsButton);
});
connect(ui->generalSettingsButton, &QPushButton::clicked, [this]() { setSelected(Button::generalSettingsButton); });
/*connect(ui->currentSIPAccountAvatar, &QPushButton::clicked, [this]() {
avatarClicked();
});*/
connect(ui->mediaSettingsButton, &QPushButton::clicked, [this]() { setSelected(Button::mediaSettingsButton); });
connect(ui->advancedAccountSettingsSIPButton, &QPushButton::clicked, this, &SettingsWidget::toggleAdvancedSIPSettings);
......@@ -198,7 +188,7 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(ui->currentRegisteredID, &QLineEdit::textEdited, this, &SettingsWidget::verifyRegisteredNameSlot);
connect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::registeredNameFound,
this, &SettingsWidget::receiveRegNameSlot);
this, &SettingsWidget::receiveRegNameSlot);
//connect "export account" button
connect(ui->btnExportAccount, &QPushButton::clicked, this, &SettingsWidget::exportAccountSlot);
......@@ -271,22 +261,27 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(ui->currentSIPAccountAvatar, &PhotoboothWidget::enterCallWidgetFromSettingsWidgetPhotoBooth,
this, &SettingsWidget::photoBoothLeaveReceived);
connect(&LRCInstance::avModel(),&lrc::api::AVModel::deviceEvent, [this] { videoDeviceEventHandlerAndMediaSettingSetUp(); });
connect(this, &SettingsWidget::settingWidgetPhotoBoothTosettingWidgetPreviewSignal,
[this]() {
this->disconnectPhotoBoothRendering();
this->connectStartedRenderingToPreview();
});
connect(ui->currentAccountAvatar, &PhotoboothWidget::leaveSettingsWidgetPreviewToSettingsWidgetPhotoBooth,
[this]() {
this->disconnectPreviewRendering();
this->connectStartedRenderingToPhotoBooth();
});
connect(ui->currentSIPAccountAvatar, &PhotoboothWidget::leaveSettingsWidgetPreviewToSettingsWidgetPhotoBooth,
[this]() {
this->disconnectPreviewRendering();
this->connectStartedRenderingToPhotoBooth();
});
ui->containerWidget->setVisible(false);
}
......
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