diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt
index 1f4bcbafe..bcb9815ad 100644
--- a/UI/CMakeLists.txt
+++ b/UI/CMakeLists.txt
@@ -134,6 +134,7 @@ set(obs_SOURCES
window-basic-auto-config.cpp
window-basic-main-outputs.cpp
window-basic-source-select.cpp
+ window-basic-settings-stream.cpp
window-basic-auto-config-test.cpp
window-basic-main-scene-collections.cpp
window-basic-main-transitions.cpp
diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini
index 501610dac..31794e3be 100644
--- a/UI/data/locale/en-US.ini
+++ b/UI/data/locale/en-US.ini
@@ -127,7 +127,7 @@ Basic.AutoConfig.StreamPage="Stream Information"
Basic.AutoConfig.StreamPage.SubTitle="Please enter your stream information"
Basic.AutoConfig.StreamPage.Service="Service"
Basic.AutoConfig.StreamPage.Service.ShowAll="Show All..."
-Basic.AutoConfig.StreamPage.Service.Custom="Custom"
+Basic.AutoConfig.StreamPage.Service.Custom="Custom..."
Basic.AutoConfig.StreamPage.Server="Server"
Basic.AutoConfig.StreamPage.StreamKey="Stream Key"
Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)"
diff --git a/UI/forms/AutoConfigStreamPage.ui b/UI/forms/AutoConfigStreamPage.ui
index 6f4d27a3b..7389adafe 100644
--- a/UI/forms/AutoConfigStreamPage.ui
+++ b/UI/forms/AutoConfigStreamPage.ui
@@ -13,232 +13,293 @@
-
-
- QFormLayout::ExpandingFieldsGrow
+
+
+ 0
-
- Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
+
+ 0
- -
-
-
- Basic.AutoConfig.StreamPage.Service
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
-
- service
-
-
-
- -
-
-
- -
-
-
- Basic.AutoConfig.StreamPage.Server
-
-
-
- -
-
-
- 0
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
-
-
-
- -
-
-
- Basic.AutoConfig.StreamPage.StreamKey
-
-
- true
-
-
- key
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- QLineEdit::Password
-
-
-
- -
-
-
- Show
-
-
-
-
-
- -
-
-
- Basic.Settings.Output.VideoBitrate
-
-
- bitrate
-
-
-
- -
-
-
-
-
-
- 500
-
-
- 10000
-
-
- 2500
-
-
-
- -
-
-
- Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip
-
-
- Basic.AutoConfig.StreamPage.PreferHardwareEncoding
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 90
- 20
-
-
-
-
- -
-
-
- Basic.AutoConfig.StreamPage.PerformBandwidthTest
-
-
- true
-
-
-
- -
-
-
- BandwidthTest.Region
-
-
-
-
-
-
- BandwidthTest.Region.Asia
-
-
-
+
+
+ QFormLayout::ExpandingFieldsGrow
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 87
+ 0
+
+
+
+
+ -
+
- BandwidthTest.Region.US
+ Basic.AutoConfig.StreamPage.Service
+
+
+ service
- -
-
-
- BandwidthTest.Region.EU
-
-
-
- -
-
-
- BandwidthTest.Region.Other
-
-
+
-
+
+ -
+
+
+ 0
+
+
+
+
+ QFormLayout::ExpandingFieldsGrow
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
-
+
+
+ Basic.AutoConfig.StreamPage.Server
+
+
+
+ -
+
+
+ 0
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Basic.AutoConfig.StreamPage.StreamKey
+
+
+ true
+
+
+ key
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+
+ QLineEdit::Password
+
+
+
+ -
+
+
+ Show
+
+
+
+
+
+
+ -
+
+
+ Basic.Settings.Output.VideoBitrate
+
+
+ bitrate
+
+
+
+ -
+
+
+
+
+
+ 500
+
+
+ 10000
+
+
+ 2500
+
+
+
+ -
+
+
+ Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip
+
+
+ Basic.AutoConfig.StreamPage.PreferHardwareEncoding
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 87
+ 17
+
+
+
+
+ -
+
+
+ Basic.AutoConfig.StreamPage.PerformBandwidthTest
+
+
+ true
+
+
+
+ -
+
+
+ BandwidthTest.Region
+
+
+
-
+
+
+ BandwidthTest.Region.Asia
+
+
+
+ -
+
+
+ BandwidthTest.Region.US
+
+
+
+ -
+
+
+ BandwidthTest.Region.EU
+
+
+
+ -
+
+
+ BandwidthTest.Region.Other
+
+
+
+
+
+
+
+
+
+
-
- service
- server
- customServer
- key
- show
- preferHardware
- doBandwidthTest
- regionUS
- regionEU
- regionAsia
- regionOther
-
diff --git a/UI/forms/OBSBasicSettings.ui b/UI/forms/OBSBasicSettings.ui
index 9ff8f3300..fee71e1da 100644
--- a/UI/forms/OBSBasicSettings.ui
+++ b/UI/forms/OBSBasicSettings.ui
@@ -145,8 +145,8 @@
0
0
- 804
- 1072
+ 801
+ 836
@@ -686,91 +686,192 @@
0
-
-
+
-
+
0
0
-
-
- 0
+
+
+ QFormLayout::AllNonFixedFieldsGrow
-
- 0
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 0
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
+
-
+
+
+ Basic.AutoConfig.StreamPage.Service
+
+
+ service
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
-
- 170
- 0
-
-
-
- Basic.Settings.Stream.StreamType
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- streamType
-
-
-
- -
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
-
+ -
+
+
+ 20
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 170
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
+
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
-
+
+
+ Basic.AutoConfig.StreamPage.Server
+
+
+
+ -
+
+
+ 0
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Basic.AutoConfig.StreamPage.StreamKey
+
+
+ true
+
+
+ key
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+
+ QLineEdit::Password
+
+
+
+ -
+
+
+ Show
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 170
+ 8
+
+
+
+
+
+
+
+
@@ -797,8 +898,8 @@
0
0
- 813
- 770
+ 818
+ 697
@@ -3913,7 +4014,7 @@
0
0
594
- 807
+ 833
@@ -4751,7 +4852,6 @@
listWidget
- streamType
outputMode
simpleOutputVBitrate
simpleOutputABitrate
@@ -4939,8 +5039,8 @@
16
- 250
- 39
+ 401
+ 64
@@ -4951,12 +5051,12 @@
setVisible(bool)
- 250
- 39
+ 251
+ 64
- 250
- 39
+ 251
+ 64
@@ -4967,12 +5067,12 @@
setVisible(bool)
- 250
- 39
+ 251
+ 64
- 250
- 39
+ 251
+ 64
@@ -4983,12 +5083,12 @@
setVisible(bool)
- 250
- 39
+ 251
+ 64
- 250
- 39
+ 251
+ 64
@@ -4999,12 +5099,12 @@
setVisible(bool)
- 250
- 39
+ 251
+ 64
- 250
- 39
+ 251
+ 64
@@ -5015,12 +5115,12 @@
setCurrentIndex(int)
- 232
- 41
+ 260
+ 73
- 241
- 30
+ 242
+ 85
@@ -5031,12 +5131,12 @@
setEnabled(bool)
- 259
- 60
+ 260
+ 85
- 228
- 50
+ 229
+ 85
@@ -5047,12 +5147,12 @@
setEnabled(bool)
- 259
- 39
+ 260
+ 64
- 228
- 29
+ 229
+ 64
@@ -5063,12 +5163,12 @@
setEnabled(bool)
- 168
- 56
+ 260
+ 85
- 228
- 50
+ 229
+ 85
@@ -5079,12 +5179,12 @@
setCurrentIndex(int)
- 250
- 50
+ 260
+ 85
- 250
- 52
+ 260
+ 85
@@ -5095,12 +5195,12 @@
setVisible(bool)
- 250
- 39
+ 251
+ 64
- 250
- 39
+ 251
+ 64
@@ -5111,11 +5211,11 @@
setEnabled(bool)
- 950
+ 933
579
- 950
+ 933
602
@@ -5127,11 +5227,11 @@
setEnabled(bool)
- 950
+ 933
579
- 950
+ 933
625
@@ -5159,7 +5259,7 @@
setEnabled(bool)
- 950
+ 933
340
@@ -5175,11 +5275,11 @@
setEnabled(bool)
- 950
+ 933
340
- 950
+ 933
366
@@ -5191,11 +5291,11 @@
setEnabled(bool)
- 950
+ 933
340
- 950
+ 933
389
@@ -5207,11 +5307,11 @@
setEnabled(bool)
- 950
+ 933
340
- 950
+ 933
412
@@ -5223,11 +5323,11 @@
setEnabled(bool)
- 950
+ 933
340
- 950
+ 933
435
@@ -5239,11 +5339,11 @@
setEnabled(bool)
- 950
+ 933
222
- 950
+ 933
245
@@ -5255,11 +5355,11 @@
setEnabled(bool)
- 950
+ 933
268
- 950
+ 933
291
diff --git a/UI/window-basic-auto-config.cpp b/UI/window-basic-auto-config.cpp
index 10d2b58c3..e05c88d0c 100644
--- a/UI/window-basic-auto-config.cpp
+++ b/UI/window-basic-auto-config.cpp
@@ -223,6 +223,16 @@ AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
ui->bitrateLabel->setVisible(false);
ui->bitrate->setVisible(false);
+ int vertSpacing = ui->topLayout->verticalSpacing();
+
+ QMargins m = ui->topLayout->contentsMargins();
+ m.setBottom(vertSpacing / 2);
+ ui->topLayout->setContentsMargins(m);
+
+ m = ui->streamkeyPageLayout->contentsMargins();
+ m.setTop(vertSpacing / 2);
+ ui->streamkeyPageLayout->setContentsMargins(m);
+
setTitle(QTStr("Basic.AutoConfig.StreamPage"));
setSubTitle(QTStr("Basic.AutoConfig.StreamPage.SubTitle"));
@@ -378,11 +388,11 @@ void AutoConfigStreamPage::ServiceChanged()
if (service == "Twitch" && wiz->twitchAuto)
regionBased = false;
- ui->formLayout->removeWidget(ui->serverLabel);
- ui->formLayout->removeWidget(ui->serverStackedWidget);
+ ui->streamkeyPageLayout->removeWidget(ui->serverLabel);
+ ui->streamkeyPageLayout->removeWidget(ui->serverStackedWidget);
if (custom) {
- ui->formLayout->insertRow(1, ui->serverLabel,
+ ui->streamkeyPageLayout->insertRow(1, ui->serverLabel,
ui->serverStackedWidget);
ui->region->setVisible(false);
@@ -391,7 +401,7 @@ void AutoConfigStreamPage::ServiceChanged()
ui->serverLabel->setVisible(true);
} else {
if (!testBandwidth)
- ui->formLayout->insertRow(2, ui->serverLabel,
+ ui->streamkeyPageLayout->insertRow(2, ui->serverLabel,
ui->serverStackedWidget);
ui->region->setVisible(regionBased && testBandwidth);
@@ -474,12 +484,6 @@ void AutoConfigStreamPage::LoadServices(bool showAll)
for (QString &name : names)
ui->service->addItem(name);
- if (!lastService.isEmpty()) {
- int idx = ui->service->findText(lastService);
- if (idx != -1)
- ui->service->setCurrentIndex(idx);
- }
-
if (!showAll) {
ui->service->addItem(
QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
@@ -490,6 +494,12 @@ void AutoConfigStreamPage::LoadServices(bool showAll)
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);
+ }
+
obs_properties_destroy(props);
ui->service->blockSignals(false);
@@ -573,7 +583,7 @@ AutoConfig::AutoConfig(QWidget *parent)
#ifdef _WIN32
setWizardStyle(QWizard::ModernStyle);
#endif
- AutoConfigStreamPage *streamPage = new AutoConfigStreamPage();
+ streamPage = new AutoConfigStreamPage();
setPage(StartPage, new AutoConfigStartPage());
setPage(VideoPage, new AutoConfigVideoPage());
@@ -637,6 +647,7 @@ AutoConfig::AutoConfig(QWidget *parent)
streamPage->UpdateServerList();
streamPage->UpdateKeyLink();
+ streamPage->lastService.clear();
if (!customServer) {
QComboBox *serverList = streamPage->ui->server;
diff --git a/UI/window-basic-auto-config.hpp b/UI/window-basic-auto-config.hpp
index 4f7e6bb70..b51866b14 100644
--- a/UI/window-basic-auto-config.hpp
+++ b/UI/window-basic-auto-config.hpp
@@ -17,6 +17,8 @@ class Ui_AutoConfigVideoPage;
class Ui_AutoConfigStreamPage;
class Ui_AutoConfigTestPage;
+class AutoConfigStreamPage;
+
class AutoConfig : public QWizard {
Q_OBJECT
@@ -60,6 +62,8 @@ class AutoConfig : public QWizard {
static inline const char *GetEncoderId(Encoder enc);
+ AutoConfigStreamPage *streamPage = nullptr;
+
Service service = Service::Other;
Quality recordingQuality = Quality::Stream;
Encoder recordingEncoder = Encoder::Stream;
@@ -155,6 +159,10 @@ class AutoConfigStreamPage : public QWizardPage {
friend class AutoConfig;
+ enum class Section : int {
+ StreamKey,
+ };
+
Ui_AutoConfigStreamPage *ui;
QString lastService;
bool ready = false;
diff --git a/UI/window-basic-settings-stream.cpp b/UI/window-basic-settings-stream.cpp
new file mode 100644
index 000000000..ad1f67fbe
--- /dev/null
+++ b/UI/window-basic-settings-stream.cpp
@@ -0,0 +1,300 @@
+#include
+
+#include "window-basic-settings.hpp"
+#include "obs-app.hpp"
+#include "window-basic-main.hpp"
+#include "qt-wrappers.hpp"
+
+enum class ListOpt : int {
+ ShowAll = 1,
+ Custom,
+};
+
+enum class Section : int {
+ StreamKey,
+};
+
+inline bool OBSBasicSettings::IsCustomService() const
+{
+ return ui->service->currentData().toInt() == (int)ListOpt::Custom;
+}
+
+void OBSBasicSettings::InitStreamPage()
+{
+ int vertSpacing = ui->topStreamLayout->verticalSpacing();
+
+ QMargins m = ui->topStreamLayout->contentsMargins();
+ m.setBottom(vertSpacing / 2);
+ ui->topStreamLayout->setContentsMargins(m);
+
+ m = ui->streamkeyPageLayout->contentsMargins();
+ m.setTop(vertSpacing / 2);
+ ui->streamkeyPageLayout->setContentsMargins(m);
+
+ LoadServices(false);
+
+ connect(ui->service, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(UpdateServerList()));
+ connect(ui->service, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(UpdateKeyLink()));
+}
+
+void OBSBasicSettings::LoadStream1Settings()
+{
+ obs_service_t *service_obj = main->GetService();
+ const char *type = obs_service_get_type(service_obj);
+
+ loading = true;
+
+ obs_data_t *settings = obs_service_get_settings(service_obj);
+
+ 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");
+
+ if (strcmp(type, "rtmp_custom") == 0) {
+ ui->service->setCurrentIndex(0);
+ ui->customServer->setText(server);
+ } else {
+ int idx = ui->service->findText(service);
+ if (idx == -1) {
+ if (service && *service)
+ ui->service->insertItem(1, service);
+ idx = 1;
+ }
+ ui->service->setCurrentIndex(idx);
+ }
+
+ UpdateServerList();
+
+ if (strcmp(type, "rtmp_common") == 0) {
+ int idx = ui->server->findData(server);
+ if (idx == -1) {
+ if (server && *server)
+ ui->server->insertItem(0, server, server);
+ idx = 0;
+ }
+ ui->server->setCurrentIndex(idx);
+ }
+
+ ui->key->setText(key);
+
+ lastService.clear();
+ on_service_currentIndexChanged(0);
+
+ obs_data_release(settings);
+
+ UpdateKeyLink();
+
+ loading = false;
+}
+
+void OBSBasicSettings::SaveStream1Settings()
+{
+ bool customServer = IsCustomService();
+ const char *service_id = customServer
+ ? "rtmp_custom"
+ : "rtmp_common";
+
+ obs_service_t *oldService = main->GetService();
+ OBSData hotkeyData = obs_hotkeys_save_service(oldService);
+ obs_data_release(hotkeyData);
+
+ OBSData settings = obs_data_create();
+ obs_data_release(settings);
+
+ if (!customServer) {
+ obs_data_set_string(settings, "service",
+ QT_TO_UTF8(ui->service->currentText()));
+ obs_data_set_string(settings, "server",
+ QT_TO_UTF8(ui->server->currentData().toString()));
+ } else {
+ obs_data_set_string(settings, "server",
+ QT_TO_UTF8(ui->customServer->text()));
+ }
+
+ obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
+
+ OBSService newService = obs_service_create(service_id,
+ "default_service", settings, hotkeyData);
+ obs_service_release(newService);
+
+ if (!newService)
+ return;
+
+ main->SetService(newService);
+ main->SaveService();
+}
+
+void OBSBasicSettings::UpdateKeyLink()
+{
+ bool custom = IsCustomService();
+ QString serviceName = ui->service->currentText();
+
+ if (custom)
+ serviceName = "";
+
+ QString text = QTStr("Basic.AutoConfig.StreamPage.StreamKey");
+ if (serviceName == "Twitch") {
+ text += " ";
+ text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
+ text += "";
+ } else if (serviceName == "YouTube / YouTube Gaming") {
+ text += " ";
+ text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
+ text += "";
+ }
+
+ ui->streamKeyLabel->setText(text);
+}
+
+void OBSBasicSettings::LoadServices(bool showAll)
+{
+ obs_properties_t *props = obs_get_service_properties("rtmp_common");
+
+ OBSData settings = obs_data_create();
+ obs_data_release(settings);
+
+ obs_data_set_bool(settings, "show_all", showAll);
+
+ obs_property_t *prop = obs_properties_get(props, "show_all");
+ obs_property_modified(prop, settings);
+
+ ui->service->blockSignals(true);
+ ui->service->clear();
+
+ QStringList names;
+
+ obs_property_t *services = obs_properties_get(props, "service");
+ size_t services_count = obs_property_list_item_count(services);
+ for (size_t i = 0; i < services_count; i++) {
+ const char *name = obs_property_list_item_string(services, i);
+ names.push_back(name);
+ }
+
+ if (showAll)
+ names.sort();
+
+ 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);
+ }
+
+ obs_properties_destroy(props);
+
+ ui->service->blockSignals(false);
+}
+
+void OBSBasicSettings::on_service_currentIndexChanged(int)
+{
+ bool showMore =
+ ui->service->currentData().toInt() == (int)ListOpt::ShowAll;
+ if (showMore)
+ return;
+
+ std::string service = QT_TO_UTF8(ui->service->currentText());
+ bool custom = IsCustomService();
+
+ if (custom) {
+ ui->streamkeyPageLayout->insertRow(1, ui->serverLabel,
+ ui->serverStackedWidget);
+
+ ui->serverStackedWidget->setCurrentIndex(1);
+ ui->serverStackedWidget->setVisible(true);
+ ui->serverLabel->setVisible(true);
+ } else {
+ ui->serverStackedWidget->setCurrentIndex(0);
+ }
+}
+
+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;
+ }
+
+ 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);
+
+ obs_property_t *servers = obs_properties_get(props, "server");
+
+ ui->server->clear();
+
+ size_t servers_count = obs_property_list_item_count(servers);
+ for (size_t i = 0; i < servers_count; i++) {
+ const char *name = obs_property_list_item_name(servers, i);
+ const char *server = obs_property_list_item_string(servers, i);
+ ui->server->addItem(name, server);
+ }
+
+ obs_properties_destroy(props);
+}
+
+void OBSBasicSettings::on_show_clicked()
+{
+ if (ui->key->echoMode() == QLineEdit::Password) {
+ ui->key->setEchoMode(QLineEdit::Normal);
+ ui->show->setText(QTStr("Hide"));
+ } else {
+ ui->key->setEchoMode(QLineEdit::Password);
+ ui->show->setText(QTStr("Show"));
+ }
+}
+
+OBSService OBSBasicSettings::SpawnTempService()
+{
+ bool custom = IsCustomService();
+ const char *service_id = custom ? "rtmp_custom" : "rtmp_common";
+
+ OBSData settings = obs_data_create();
+ obs_data_release(settings);
+
+ if (!custom) {
+ obs_data_set_string(settings, "service",
+ QT_TO_UTF8(ui->service->currentText()));
+ obs_data_set_string(settings, "server",
+ QT_TO_UTF8(ui->server->currentData().toString()));
+ } else {
+ obs_data_set_string(settings, "server",
+ QT_TO_UTF8(ui->customServer->text()));
+ }
+ obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
+
+ OBSService newService = obs_service_create(service_id,
+ "temp_service", settings, nullptr);
+ obs_service_release(newService);
+
+ return newService;
+}
diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp
index 6a8a5cbc4..5fe7b9189 100644
--- a/UI/window-basic-settings.cpp
+++ b/UI/window-basic-settings.cpp
@@ -322,8 +322,11 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->multiviewDrawNames, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->multiviewDrawAreas, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->multiviewLayout, COMBO_CHANGED, GENERAL_CHANGED);
+ HookWidget(ui->service, COMBO_CHANGED, STREAM1_CHANGED);
+ HookWidget(ui->server, COMBO_CHANGED, STREAM1_CHANGED);
+ HookWidget(ui->customServer, EDIT_CHANGED, STREAM1_CHANGED);
+ HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
HookWidget(ui->outputMode, COMBO_CHANGED, OUTPUTS_CHANGED);
- HookWidget(ui->streamType, COMBO_CHANGED, STREAM1_CHANGED);
HookWidget(ui->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleNoSpace, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutRecFormat, COMBO_CHANGED, OUTPUTS_CHANGED);
@@ -560,7 +563,6 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
installEventFilter(CreateShortcutFilter());
- LoadServiceTypes();
LoadEncoderTypes();
LoadColorRanges();
LoadFormats();
@@ -691,6 +693,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
obs_properties_destroy(ppts);
+ InitStreamPage();
LoadSettings(false);
// Add warning checks to advanced output recording section controls
@@ -770,23 +773,6 @@ void OBSBasicSettings::SaveSpinBox(QSpinBox *widget, const char *section,
config_set_int(main->Config(), section, value, widget->value());
}
-void OBSBasicSettings::LoadServiceTypes()
-{
- const char *type;
- size_t idx = 0;
-
- while (obs_enum_service_types(idx++, &type)) {
- const char *name = obs_service_get_display_name(type);
- QString qName = QT_UTF8(name);
- QString qType = QT_UTF8(type);
-
- ui->streamType->addItem(qName, qType);
- }
-
- type = obs_service_get_type(main->GetService());
- SetComboByValue(ui->streamType, type);
-}
-
#define TEXT_USE_STREAM_ENC \
QTStr("Basic.Settings.Output.Adv.Recording.UseStreamEncoder")
@@ -1145,37 +1131,6 @@ void OBSBasicSettings::LoadGeneralSettings()
loading = false;
}
-void OBSBasicSettings::LoadStream1Settings()
-{
- QLayout *layout = ui->streamContainer->layout();
- obs_service_t *service = main->GetService();
- const char *type = obs_service_get_type(service);
-
- loading = true;
-
- obs_data_t *settings = obs_service_get_settings(service);
-
- delete streamProperties;
- streamProperties = new OBSPropertiesView(settings, type,
- (PropertiesReloadCallback)obs_get_service_properties,
- 170);
-
- streamProperties->setProperty("changed", QVariant(false));
- layout->addWidget(streamProperties);
-
- QObject::connect(streamProperties, SIGNAL(Changed()),
- this, STREAM1_CHANGED);
-
- obs_data_release(settings);
-
- loading = false;
-
- if (main->StreamingActive()) {
- ui->streamType->setEnabled(false);
- ui->streamContainer->setEnabled(false);
- }
-}
-
void OBSBasicSettings::LoadRendererList()
{
#ifdef _WIN32
@@ -2809,26 +2764,6 @@ void OBSBasicSettings::SaveGeneralSettings()
OBSProjector::UpdateMultiviewProjectors();
}
-void OBSBasicSettings::SaveStream1Settings()
-{
- QString streamType = GetComboData(ui->streamType);
-
- obs_service_t *oldService = main->GetService();
- obs_data_t *hotkeyData = obs_hotkeys_save_service(oldService);
-
- obs_service_t *newService = obs_service_create(QT_TO_UTF8(streamType),
- "default_service", streamProperties->GetSettings(),
- hotkeyData);
-
- obs_data_release(hotkeyData);
- if (!newService)
- return;
-
- main->SetService(newService);
- main->SaveService();
- obs_service_release(newService);
-}
-
void OBSBasicSettings::SaveVideoSettings()
{
QString baseResolution = ui->baseResolution->currentText();
@@ -3445,30 +3380,6 @@ void OBSBasicSettings::on_buttonBox_clicked(QAbstractButton *button)
}
}
-void OBSBasicSettings::on_streamType_currentIndexChanged(int idx)
-{
- if (loading)
- return;
-
- QLayout *layout = ui->streamContainer->layout();
- QString streamType = ui->streamType->itemData(idx).toString();
- obs_data_t *settings = obs_service_defaults(QT_TO_UTF8(streamType));
-
- delete streamProperties;
- streamProperties = new OBSPropertiesView(settings,
- QT_TO_UTF8(streamType),
- (PropertiesReloadCallback)obs_get_service_properties,
- 170);
-
- streamProperties->setProperty("changed", QVariant(true));
- layout->addWidget(streamProperties);
-
- QObject::connect(streamProperties, SIGNAL(Changed()),
- this, STREAM1_CHANGED);
-
- obs_data_release(settings);
-}
-
void OBSBasicSettings::on_simpleOutputBrowse_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this,
@@ -4318,11 +4229,7 @@ void OBSBasicSettings::SimpleRecordingEncoderChanged()
OBSService service;
if (stream1Changed) {
- QString streamType = GetComboData(ui->streamType);
- service = obs_service_create_private(
- QT_TO_UTF8(streamType), nullptr,
- streamProperties->GetSettings());
- obs_service_release(service);
+ service = SpawnTempService();
} else {
service = main->GetService();
}
diff --git a/UI/window-basic-settings.hpp b/UI/window-basic-settings.hpp
index 585e5353e..3f913d669 100644
--- a/UI/window-basic-settings.hpp
+++ b/UI/window-basic-settings.hpp
@@ -20,12 +20,13 @@
#include
#include
+#include
#include
#include
#include
-#include
+#include
class OBSBasic;
class QAbstractButton;
@@ -185,7 +186,6 @@ private:
bool QueryChanges();
- void LoadServiceTypes();
void LoadEncoderTypes();
void LoadColorRanges();
void LoadFormats();
@@ -207,6 +207,17 @@ private:
void LoadLanguageList();
void LoadThemeList();
+ /* stream */
+ void InitStreamPage();
+ inline bool IsCustomService() const;
+ void LoadServices(bool showAll);
+ QString lastService;
+private slots:
+ void UpdateServerList();
+ void UpdateKeyLink();
+ void on_show_clicked();
+private:
+
/* output */
void LoadSimpleOutputSettings();
void LoadAdvOutputStreamingSettings();
@@ -255,7 +266,7 @@ private slots:
void on_listWidget_itemSelectionChanged();
void on_buttonBox_clicked(QAbstractButton *button);
- void on_streamType_currentIndexChanged(int idx);
+ void on_service_currentIndexChanged(int idx);
void on_simpleOutputBrowse_clicked();
void on_advOutRecPathBrowse_clicked();
void on_advOutFFPathBrowse_clicked();
@@ -306,6 +317,8 @@ private slots:
void SimpleStreamingEncoderChanged();
+ OBSService SpawnTempService();
+
protected:
virtual void closeEvent(QCloseEvent *event);