diff --git a/UI/auth-twitch.cpp b/UI/auth-twitch.cpp index ce46c60d4..2c7818f5c 100644 --- a/UI/auth-twitch.cpp +++ b/UI/auth-twitch.cpp @@ -217,8 +217,16 @@ void TwitchAuth::LoadUI() cef->add_force_popup_url(moderation_tools_url, chat.data()); script = "localStorage.setItem('twilight.theme', 1);"; - script += bttv_script; - script += ffz_script; + + const int twAddonChoice = + config_get_int(main->Config(), service(), "AddonChoice"); + if (twAddonChoice) { + if (twAddonChoice & 0x1) + script += bttv_script; + if (twAddonChoice & 0x2) + script += ffz_script; + } + browser->setStartupScript(script); main->addDockWidget(Qt::RightDockWidgetArea, chat.data()); @@ -261,8 +269,15 @@ void TwitchAuth::LoadSecondaryUIPanes() script += name; script += "/dashboard/live"; script += referrer_script2; - script += bttv_script; - script += ffz_script; + + const int twAddonChoice = + config_get_int(main->Config(), service(), "AddonChoice"); + if (twAddonChoice) { + if (twAddonChoice & 0x1) + script += bttv_script; + if (twAddonChoice & 0x2) + script += ffz_script; + } /* ----------------------------------- */ diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini index 634f533d0..37bc5527f 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -670,6 +670,11 @@ Basic.Settings.Stream.Custom.UseAuthentication="Use authentication" Basic.Settings.Stream.Custom.Username="Username" Basic.Settings.Stream.Custom.Password="Password" Basic.Settings.Stream.BandwidthTestMode="Enable Bandwidth Test Mode" +Basic.Settings.Stream.TTVAddon="Twitch Chat Add-Ons" +Basic.Settings.Stream.TTVAddon.None="None" +Basic.Settings.Stream.TTVAddon.BTTV="BetterTTV" +Basic.Settings.Stream.TTVAddon.FFZ="FrankerFaceZ" +Basic.Settings.Stream.TTVAddon.Both="BetterTTV and FrankerFaceZ" # basic mode 'output' settings Basic.Settings.Output="Output" diff --git a/UI/forms/OBSBasicSettings.ui b/UI/forms/OBSBasicSettings.ui index f096bd398..a5e03b684 100644 --- a/UI/forms/OBSBasicSettings.ui +++ b/UI/forms/OBSBasicSettings.ui @@ -151,8 +151,8 @@ 0 0 - 630 - 1035 + 803 + 977 @@ -1012,18 +1012,18 @@ - - - - - - -4 - - - Basic.AutoConfig.StreamPage.GetStreamKey - - - + + + + + + -4 + + + Basic.AutoConfig.StreamPage.GetStreamKey + + + @@ -1102,7 +1102,7 @@ - + Basic.Settings.Stream.Custom.Username @@ -1112,10 +1112,10 @@ - + - + Basic.Settings.Stream.Custom.Password @@ -1125,7 +1125,7 @@ - + @@ -1157,6 +1157,19 @@ + + + + + + + Basic.Settings.Stream.TTVAddon + + + twitchAddonDropdown + + + @@ -1193,8 +1206,8 @@ 0 0 - 739 - 793 + 601 + 631 @@ -2268,7 +2281,7 @@ 0 - + 0 @@ -3702,8 +3715,8 @@ 0 0 - 696 - 601 + 555 + 469 @@ -4518,8 +4531,8 @@ 0 0 - 759 - 930 + 803 + 781 diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 1e2e7a49f..c2cb95e12 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -735,6 +735,18 @@ bool OBSApp::InitGlobalConfig() changed = true; } +#define PRE_24_1_DEFS "Pre24.1Defaults" + if (!config_has_user_value(globalConfig, "General", PRE_24_1_DEFS)) { + bool useOldDefaults = lastVersion && + lastVersion < + MAKE_SEMANTIC_VERSION(24, 1, 0); + + config_set_bool(globalConfig, "General", PRE_24_1_DEFS, + useOldDefaults); + changed = true; + } +#undef PRE_24_1_DEFS + if (config_has_user_value(globalConfig, "BasicWindow", "MultiviewLayout")) { const char *layout = config_get_string( diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 6419fd6c2..3e373b756 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -1198,6 +1198,15 @@ bool OBSBasic::InitBasicConfigDefaults() changed = true; } + /* ----------------------------------------------------- */ + /* set twitch chat extensions to "both" if prev version */ + /* is under 24.1 */ + if (config_get_bool(GetGlobalConfig(), "General", "Pre24.1Defaults") && + !config_has_user_value(basicConfig, "Twitch", "AddonChoice")) { + config_set_int(basicConfig, "Twitch", "AddonChoice", 3); + changed = true; + } + /* ----------------------------------------------------- */ if (changed) diff --git a/UI/window-basic-settings-stream.cpp b/UI/window-basic-settings-stream.cpp index 4f5b1fee4..ecb7f101b 100644 --- a/UI/window-basic-settings-stream.cpp +++ b/UI/window-basic-settings-stream.cpp @@ -39,6 +39,8 @@ void OBSBasicSettings::InitStreamPage() ui->connectAccount2->setVisible(false); ui->disconnectAccount->setVisible(false); ui->bandwidthTestEnable->setVisible(false); + ui->twitchAddonDropdown->setVisible(false); + ui->twitchAddonLabel->setVisible(false); int vertSpacing = ui->topStreamLayout->verticalSpacing(); @@ -56,6 +58,15 @@ void OBSBasicSettings::InitStreamPage() LoadServices(false); + ui->twitchAddonDropdown->addItem( + QTStr("Basic.Settings.Stream.TTVAddon.None")); + ui->twitchAddonDropdown->addItem( + QTStr("Basic.Settings.Stream.TTVAddon.BTTV")); + ui->twitchAddonDropdown->addItem( + QTStr("Basic.Settings.Stream.TTVAddon.FFZ")); + ui->twitchAddonDropdown->addItem( + QTStr("Basic.Settings.Stream.TTVAddon.Both")); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateServerList())); connect(ui->service, SIGNAL(currentIndexChanged(int)), this, @@ -98,6 +109,9 @@ void OBSBasicSettings::LoadStream1Settings() bool bw_test = obs_data_get_bool(settings, "bwtest"); ui->bandwidthTestEnable->setChecked(bw_test); + + idx = config_get_int(main->Config(), "Twitch", "AddonChoice"); + ui->twitchAddonDropdown->setCurrentIndex(idx); } UpdateServerList(); @@ -161,6 +175,21 @@ void OBSBasicSettings::SaveStream1Settings() obs_data_set_bool(settings, "bwtest", ui->bandwidthTestEnable->isChecked()); + + if (!!auth && strcmp(auth->service(), "Twitch") == 0) { + bool choiceExists = config_has_user_value( + main->Config(), "Twitch", "AddonChoice"); + int currentChoice = + config_get_int(main->Config(), "Twitch", "AddonChoice"); + int newChoice = ui->twitchAddonDropdown->currentIndex(); + + config_set_int(main->Config(), "Twitch", "AddonChoice", + newChoice); + + if (choiceExists && currentChoice != newChoice) + forceAuthReload = true; + } + obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text())); OBSService newService = obs_service_create( @@ -277,6 +306,8 @@ void OBSBasicSettings::on_service_currentIndexChanged(int) ui->disconnectAccount->setVisible(false); ui->bandwidthTestEnable->setVisible(false); + ui->twitchAddonDropdown->setVisible(false); + ui->twitchAddonLabel->setVisible(false); #ifdef BROWSER_AVAILABLE if (cef) { @@ -430,8 +461,11 @@ void OBSBasicSettings::OnOAuthStreamKeyConnected() ui->connectAccount2->setVisible(false); ui->disconnectAccount->setVisible(true); - if (strcmp(a->service(), "Twitch") == 0) + if (strcmp(a->service(), "Twitch") == 0) { ui->bandwidthTestEnable->setVisible(true); + ui->twitchAddonLabel->setVisible(true); + ui->twitchAddonDropdown->setVisible(true); + } } ui->streamStackWidget->setCurrentIndex((int)Section::StreamKey); @@ -494,6 +528,8 @@ void OBSBasicSettings::on_disconnectAccount_clicked() ui->connectAccount2->setVisible(true); ui->disconnectAccount->setVisible(false); ui->bandwidthTestEnable->setVisible(false); + ui->twitchAddonDropdown->setVisible(false); + ui->twitchAddonLabel->setVisible(false); ui->key->setText(""); } diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index 5dae7b6ba..9b1273de6 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -337,6 +337,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) HookWidget(ui->customServer, 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); HookWidget(ui->useAuth, CHECK_CHANGED, STREAM1_CHANGED); HookWidget(ui->authUsername, EDIT_CHANGED, STREAM1_CHANGED); HookWidget(ui->authPw, EDIT_CHANGED, STREAM1_CHANGED); @@ -3486,6 +3487,12 @@ void OBSBasicSettings::closeEvent(QCloseEvent *event) { if (Changed() && !QueryChanges()) event->ignore(); + + if (forceAuthReload) { + main->auth->Save(); + main->auth->Load(); + forceAuthReload = false; + } } void OBSBasicSettings::on_theme_activated(int idx) diff --git a/UI/window-basic-settings.hpp b/UI/window-basic-settings.hpp index 935581704..7521f70f6 100644 --- a/UI/window-basic-settings.hpp +++ b/UI/window-basic-settings.hpp @@ -115,6 +115,7 @@ private: bool advancedChanged = false; int pageIndex = 0; bool loading = true; + bool forceAuthReload = false; std::string savedTheme; int lastSimpleRecQualityIdx = 0;