Display failure if Twitch token account name cannot be fetched
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

This commit is contained in:
WarmUpTill
2025-01-29 20:17:06 +01:00
committed by WarmUpTill
parent a1d8ae291d
commit 8dfe81f522

View File

@@ -681,22 +681,33 @@ void TwitchTokenSettingsDialog::RequestToken()
void TwitchTokenSettingsDialog::GotToken(const std::optional<QString> &value)
{
_currentTokenValue->setText(value.value_or(""));
if (value.has_value()) {
_tokenStatus->setText(obs_module_text(
"AdvSceneSwitcher.twitchToken.request.success"));
_currentToken.SetToken(value.value().toStdString());
auto name = QString::fromStdString(_currentToken._name);
_name->setText(name);
_name->textEdited(name);
QMetaObject::invokeMethod(this, "NameChanged",
Q_ARG(const QString &, name));
SetTokenInfoVisible(true);
} else {
if (!value) {
_tokenStatus->setText(obs_module_text(
"AdvSceneSwitcher.twitchToken.request.fail"));
_name->setText("");
SetTokenInfoVisible(false);
_requestToken->setEnabled(true);
return;
}
_currentToken.SetToken(value.value().toStdString());
auto name = QString::fromStdString(_currentToken._name);
if (name.isEmpty()) {
_tokenStatus->setText(obs_module_text(
"AdvSceneSwitcher.twitchToken.request.fail"));
_name->setText("");
SetTokenInfoVisible(false);
_requestToken->setEnabled(true);
return;
}
_tokenStatus->setText(obs_module_text(
"AdvSceneSwitcher.twitchToken.request.success"));
_name->setText(name);
_name->textEdited(name);
QMetaObject::invokeMethod(this, "NameChanged",
Q_ARG(const QString &, name));
SetTokenInfoVisible(true);
_requestToken->setEnabled(true);
}