UI: Add setting for Mixer add-on choice
MixrElixr Emotes is the emote-specific portion of MixrElixr, a popular extension for Mixer chat. Disabled by default.
This commit is contained in:
@@ -177,6 +177,11 @@ bool MixerAuth::LoadInternal()
|
||||
return OAuthStreamKey::LoadInternal();
|
||||
}
|
||||
|
||||
static const char *elixr_script = "\
|
||||
var elixr = document.createElement('script');\
|
||||
elixr.setAttribute('src','https://api.mixrelixr.com/scripts/elixr-emotes-embedded-chat.bundle.js');\
|
||||
document.head.appendChild(elixr);";
|
||||
|
||||
void MixerAuth::LoadUI()
|
||||
{
|
||||
if (!cef)
|
||||
@@ -189,6 +194,7 @@ void MixerAuth::LoadUI()
|
||||
OBSBasic::InitBrowserPanelSafeBlock();
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
|
||||
std::string script = "";
|
||||
std::string url;
|
||||
url += "https://mixer.com/embed/chat/";
|
||||
url += id;
|
||||
@@ -206,6 +212,15 @@ void MixerAuth::LoadUI()
|
||||
QCefWidget *browser = cef->create_widget(nullptr, url, panel_cookies);
|
||||
chat->SetWidget(browser);
|
||||
|
||||
const int mxAddonChoice =
|
||||
config_get_int(main->Config(), service(), "AddonChoice");
|
||||
if (mxAddonChoice) {
|
||||
if (mxAddonChoice & 0x1)
|
||||
script += elixr_script;
|
||||
}
|
||||
|
||||
browser->setStartupScript(script);
|
||||
|
||||
main->addDockWidget(Qt::RightDockWidgetArea, chat.data());
|
||||
chatMenu.reset(main->AddDockWidget(chat.data()));
|
||||
|
||||
|
@@ -687,6 +687,9 @@ 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.Settings.Stream.MixerAddon="Mixer Chat Add-Ons"
|
||||
Basic.Settings.Stream.MixerAddon.None="None"
|
||||
Basic.Settings.Stream.MixerAddon.MEE="MixrElixr Emotes"
|
||||
Basic.Settings.Stream.MissingSettingAlert="Missing Stream Setup"
|
||||
Basic.Settings.Stream.StreamSettingsWarning="Open Settings"
|
||||
Basic.Settings.Stream.MissingUrlAndApiKey="URL and Stream Key are missing.\n\nOpen settings to enter the URL and Stream Key in the 'stream' tab."
|
||||
|
@@ -151,8 +151,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>806</width>
|
||||
<height>1254</height>
|
||||
<width>803</width>
|
||||
<height>1026</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
@@ -1140,7 +1140,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="authUsernameLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Username</string>
|
||||
@@ -1150,10 +1150,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="authUsername"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="authPwLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Password</string>
|
||||
@@ -1163,7 +1163,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QWidget" name="authPwWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_25">
|
||||
<property name="leftMargin">
|
||||
@@ -1208,6 +1208,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="mixerAddonLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.MixerAddon</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mixerAddonDropdown</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="mixerAddonDropdown"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -1244,8 +1257,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>813</width>
|
||||
<height>761</height>
|
||||
<width>603</width>
|
||||
<height>631</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@@ -3753,8 +3766,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>767</width>
|
||||
<height>582</height>
|
||||
<width>555</width>
|
||||
<height>469</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_50">
|
||||
@@ -4609,8 +4622,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>791</width>
|
||||
<height>970</height>
|
||||
<width>596</width>
|
||||
<height>781</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
|
@@ -41,6 +41,8 @@ void OBSBasicSettings::InitStreamPage()
|
||||
ui->bandwidthTestEnable->setVisible(false);
|
||||
ui->twitchAddonDropdown->setVisible(false);
|
||||
ui->twitchAddonLabel->setVisible(false);
|
||||
ui->mixerAddonDropdown->setVisible(false);
|
||||
ui->mixerAddonLabel->setVisible(false);
|
||||
|
||||
int vertSpacing = ui->topStreamLayout->verticalSpacing();
|
||||
|
||||
@@ -67,6 +69,11 @@ void OBSBasicSettings::InitStreamPage()
|
||||
ui->twitchAddonDropdown->addItem(
|
||||
QTStr("Basic.Settings.Stream.TTVAddon.Both"));
|
||||
|
||||
ui->mixerAddonDropdown->addItem(
|
||||
QTStr("Basic.Settings.Stream.MixerAddon.None"));
|
||||
ui->mixerAddonDropdown->addItem(
|
||||
QTStr("Basic.Settings.Stream.MixerAddon.MEE"));
|
||||
|
||||
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(UpdateServerList()));
|
||||
connect(ui->service, SIGNAL(currentIndexChanged(int)), this,
|
||||
@@ -112,6 +119,9 @@ void OBSBasicSettings::LoadStream1Settings()
|
||||
|
||||
idx = config_get_int(main->Config(), "Twitch", "AddonChoice");
|
||||
ui->twitchAddonDropdown->setCurrentIndex(idx);
|
||||
|
||||
idx = config_get_int(main->Config(), "Mixer", "AddonChoice");
|
||||
ui->mixerAddonDropdown->setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
UpdateServerList();
|
||||
@@ -189,6 +199,19 @@ void OBSBasicSettings::SaveStream1Settings()
|
||||
if (choiceExists && currentChoice != newChoice)
|
||||
forceAuthReload = true;
|
||||
}
|
||||
if (!!auth && strcmp(auth->service(), "Mixer") == 0) {
|
||||
bool choiceExists = config_has_user_value(
|
||||
main->Config(), "Mixer", "AddonChoice");
|
||||
int currentChoice =
|
||||
config_get_int(main->Config(), "Mixer", "AddonChoice");
|
||||
int newChoice = ui->mixerAddonDropdown->currentIndex();
|
||||
|
||||
config_set_int(main->Config(), "Mixer", "AddonChoice",
|
||||
newChoice);
|
||||
|
||||
if (choiceExists && currentChoice != newChoice)
|
||||
forceAuthReload = true;
|
||||
}
|
||||
|
||||
obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text()));
|
||||
|
||||
@@ -309,6 +332,8 @@ void OBSBasicSettings::on_service_currentIndexChanged(int)
|
||||
ui->bandwidthTestEnable->setVisible(false);
|
||||
ui->twitchAddonDropdown->setVisible(false);
|
||||
ui->twitchAddonLabel->setVisible(false);
|
||||
ui->mixerAddonDropdown->setVisible(false);
|
||||
ui->mixerAddonLabel->setVisible(false);
|
||||
|
||||
#ifdef BROWSER_AVAILABLE
|
||||
if (cef) {
|
||||
@@ -467,6 +492,10 @@ void OBSBasicSettings::OnOAuthStreamKeyConnected()
|
||||
ui->twitchAddonLabel->setVisible(true);
|
||||
ui->twitchAddonDropdown->setVisible(true);
|
||||
}
|
||||
if (strcmp(a->service(), "Mixer") == 0) {
|
||||
ui->mixerAddonLabel->setVisible(true);
|
||||
ui->mixerAddonDropdown->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
ui->streamStackWidget->setCurrentIndex((int)Section::StreamKey);
|
||||
|
@@ -371,6 +371,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->bandwidthTestEnable, CHECK_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->twitchAddonDropdown, COMBO_CHANGED, STREAM1_CHANGED);
|
||||
HookWidget(ui->mixerAddonDropdown, 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);
|
||||
|
Reference in New Issue
Block a user