UI: Add support for "More Info" link from service

(Jim) Allows the ability to get a link from the service's settings about
a specific service selection the user chooses and display it as a "More
Info" button that the user can click to find out more information about
that particular service.
This commit is contained in:
Maya Venkatraman 2020-10-12 21:20:12 -07:00 • committed by jp9000
commit 41f4a0b0b9
8 changed files with 138 additions and 6 deletions

View file

@ -75,6 +75,8 @@ void OBSBasicSettings::InitStreamPage()
SLOT(UpdateKeyLink()));
connect(ui->customServer, SIGNAL(editingFinished(const QString &)),
this, SLOT(UpdateKeyLink()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateMoreInfoLink()));
}
void OBSBasicSettings::LoadStream1Settings()
@ -138,6 +140,7 @@ void OBSBasicSettings::LoadStream1Settings()
obs_data_release(settings);
UpdateKeyLink();
UpdateMoreInfoLink();
bool streamActive = obs_frontend_streaming_active();
ui->streamPage->setEnabled(!streamActive);
@ -212,6 +215,35 @@ void OBSBasicSettings::SaveStream1Settings()
main->auth->LoadUI();
}
void OBSBasicSettings::UpdateMoreInfoLink()
{
if (IsCustomService()) {
ui->moreInfoButton->hide();
return;
}
QString serviceName = ui->service->currentText();
obs_properties_t *props = obs_get_service_properties("rtmp_common");
obs_property_t *services = obs_properties_get(props, "service");
OBSData settings = obs_data_create();
obs_data_release(settings);
obs_data_set_string(settings, "service", QT_TO_UTF8(serviceName));
obs_property_modified(services, settings);
const char *more_info_link =
obs_data_get_string(settings, "more_info_link");
if (!more_info_link || (*more_info_link == '\0')) {
ui->moreInfoButton->hide();
} else {
ui->moreInfoButton->setTargetUrl(QUrl(more_info_link));
ui->moreInfoButton->show();
}
obs_properties_destroy(props);
}
void OBSBasicSettings::UpdateKeyLink()
{
QString serviceName = ui->service->currentText();