UI: Add back auth for custom RTMP servers

This was a feature that was available when you chose custom RTMP server;
it was not considered when making the new version.  Note: it looks
unslightly, but it works for now.
This commit is contained in:
jp9000 committed 2019-02-14 23:12:55 -08:00
1 parent 4c3f992b44
commit 066c11c307
5 files changed
+119 -3

No files matched your search

+46
View File
@@ -75,6 +75,13 @@ void OBSBasicSettings::LoadStream1Settings()
if (strcmp(type, "rtmp_custom") == 0) {
ui->service->setCurrentIndex(0);
ui->customServer->setText(server);
bool use_auth = obs_data_get_bool(settings, "use_auth");
const char *username = obs_data_get_string(settings, "username");
const char *password = obs_data_get_string(settings, "password");
ui->authUsername->setText(QT_UTF8(username));
ui->authPw->setText(QT_UTF8(password));
ui->useAuth->setChecked(use_auth);
} else {
int idx = ui->service->findText(service);
if (idx == -1) {
@@ -134,6 +141,14 @@ void OBSBasicSettings::SaveStream1Settings()
} else {
obs_data_set_string(settings, "server",
QT_TO_UTF8(ui->customServer->text()));
obs_data_set_bool(settings, "use_auth",
ui->useAuth->isChecked());
if (ui->useAuth->isChecked()) {
obs_data_set_string(settings, "username",
QT_TO_UTF8(ui->authUsername->text()));
obs_data_set_string(settings, "password",
QT_TO_UTF8(ui->authPw->text()));
}
}
obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
@@ -267,6 +282,12 @@ void OBSBasicSettings::on_service_currentIndexChanged(int)
ui->connectAccount2->setVisible(false);
#endif
ui->useAuth->setVisible(custom);
ui->authUsernameLabel->setVisible(custom);
ui->authUsername->setVisible(custom);
ui->authPwLabel->setVisible(custom);
ui->authPwWidget->setVisible(custom);
if (custom) {
ui->streamkeyPageLayout->insertRow(1, ui->serverLabel,
ui->serverStackedWidget);
@@ -274,6 +295,7 @@ void OBSBasicSettings::on_service_currentIndexChanged(int)
ui->serverStackedWidget->setCurrentIndex(1);
ui->serverStackedWidget->setVisible(true);
ui->serverLabel->setVisible(true);
on_useAuth_toggled();
} else {
ui->serverStackedWidget->setCurrentIndex(0);
}
@@ -337,6 +359,17 @@ void OBSBasicSettings::on_show_clicked()
}
}
void OBSBasicSettings::on_authPwShow_clicked()
{
if (ui->authPw->echoMode() == QLineEdit::Password) {
ui->authPw->setEchoMode(QLineEdit::Normal);
ui->authPwShow->setText(QTStr("Hide"));
} else {
ui->authPw->setEchoMode(QLineEdit::Password);
ui->authPwShow->setText(QTStr("Show"));
}
}
OBSService OBSBasicSettings::SpawnTempService()
{
bool custom = IsCustomService();
@@ -447,3 +480,16 @@ void OBSBasicSettings::on_useStreamKey_clicked()
{
ui->streamStackWidget->setCurrentIndex((int)Section::StreamKey);
}
void OBSBasicSettings::on_useAuth_toggled()
{
if (!IsCustomService())
return;
bool use_auth = ui->useAuth->isChecked();
ui->authUsernameLabel->setVisible(use_auth);
ui->authUsername->setVisible(use_auth);
ui->authPwLabel->setVisible(use_auth);
ui->authPwWidget->setVisible(use_auth);
}