UI: Refactor duplicated streaming page code

Moves duplicated streaming service code to its own class to make this
particular code slightly less insufferable to modify (but only slightly)
This commit is contained in:
jp9000 2022-04-18 12:18:12 -07:00
parent 275e510aad
commit 22ffc04f73
7 changed files with 232 additions and 340 deletions

View File

@ -1,4 +1,6 @@
#include "streaming-helpers.hpp"
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
#include "../plugins/rtmp-services/rtmp-format-ver.h"
@ -65,3 +67,121 @@ Json get_service_from_json(Json &root, const char *name)
return Json();
}
void StreamSettingsUI::UpdateMoreInfoLink()
{
if (IsCustomService()) {
ui_moreInfoButton->hide();
return;
}
QString serviceName = ui_service->currentText();
Json service = get_service_from_json(GetServicesJson(),
QT_TO_UTF8(serviceName));
const std::string &more_info_link =
service["more_info_link"].string_value();
if (more_info_link.empty()) {
ui_moreInfoButton->hide();
} else {
ui_moreInfoButton->setTargetUrl(QUrl(more_info_link.c_str()));
ui_moreInfoButton->show();
}
}
void StreamSettingsUI::UpdateKeyLink()
{
QString serviceName = ui_service->currentText();
QString customServer = ui_customServer->text().trimmed();
Json service = get_service_from_json(GetServicesJson(),
QT_TO_UTF8(serviceName));
std::string streamKeyLink = service["stream_key_link"].string_value();
if (customServer.contains("fbcdn.net") && IsCustomService()) {
streamKeyLink =
"https://www.facebook.com/live/producer?ref=OBS";
}
if (serviceName == "Dacast") {
ui_streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.EncoderKey"));
} else {
ui_streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.StreamKey"));
}
if (streamKeyLink.empty()) {
ui_streamKeyButton->hide();
} else {
ui_streamKeyButton->setTargetUrl(QUrl(streamKeyLink.c_str()));
ui_streamKeyButton->show();
}
}
void StreamSettingsUI::LoadServices(bool showAll)
{
auto &services = GetServicesJson()["services"].array_items();
ui_service->blockSignals(true);
ui_service->clear();
QStringList names;
for (const Json &service : services) {
if (!showAll && !service["common"].bool_value())
continue;
names.push_back(service["name"].string_value().c_str());
}
if (showAll)
names.sort(Qt::CaseInsensitive);
for (QString &name : names)
ui_service->addItem(name);
if (!showAll) {
ui_service->addItem(
QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
QVariant((int)ListOpt::ShowAll));
}
ui_service->insertItem(
0, QTStr("Basic.AutoConfig.StreamPage.Service.Custom"),
QVariant((int)ListOpt::Custom));
if (!lastService.isEmpty()) {
int idx = ui_service->findText(lastService);
if (idx != -1)
ui_service->setCurrentIndex(idx);
}
ui_service->blockSignals(false);
}
void StreamSettingsUI::UpdateServerList()
{
QString serviceName = ui_service->currentText();
bool showMore = ui_service->currentData().toInt() ==
(int)ListOpt::ShowAll;
if (showMore) {
LoadServices(true);
ui_service->showPopup();
return;
} else {
lastService = serviceName;
}
Json service = get_service_from_json(GetServicesJson(),
QT_TO_UTF8(serviceName));
ui_server->clear();
auto &servers = service["servers"].array_items();
for (const Json &entry : servers) {
ui_server->addItem(entry["name"].string_value().c_str(),
entry["url"].string_value().c_str());
}
}

View File

@ -1,6 +1,70 @@
#pragma once
#include "url-push-button.hpp"
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
#include <json11.hpp>
extern json11::Json get_services_json();
extern json11::Json get_service_from_json(json11::Json &root, const char *name);
enum class ListOpt : int {
ShowAll = 1,
Custom,
};
class StreamSettingsUI : public QObject {
Q_OBJECT
QLabel *ui_streamKeyLabel;
QComboBox *ui_service;
QComboBox *ui_server;
QLineEdit *ui_customServer;
UrlPushButton *ui_moreInfoButton;
UrlPushButton *ui_streamKeyButton;
json11::Json servicesRoot;
bool servicesLoaded = false;
QString lastService;
public:
inline void Setup(QLabel *streamKeyLabel, QComboBox *service,
QComboBox *server, QLineEdit *customServer,
UrlPushButton *moreInfoButton,
UrlPushButton *streamKeyButton)
{
ui_streamKeyLabel = streamKeyLabel;
ui_service = service;
ui_server = server;
ui_customServer = customServer;
ui_moreInfoButton = moreInfoButton;
ui_streamKeyButton = streamKeyButton;
}
inline bool IsCustomService() const
{
return ui_service->currentData().toInt() ==
(int)ListOpt::Custom;
}
inline void ClearLastService() { lastService.clear(); }
inline json11::Json GetServicesJson()
{
if (!servicesLoaded && servicesRoot.is_null()) {
servicesRoot = get_services_json();
servicesLoaded = true;
}
return servicesRoot;
}
inline const QString &LastService() const { return lastService; }
public slots:
void UpdateMoreInfoLink();
void UpdateKeyLink();
void LoadServices(bool showAll);
void UpdateServerList();
};

View File

@ -11,7 +11,6 @@
#include "window-basic-auto-config.hpp"
#include "window-basic-main.hpp"
#include "streaming-helpers.hpp"
#include "qt-wrappers.hpp"
#include "obs-app.hpp"

View File

@ -8,7 +8,6 @@
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
#include "url-push-button.hpp"
#include "streaming-helpers.hpp"
#include "ui_AutoConfigStartPage.h"
#include "ui_AutoConfigVideoPage.h"
@ -243,11 +242,6 @@ bool AutoConfigVideoPage::validatePage()
/* ------------------------------------------------------------------------- */
enum class ListOpt : int {
ShowAll = 1,
Custom,
};
AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
: QWizardPage(parent), ui(new Ui_AutoConfigStreamPage)
{
@ -257,6 +251,10 @@ AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
ui->connectAccount2->setVisible(false);
ui->disconnectAccount->setVisible(false);
streamUi.Setup(ui->streamKeyLabel, ui->service, ui->server,
ui->customServer, ui->moreInfoButton,
ui->streamKeyButton);
ui->connectedAccountLabel->setVisible(false);
ui->connectedAccountText->setVisible(false);
@ -277,25 +275,25 @@ AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
setTitle(QTStr("Basic.AutoConfig.StreamPage"));
setSubTitle(QTStr("Basic.AutoConfig.StreamPage.SubTitle"));
LoadServices(false);
streamUi.LoadServices(false);
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(ServiceChanged()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)), this,
SLOT(ServiceChanged()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)), this,
SLOT(UpdateKeyLink()));
connect(ui->customServer, SIGNAL(editingFinished()), this,
connect(ui->customServer, SIGNAL(textChanged(const QString &)),
&streamUi, SLOT(UpdateKeyLink()));
connect(ui->customServer, SIGNAL(editingFinished()), &streamUi,
SLOT(UpdateKeyLink()));
connect(ui->doBandwidthTest, SIGNAL(toggled(bool)), this,
SLOT(ServiceChanged()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateServerList()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateKeyLink()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateMoreInfoLink()));
connect(ui->useStreamKeyAdv, &QPushButton::clicked, this,
@ -325,16 +323,11 @@ int AutoConfigStreamPage::nextId() const
return AutoConfig::TestPage;
}
inline bool AutoConfigStreamPage::IsCustomService() const
{
return ui->service->currentData().toInt() == (int)ListOpt::Custom;
}
bool AutoConfigStreamPage::validatePage()
{
OBSDataAutoRelease service_settings = obs_data_create();
wiz->customServer = IsCustomService();
wiz->customServer = streamUi.IsCustomService();
const char *serverType = wiz->customServer ? "rtmp_custom"
: "rtmp_common";
@ -545,7 +538,7 @@ void AutoConfigStreamPage::on_disconnectAccount_clicked()
ui->connectedAccountText->setVisible(false);
/* Restore key link when disconnecting account */
UpdateKeyLink();
streamUi.UpdateKeyLink();
}
void AutoConfigStreamPage::on_useStreamKey_clicked()
@ -618,7 +611,7 @@ void AutoConfigStreamPage::ServiceChanged()
std::string service = QT_TO_UTF8(ui->service->currentText());
bool regionBased = service == "Twitch";
bool testBandwidth = ui->doBandwidthTest->isChecked();
bool custom = IsCustomService();
bool custom = streamUi.IsCustomService();
reset_service_ui_fields(service);
@ -675,144 +668,13 @@ void AutoConfigStreamPage::ServiceChanged()
UpdateCompleted();
}
inline void AutoConfigStreamPage::GetServicesJson()
{
if (!servicesLoaded && servicesRoot.is_null()) {
servicesRoot = get_services_json();
servicesLoaded = true;
}
}
void AutoConfigStreamPage::UpdateMoreInfoLink()
{
if (IsCustomService()) {
ui->moreInfoButton->hide();
return;
}
QString serviceName = ui->service->currentText();
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
const std::string &more_info_link =
service["more_info_link"].string_value();
if (more_info_link.empty()) {
ui->moreInfoButton->hide();
} else {
ui->moreInfoButton->setTargetUrl(QUrl(more_info_link.c_str()));
ui->moreInfoButton->show();
}
}
void AutoConfigStreamPage::UpdateKeyLink()
{
QString serviceName = ui->service->currentText();
QString customServer = ui->customServer->text().trimmed();
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
std::string streamKeyLink = service["stream_key_link"].string_value();
if (customServer.contains("fbcdn.net") && IsCustomService()) {
streamKeyLink =
"https://www.facebook.com/live/producer?ref=OBS";
}
if (serviceName == "Dacast") {
ui->streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.EncoderKey"));
} else {
ui->streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.StreamKey"));
}
if (streamKeyLink.empty()) {
ui->streamKeyButton->hide();
} else {
ui->streamKeyButton->setTargetUrl(QUrl(streamKeyLink.c_str()));
ui->streamKeyButton->show();
}
}
void AutoConfigStreamPage::LoadServices(bool showAll)
{
GetServicesJson();
auto &services = servicesRoot["services"].array_items();
ui->service->blockSignals(true);
ui->service->clear();
QStringList names;
for (const Json &service : services) {
if (!showAll && !service["common"].bool_value())
continue;
names.push_back(service["name"].string_value().c_str());
}
if (showAll)
names.sort(Qt::CaseInsensitive);
for (QString &name : names)
ui->service->addItem(name);
if (!showAll) {
ui->service->addItem(
QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
QVariant((int)ListOpt::ShowAll));
}
ui->service->insertItem(
0, QTStr("Basic.AutoConfig.StreamPage.Service.Custom"),
QVariant((int)ListOpt::Custom));
if (!lastService.isEmpty()) {
int idx = ui->service->findText(lastService);
if (idx != -1)
ui->service->setCurrentIndex(idx);
}
ui->service->blockSignals(false);
}
void AutoConfigStreamPage::UpdateServerList()
{
QString serviceName = ui->service->currentText();
bool showMore = ui->service->currentData().toInt() ==
(int)ListOpt::ShowAll;
if (showMore) {
LoadServices(true);
ui->service->showPopup();
return;
} else {
lastService = serviceName;
}
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
ui->server->clear();
auto &servers = service["servers"].array_items();
for (const Json &server : servers) {
ui->server->addItem(server["name"].string_value().c_str(),
server["url"].string_value().c_str());
}
}
void AutoConfigStreamPage::UpdateCompleted()
{
if (ui->stackedWidget->currentIndex() == (int)Section::Connect ||
(ui->key->text().isEmpty() && !auth)) {
ready = false;
} else {
bool custom = IsCustomService();
bool custom = streamUi.IsCustomService();
if (custom) {
ready = !ui->customServer->text().isEmpty();
} else {
@ -903,10 +765,10 @@ AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent)
serviceList->blockSignals(false);
}
streamPage->UpdateServerList();
streamPage->UpdateKeyLink();
streamPage->UpdateMoreInfoLink();
streamPage->lastService.clear();
streamPage->streamUi.UpdateServerList();
streamPage->streamUi.UpdateKeyLink();
streamPage->streamUi.UpdateMoreInfoLink();
streamPage->streamUi.ClearLastService();
if (!customServer) {
QComboBox *serverList = streamPage->ui->server;

View File

@ -15,6 +15,8 @@
#include <json11.hpp>
#include "streaming-helpers.hpp"
class Ui_AutoConfigStartPage;
class Ui_AutoConfigVideoPage;
class Ui_AutoConfigStreamPage;
@ -173,15 +175,9 @@ class AutoConfigStreamPage : public QWizardPage {
std::shared_ptr<Auth> auth;
std::unique_ptr<Ui_AutoConfigStreamPage> ui;
QString lastService;
bool ready = false;
inline void GetServicesJson();
json11::Json servicesRoot;
bool servicesLoaded = false;
void LoadServices(bool showAll);
inline bool IsCustomService() const;
StreamSettingsUI streamUi;
public:
AutoConfigStreamPage(QWidget *parent = nullptr);
@ -200,9 +196,6 @@ public slots:
void on_disconnectAccount_clicked();
void on_useStreamKey_clicked();
void ServiceChanged();
void UpdateKeyLink();
void UpdateMoreInfoLink();
void UpdateServerList();
void UpdateCompleted();
void reset_service_ui_fields(std::string &service);

View File

@ -2,7 +2,6 @@
#include <QUrl>
#include "window-basic-settings.hpp"
#include "streaming-helpers.hpp"
#include "obs-frontend-api.h"
#include "obs-app.hpp"
#include "window-basic-main.hpp"
@ -29,21 +28,11 @@ struct QCefCookieManager;
extern QCef *cef;
extern QCefCookieManager *panel_cookies;
enum class ListOpt : int {
ShowAll = 1,
Custom,
};
enum class Section : int {
Connect,
StreamKey,
};
inline bool OBSBasicSettings::IsCustomService() const
{
return ui->service->currentData().toInt() == (int)ListOpt::Custom;
}
void OBSBasicSettings::InitStreamPage()
{
ui->connectAccount2->setVisible(false);
@ -70,7 +59,11 @@ void OBSBasicSettings::InitStreamPage()
m.setTop(vertSpacing / 2);
ui->streamkeyPageLayout->setContentsMargins(m);
LoadServices(false);
streamUi.Setup(ui->streamKeyLabel, ui->service, ui->server,
ui->customServer, ui->moreInfoButton,
ui->getStreamKeyButton);
streamUi.LoadServices(false);
ui->twitchAddonDropdown->addItem(
QTStr("Basic.Settings.Stream.TTVAddon.None"));
@ -81,9 +74,9 @@ void OBSBasicSettings::InitStreamPage()
ui->twitchAddonDropdown->addItem(
QTStr("Basic.Settings.Stream.TTVAddon.Both"));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateServerList()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateKeyLink()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateVodTrackSetting()));
@ -91,13 +84,13 @@ void OBSBasicSettings::InitStreamPage()
SLOT(UpdateServiceRecommendations()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
SLOT(UpdateResFPSLimits()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)), this,
SLOT(UpdateKeyLink()));
connect(ui->customServer, SIGNAL(textChanged(const QString &)),
&streamUi, SLOT(UpdateKeyLink()));
connect(ui->ignoreRecommended, SIGNAL(clicked(bool)), this,
SLOT(DisplayEnforceWarning(bool)));
connect(ui->ignoreRecommended, SIGNAL(toggled(bool)), this,
SLOT(UpdateResFPSLimits()));
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
connect(ui->service, SIGNAL(currentIndexChanged(int)), &streamUi,
SLOT(UpdateMoreInfoLink()));
}
@ -145,7 +138,7 @@ void OBSBasicSettings::LoadStream1Settings()
ui->twitchAddonDropdown->setCurrentIndex(idx);
}
UpdateServerList();
streamUi.UpdateServerList();
if (strcmp(type, "rtmp_common") == 0) {
int idx = ui->server->findData(server);
@ -159,11 +152,11 @@ void OBSBasicSettings::LoadStream1Settings()
ui->key->setText(key);
lastService.clear();
streamUi.ClearLastService();
on_service_currentIndexChanged(0);
UpdateKeyLink();
UpdateMoreInfoLink();
streamUi.UpdateKeyLink();
streamUi.UpdateMoreInfoLink();
UpdateVodTrackSetting();
UpdateServiceRecommendations();
@ -180,7 +173,7 @@ void OBSBasicSettings::LoadStream1Settings()
void OBSBasicSettings::SaveStream1Settings()
{
bool customServer = IsCustomService();
bool customServer = streamUi.IsCustomService();
const char *service_id = customServer ? "rtmp_custom" : "rtmp_common";
obs_service_t *oldService = main->GetService();
@ -249,111 +242,6 @@ void OBSBasicSettings::SaveStream1Settings()
SaveCheckBox(ui->ignoreRecommended, "Stream1", "IgnoreRecommended");
}
inline void OBSBasicSettings::GetServicesJson()
{
if (!servicesLoaded && servicesRoot.is_null()) {
servicesRoot = get_services_json();
servicesLoaded = true;
}
}
void OBSBasicSettings::UpdateMoreInfoLink()
{
if (IsCustomService()) {
ui->moreInfoButton->hide();
return;
}
QString serviceName = ui->service->currentText();
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
const std::string &more_info_link =
service["more_info_link"].string_value();
if (more_info_link.empty()) {
ui->moreInfoButton->hide();
} else {
ui->moreInfoButton->setTargetUrl(QUrl(more_info_link.c_str()));
ui->moreInfoButton->show();
}
}
void OBSBasicSettings::UpdateKeyLink()
{
QString serviceName = ui->service->currentText();
QString customServer = ui->customServer->text().trimmed();
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
std::string streamKeyLink = service["stream_key_link"].string_value();
if (customServer.contains("fbcdn.net") && IsCustomService()) {
streamKeyLink =
"https://www.facebook.com/live/producer?ref=OBS";
}
if (serviceName == "Dacast") {
ui->streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.EncoderKey"));
} else {
ui->streamKeyLabel->setText(
QTStr("Basic.AutoConfig.StreamPage.StreamKey"));
}
if (streamKeyLink.empty()) {
ui->getStreamKeyButton->hide();
} else {
ui->getStreamKeyButton->setTargetUrl(
QUrl(streamKeyLink.c_str()));
ui->getStreamKeyButton->show();
}
}
void OBSBasicSettings::LoadServices(bool showAll)
{
GetServicesJson();
auto &services = servicesRoot["services"].array_items();
ui->service->blockSignals(true);
ui->service->clear();
QStringList names;
for (const Json &service : services) {
if (!showAll && !service["common"].bool_value())
continue;
names.push_back(service["name"].string_value().c_str());
}
if (showAll)
names.sort(Qt::CaseInsensitive);
for (QString &name : names)
ui->service->addItem(name);
if (!showAll) {
ui->service->addItem(
QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
QVariant((int)ListOpt::ShowAll));
}
ui->service->insertItem(
0, QTStr("Basic.AutoConfig.StreamPage.Service.Custom"),
QVariant((int)ListOpt::Custom));
if (!lastService.isEmpty()) {
int idx = ui->service->findText(lastService);
if (idx != -1)
ui->service->setCurrentIndex(idx);
}
ui->service->blockSignals(false);
}
static inline bool is_auth_service(const std::string &service)
{
return Auth::AuthType(service) != Auth::Type::None;
@ -426,14 +314,14 @@ void OBSBasicSettings::on_service_currentIndexChanged(int)
return;
std::string service = QT_TO_UTF8(ui->service->currentText());
bool custom = IsCustomService();
bool custom = streamUi.IsCustomService();
ui->disconnectAccount->setVisible(false);
ui->bandwidthTestEnable->setVisible(false);
ui->twitchAddonDropdown->setVisible(false);
ui->twitchAddonLabel->setVisible(false);
if (lastService != service.c_str()) {
if (streamUi.LastService() != service.c_str()) {
reset_service_ui_fields(ui.get(), service, loading);
}
@ -475,33 +363,6 @@ void OBSBasicSettings::on_service_currentIndexChanged(int)
}
}
void OBSBasicSettings::UpdateServerList()
{
QString serviceName = ui->service->currentText();
bool showMore = ui->service->currentData().toInt() ==
(int)ListOpt::ShowAll;
if (showMore) {
LoadServices(true);
ui->service->showPopup();
return;
} else {
lastService = serviceName;
}
GetServicesJson();
Json service =
get_service_from_json(servicesRoot, QT_TO_UTF8(serviceName));
ui->server->clear();
auto &servers = service["servers"].array_items();
for (const Json &server : servers) {
ui->server->addItem(server["name"].string_value().c_str(),
server["url"].string_value().c_str());
}
}
void OBSBasicSettings::on_show_clicked()
{
if (ui->key->echoMode() == QLineEdit::Password) {
@ -526,7 +387,7 @@ void OBSBasicSettings::on_authPwShow_clicked()
OBSService OBSBasicSettings::SpawnTempService()
{
bool custom = IsCustomService();
bool custom = streamUi.IsCustomService();
const char *service_id = custom ? "rtmp_custom" : "rtmp_common";
OBSDataAutoRelease settings = obs_data_create();
@ -669,7 +530,7 @@ void OBSBasicSettings::on_useStreamKey_clicked()
void OBSBasicSettings::on_useAuth_toggled()
{
if (!IsCustomService())
if (!streamUi.IsCustomService())
return;
bool use_auth = ui->useAuth->isChecked();
@ -687,7 +548,7 @@ void OBSBasicSettings::UpdateVodTrackSetting()
bool enableVodTrack = ui->service->currentText() == "Twitch";
bool wasEnabled = !!vodTrackCheckbox;
if (enableForCustomServer && IsCustomService())
if (enableForCustomServer && streamUi.IsCustomService())
enableVodTrack = true;
if (enableVodTrack == wasEnabled)
@ -774,7 +635,7 @@ OBSService OBSBasicSettings::GetStream1Service()
void OBSBasicSettings::UpdateServiceRecommendations()
{
bool customServer = IsCustomService();
bool customServer = streamUi.IsCustomService();
ui->ignoreRecommended->setVisible(!customServer);
ui->enforceSettingsLabel->setVisible(!customServer);
@ -848,7 +709,7 @@ void OBSBasicSettings::UpdateServiceRecommendations()
void OBSBasicSettings::DisplayEnforceWarning(bool checked)
{
if (IsCustomService())
if (streamUi.IsCustomService())
return;
if (!checked) {
@ -950,7 +811,7 @@ void OBSBasicSettings::UpdateResFPSLimits()
size_t res_count = 0;
int max_fps = 0;
if (!IsCustomService() && !ignoreRecommended) {
if (!streamUi.IsCustomService() && !ignoreRecommended) {
OBSService service = GetStream1Service();
obs_service_get_supported_resolutions(service, &res_list,
&res_count);

View File

@ -28,6 +28,7 @@
#include <obs.hpp>
#include "streaming-helpers.hpp"
#include "auth-base.hpp"
class OBSBasic;
@ -109,10 +110,6 @@ private:
std::shared_ptr<Auth> auth;
inline void GetServicesJson();
json11::Json servicesRoot;
bool servicesLoaded = false;
bool generalChanged = false;
bool stream1Changed = false;
bool outputsChanged = false;
@ -165,6 +162,8 @@ private:
uint32_t outputCX = 0;
uint32_t outputCY = 0;
StreamSettingsUI streamUi;
QPointer<QCheckBox> simpleVodTrack;
QPointer<QCheckBox> vodTrackCheckbox;
@ -254,21 +253,15 @@ private:
/* stream */
void InitStreamPage();
inline bool IsCustomService() const;
void LoadServices(bool showAll);
void OnOAuthStreamKeyConnected();
void OnAuthConnected();
QString lastService;
int prevLangIndex;
bool prevBrowserAccel;
private slots:
void UpdateServerList();
void UpdateKeyLink();
void UpdateVodTrackSetting();
void UpdateServiceRecommendations();
void RecreateOutputResolutionWidget();
void UpdateResFPSLimits();
void UpdateMoreInfoLink();
void DisplayEnforceWarning(bool checked);
void on_show_clicked();
void on_authPwShow_clicked();