Add support for "current scene" to populateSceneSelection()

This commit is contained in:
WarmUpTill 2021-06-21 20:13:39 +02:00 committed by WarmUpTill
parent 7cfa956b80
commit 0bc15b4c2d
4 changed files with 21 additions and 10 deletions

View File

@ -64,6 +64,7 @@ void populateMediaSelection(QComboBox *sel, bool addSelect = true);
void populateProcessSelection(QComboBox *sel, bool addSelect = true);
void populateSourceSelection(QComboBox *list, bool addSelect = true);
void populateSceneSelection(QComboBox *sel, bool addPrevious = false,
bool addCurrent = false, bool addAny = false,
bool addSceneGroup = false,
std::deque<SceneGroup> *sceneGroups = nullptr,
bool addSelect = true, std::string selectText = "",

View File

@ -208,8 +208,8 @@ SwitchWidget::SwitchWidget(QWidget *parent, SceneSwitcherEntry *s,
SIGNAL(SceneGroupRenamed(const QString &, const QString &)),
this, SLOT(SceneGroupRename(const QString &, const QString &)));
populateSceneSelection(scenes, usePreviousScene, addSceneGroup,
&switcher->sceneGroups);
populateSceneSelection(scenes, usePreviousScene, false, false,
addSceneGroup, &switcher->sceneGroups);
populateTransitionSelection(transitions, addCurrentTransition);
switchData = s;

View File

@ -324,7 +324,7 @@ ScreenRegionWidget::ScreenRegionWidget(QWidget *parent, ScreenRegionSwitch *s)
SLOT(MaxYChanged(int)));
populateSceneSelection(
excludeScenes, false, false, nullptr, true,
excludeScenes, false, false, false, false, nullptr, true,
obs_module_text(
"AdvSceneSwitcher.screenRegionTab.excludeScenes.None"),
true);

View File

@ -538,8 +538,8 @@ void populateProcessSelection(QComboBox *sel, bool addSelect)
sel->setCurrentIndex(0);
}
void populateSceneSelection(QComboBox *sel, bool addPrevious,
bool addSceneGroup,
void populateSceneSelection(QComboBox *sel, bool addPrevious, bool addCurrent,
bool addAny, bool addSceneGroup,
std::deque<SceneGroup> *sceneGroups, bool addSelect,
std::string selectText, bool selectable)
{
@ -551,11 +551,6 @@ void populateSceneSelection(QComboBox *sel, bool addPrevious,
temp++;
}
if (addPrevious) {
sel->addItem(obs_module_text(
"AdvSceneSwitcher.selectPreviousScene"));
}
if (addSceneGroup && sceneGroups) {
for (auto &sg : *sceneGroups) {
sel->addItem(QString::fromStdString(sg.name));
@ -576,6 +571,21 @@ void populateSceneSelection(QComboBox *sel, bool addPrevious,
}
}
sel->setCurrentIndex(0);
if (addPrevious) {
sel->insertItem(
1, obs_module_text(
"AdvSceneSwitcher.selectPreviousScene"));
}
if (addCurrent) {
sel->insertItem(
1,
obs_module_text("AdvSceneSwitcher.selectCurrentScene"));
}
if (addAny) {
sel->insertItem(
1, obs_module_text("AdvSceneSwitcher.selectAnyScene"));
}
}
static inline void hasFilterEnum(obs_source_t *, obs_source_t *filter,