mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-14 04:26:08 -05:00
Add option to set Twitch stream tags
This commit is contained in:
@@ -17,6 +17,7 @@ bool MacroActionTwitch::_registered = MacroActionFactory::Register(
|
||||
void MacroActionTwitch::ResolveVariablesToFixedValues()
|
||||
{
|
||||
_streamTitle.ResolveVariables();
|
||||
_tags.ResolveVariables();
|
||||
_markerDescription.ResolveVariables();
|
||||
_duration.ResolveVariables();
|
||||
_announcementMessage.ResolveVariables();
|
||||
@@ -56,6 +57,8 @@ const static std::map<MacroActionTwitch::Action, std::string> actionTypes = {
|
||||
"AdvSceneSwitcher.action.twitch.type.channel.info.title.set"},
|
||||
{MacroActionTwitch::Action::CHANNEL_INFO_CATEGORY_SET,
|
||||
"AdvSceneSwitcher.action.twitch.type.channel.info.category.set"},
|
||||
{MacroActionTwitch::Action::CHANNEL_INFO_TAGS_SET,
|
||||
"AdvSceneSwitcher.action.twitch.type.channel.info.tags.set"},
|
||||
{MacroActionTwitch::Action::RAID_START,
|
||||
"AdvSceneSwitcher.action.twitch.type.raid.start"},
|
||||
{MacroActionTwitch::Action::COMMERCIAL_START,
|
||||
@@ -517,6 +520,9 @@ bool MacroActionTwitch::PerformAction()
|
||||
case Action::CHANNEL_INFO_CATEGORY_SET:
|
||||
SetStreamCategory(token);
|
||||
break;
|
||||
case Action::CHANNEL_INFO_TAGS_SET:
|
||||
_tags.SetStreamTags(*token);
|
||||
break;
|
||||
case Action::RAID_START:
|
||||
StartRaid(token);
|
||||
break;
|
||||
@@ -576,6 +582,7 @@ bool MacroActionTwitch::Save(obs_data_t *obj) const
|
||||
GetWeakTwitchTokenName(_token).c_str());
|
||||
_streamTitle.Save(obj, "streamTitle");
|
||||
_category.Save(obj);
|
||||
_tags.Save(obj);
|
||||
_markerDescription.Save(obj, "markerDescription");
|
||||
obs_data_set_bool(obj, "clipHasDelay", _clipHasDelay);
|
||||
_duration.Save(obj);
|
||||
@@ -604,6 +611,7 @@ bool MacroActionTwitch::Load(obs_data_t *obj)
|
||||
_token = GetWeakTwitchTokenByName(obs_data_get_string(obj, "token"));
|
||||
_streamTitle.Load(obj, "streamTitle");
|
||||
_category.Load(obj);
|
||||
_tags.Load(obj);
|
||||
_markerDescription.Load(obj, "markerDescription");
|
||||
_clipHasDelay = obs_data_get_bool(obj, "clipHasDelay");
|
||||
_duration.Load(obj);
|
||||
@@ -642,6 +650,8 @@ bool MacroActionTwitch::ActionIsSupportedByToken()
|
||||
{{"channel:manage:broadcast"}}},
|
||||
{Action::CHANNEL_INFO_CATEGORY_SET,
|
||||
{{"channel:manage:broadcast"}}},
|
||||
{Action::CHANNEL_INFO_TAGS_SET,
|
||||
{{"channel:manage:broadcast"}}},
|
||||
{Action::CHANNEL_INFO_LANGUAGE_SET,
|
||||
{{"channel:manage:broadcast"}}},
|
||||
{Action::CHANNEL_INFO_DELAY_SET,
|
||||
@@ -815,6 +825,7 @@ MacroActionTwitchEdit::MacroActionTwitchEdit(
|
||||
_tokenWarning(new QLabel()),
|
||||
_streamTitle(new VariableLineEdit(this)),
|
||||
_category(new TwitchCategoryWidget(this)),
|
||||
_tags(new TagListWidget(this)),
|
||||
_markerDescription(new VariableLineEdit(this)),
|
||||
_clipHasDelay(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.action.twitch.clip.hasDelay"))),
|
||||
@@ -840,6 +851,7 @@ MacroActionTwitchEdit::MacroActionTwitchEdit(
|
||||
mainLayout->addLayout(_layout);
|
||||
mainLayout->addWidget(_announcementMessage);
|
||||
mainLayout->addWidget(_chatMessage);
|
||||
mainLayout->addWidget(_tags);
|
||||
mainLayout->addWidget(_tokenWarning);
|
||||
setLayout(mainLayout);
|
||||
|
||||
@@ -876,6 +888,7 @@ void MacroActionTwitchEdit::TwitchTokenChanged(const QString &token)
|
||||
_category->SetToken(_entryData->_token);
|
||||
_channel->SetToken(_entryData->_token);
|
||||
_pointsReward->SetToken(_entryData->_token);
|
||||
_tags->SetToken(_entryData->_token);
|
||||
_entryData->ResetChatConnection();
|
||||
|
||||
SetWidgetVisibility();
|
||||
@@ -930,6 +943,12 @@ void MacroActionTwitchEdit::CategoryChanged(const TwitchCategory &category)
|
||||
_entryData->_category = category;
|
||||
}
|
||||
|
||||
void MacroActionTwitchEdit::TagsChanged(const TwitchTagList &tags)
|
||||
{
|
||||
GUARD_LOADING_AND_LOCK();
|
||||
_entryData->_tags = tags;
|
||||
}
|
||||
|
||||
void MacroActionTwitchEdit::MarkerDescriptionChanged()
|
||||
{
|
||||
GUARD_LOADING_AND_LOCK();
|
||||
@@ -1010,6 +1029,8 @@ void MacroActionTwitchEdit::SetWidgetSignalConnections()
|
||||
QWidget::connect(_category,
|
||||
SIGNAL(CategoryChanged(const TwitchCategory &)), this,
|
||||
SLOT(CategoryChanged(const TwitchCategory &)));
|
||||
QWidget::connect(_tags, SIGNAL(TagListChanged(const TwitchTagList &)),
|
||||
this, SLOT(TagsChanged(const TwitchTagList &)));
|
||||
QWidget::connect(_markerDescription, SIGNAL(editingFinished()), this,
|
||||
SLOT(MarkerDescriptionChanged()));
|
||||
QObject::connect(_clipHasDelay, SIGNAL(stateChanged(int)), this,
|
||||
@@ -1052,6 +1073,8 @@ void MacroActionTwitchEdit::SetWidgetVisibility()
|
||||
_category->setVisible(
|
||||
_entryData->GetAction() ==
|
||||
MacroActionTwitch::Action::CHANNEL_INFO_CATEGORY_SET);
|
||||
_tags->setVisible(_entryData->GetAction() ==
|
||||
MacroActionTwitch::Action::CHANNEL_INFO_TAGS_SET);
|
||||
_channel->setVisible(
|
||||
_entryData->GetAction() ==
|
||||
MacroActionTwitch::Action::RAID_START ||
|
||||
@@ -1247,6 +1270,8 @@ void MacroActionTwitchEdit::UpdateEntryData()
|
||||
_streamTitle->setText(_entryData->_streamTitle);
|
||||
_category->SetToken(_entryData->_token);
|
||||
_category->SetCategory(_entryData->_category);
|
||||
_tags->SetTags(_entryData->_tags);
|
||||
_tags->SetToken(_entryData->_token);
|
||||
_markerDescription->setText(_entryData->_markerDescription);
|
||||
_clipHasDelay->setChecked(_entryData->_clipHasDelay);
|
||||
_duration->SetDuration(_entryData->_duration);
|
||||
|
||||
Reference in New Issue
Block a user