UI: Unset bandwidth test on non-Twitch service / disconnect

For additional safety, uncheck the bandwidth test checkbox so that the
setting isn't persisted in an enabled state when disconnecting or
switching a service. Also just straight up disable if not authed to
Twitch when saving settings.
master
Richard Stanway 2020-09-09 01:08:50 +02:00
parent 063c69ad1e
commit 023733595c
1 changed files with 9 additions and 3 deletions

View File

@ -177,9 +177,6 @@ void OBSBasicSettings::SaveStream1Settings()
}
}
obs_data_set_bool(settings, "bwtest",
ui->bandwidthTestEnable->isChecked());
if (!!auth && strcmp(auth->service(), "Twitch") == 0) {
bool choiceExists = config_has_user_value(
main->Config(), "Twitch", "AddonChoice");
@ -192,6 +189,11 @@ void OBSBasicSettings::SaveStream1Settings()
if (choiceExists && currentChoice != newChoice)
forceAuthReload = true;
obs_data_set_bool(settings, "bwtest",
ui->bandwidthTestEnable->isChecked());
} else {
obs_data_set_bool(settings, "bwtest", false);
}
obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
@ -470,6 +472,8 @@ void OBSBasicSettings::OnOAuthStreamKeyConnected()
ui->bandwidthTestEnable->setVisible(true);
ui->twitchAddonLabel->setVisible(true);
ui->twitchAddonDropdown->setVisible(true);
} else {
ui->bandwidthTestEnable->setChecked(false);
}
}
@ -530,6 +534,8 @@ void OBSBasicSettings::on_disconnectAccount_clicked()
OAuth::DeleteCookies(service);
#endif
ui->bandwidthTestEnable->setChecked(false);
ui->streamKeyWidget->setVisible(true);
ui->streamKeyLabel->setVisible(true);
ui->connectAccount2->setVisible(true);