mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
UI: Add custom server support for Twitch
This commit is contained in:
parent
432a2a8e9c
commit
976b200254
|
@ -957,6 +957,8 @@ Basic.Settings.Stream.Recommended.MaxVideoBitrate="Maximum Video Bitrate: %1 kbp
|
|||
Basic.Settings.Stream.Recommended.MaxAudioBitrate="Maximum Audio Bitrate: %1 kbps"
|
||||
Basic.Settings.Stream.Recommended.MaxResolution="Maximum Resolution: %1"
|
||||
Basic.Settings.Stream.Recommended.MaxFPS="Maximum FPS: %1"
|
||||
Basic.Settings.Stream.SpecifyCustomServer="Specify Custom Server..."
|
||||
Basic.Settings.Stream.ServiceCustomServer="Custom Server"
|
||||
|
||||
# basic mode 'output' settings
|
||||
Basic.Settings.Output="Output"
|
||||
|
|
|
@ -1271,6 +1271,19 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="serviceCustomServerLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.ServiceCustomServer</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>serviceCustomServer</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="serviceCustomServer"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="streamKeyLabel">
|
||||
<property name="text">
|
||||
<string>Basic.AutoConfig.StreamPage.StreamKey</string>
|
||||
|
@ -1283,7 +1296,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QFrame" name="streamKeyWidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="leftMargin">
|
||||
|
@ -1334,7 +1347,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -1347,7 +1360,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
|
@ -1390,21 +1403,21 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="bandwidthTestEnable">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.BandwidthTestMode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="useAuth">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.UseAuthentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="authUsernameLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Username</string>
|
||||
|
@ -1414,10 +1427,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="authUsername"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="authPwLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Password</string>
|
||||
|
@ -1427,7 +1440,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QFrame" name="authPwWidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_25">
|
||||
<property name="leftMargin">
|
||||
|
@ -1459,10 +1472,10 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="twitchAddonDropdown"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="twitchAddonLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.TTVAddon</string>
|
||||
|
@ -1472,14 +1485,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="ignoreRecommended">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.IgnoreRecommended</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="enforceSettingsLabel">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
|
@ -1492,7 +1505,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_28">
|
||||
<item>
|
||||
<widget class="QPushButton" name="useStreamKeyAdv">
|
||||
|
@ -1516,14 +1529,14 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="connectedAccountLabel">
|
||||
<property name="text">
|
||||
<string>Basic.AutoConfig.StreamPage.ConnectedAccount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QPushButton" name="connectAccount2">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QUuid>
|
||||
|
||||
#include "window-basic-settings.hpp"
|
||||
#include "obs-frontend-api.h"
|
||||
|
@ -20,6 +21,13 @@
|
|||
#include "youtube-api-wrappers.hpp"
|
||||
#endif
|
||||
|
||||
static const QUuid &CustomServerUUID()
|
||||
{
|
||||
static const QUuid uuid = QUuid::fromString(
|
||||
QT_UTF8("{241da255-70f2-4bbb-bef7-509695bf8e65}"));
|
||||
return uuid;
|
||||
}
|
||||
|
||||
struct QCef;
|
||||
struct QCefCookieManager;
|
||||
|
||||
|
@ -108,6 +116,8 @@ void OBSBasicSettings::LoadStream1Settings()
|
|||
const char *service = obs_data_get_string(settings, "service");
|
||||
const char *server = obs_data_get_string(settings, "server");
|
||||
const char *key = obs_data_get_string(settings, "key");
|
||||
bool use_custom_server =
|
||||
obs_data_get_bool(settings, "using_custom_server");
|
||||
protocol = QT_UTF8(obs_service_get_protocol(service_obj));
|
||||
const char *bearer_token =
|
||||
obs_data_get_string(settings, "bearer_token");
|
||||
|
@ -148,7 +158,13 @@ void OBSBasicSettings::LoadStream1Settings()
|
|||
UpdateServerList();
|
||||
|
||||
if (is_rtmp_common) {
|
||||
int idx = ui->server->findData(server);
|
||||
int idx = -1;
|
||||
if (use_custom_server) {
|
||||
idx = ui->server->findData(CustomServerUUID());
|
||||
} else {
|
||||
idx = ui->server->findData(QString::fromUtf8(server));
|
||||
}
|
||||
|
||||
if (idx == -1) {
|
||||
if (server && *server)
|
||||
ui->server->insertItem(0, server, server);
|
||||
|
@ -157,6 +173,9 @@ void OBSBasicSettings::LoadStream1Settings()
|
|||
ui->server->setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
if (use_custom_server)
|
||||
ui->serviceCustomServer->setText(server);
|
||||
|
||||
if (is_whip)
|
||||
ui->key->setText(bearer_token);
|
||||
else
|
||||
|
@ -223,9 +242,19 @@ void OBSBasicSettings::SaveStream1Settings()
|
|||
obs_data_set_string(settings, "service",
|
||||
QT_TO_UTF8(ui->service->currentText()));
|
||||
obs_data_set_string(settings, "protocol", QT_TO_UTF8(protocol));
|
||||
if (ui->server->currentData() == CustomServerUUID()) {
|
||||
obs_data_set_bool(settings, "using_custom_server",
|
||||
true);
|
||||
|
||||
obs_data_set_string(
|
||||
settings, "server",
|
||||
QT_TO_UTF8(ui->server->currentData().toString()));
|
||||
QT_TO_UTF8(ui->serviceCustomServer->text()));
|
||||
} else {
|
||||
obs_data_set_string(
|
||||
settings, "server",
|
||||
QT_TO_UTF8(
|
||||
ui->server->currentData().toString()));
|
||||
}
|
||||
} else {
|
||||
obs_data_set_string(
|
||||
settings, "server",
|
||||
|
@ -675,6 +704,12 @@ void OBSBasicSettings::UpdateServerList()
|
|||
ui->server->addItem(name, server);
|
||||
}
|
||||
|
||||
if (serviceName == "Twitch") {
|
||||
ui->server->addItem(
|
||||
QTStr("Basic.Settings.Stream.SpecifyCustomServer"),
|
||||
CustomServerUUID());
|
||||
}
|
||||
|
||||
obs_properties_destroy(props);
|
||||
}
|
||||
|
||||
|
@ -887,6 +922,19 @@ void OBSBasicSettings::on_useAuth_toggled()
|
|||
ui->authPwWidget->setVisible(use_auth);
|
||||
}
|
||||
|
||||
bool OBSBasicSettings::IsCustomServer()
|
||||
{
|
||||
return ui->server->currentData() == QVariant{CustomServerUUID()};
|
||||
}
|
||||
|
||||
void OBSBasicSettings::on_server_currentIndexChanged(int /*index*/)
|
||||
{
|
||||
auto server_is_custom = IsCustomServer();
|
||||
|
||||
ui->serviceCustomServerLabel->setVisible(server_is_custom);
|
||||
ui->serviceCustomServer->setVisible(server_is_custom);
|
||||
}
|
||||
|
||||
void OBSBasicSettings::UpdateVodTrackSetting()
|
||||
{
|
||||
bool enableForCustomServer = config_get_bool(
|
||||
|
|
|
@ -411,6 +411,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
|||
HookWidget(ui->service, COMBO_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->server, COMBO_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->customServer, EDIT_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->serviceCustomServer, EDIT_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->bandwidthTestEnable, CHECK_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->twitchAddonDropdown, COMBO_CHANGED, STREAM1_CHANGED);
|
||||
|
|
|
@ -296,6 +296,8 @@ private:
|
|||
/* Appearance */
|
||||
void InitAppearancePage();
|
||||
|
||||
bool IsCustomServer();
|
||||
|
||||
private slots:
|
||||
void RecreateOutputResolutionWidget();
|
||||
bool UpdateResFPSLimits();
|
||||
|
@ -306,6 +308,7 @@ private slots:
|
|||
void on_disconnectAccount_clicked();
|
||||
void on_useStreamKey_clicked();
|
||||
void on_useAuth_toggled();
|
||||
void on_server_currentIndexChanged(int index);
|
||||
|
||||
void on_hotkeyFilterReset_clicked();
|
||||
void on_hotkeyFilterSearch_textChanged(const QString text);
|
||||
|
|
Loading…
Reference in a new issue