Display all scene items when selecting "current scene"

This commit is contained in:
WarmUpTill
2021-06-22 20:56:13 +02:00
committed by WarmUpTill
parent 034a1b0c93
commit efef29603b
3 changed files with 38 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
#include "headers/utility.hpp"
#include "headers/platform-funcs.hpp"
#include "headers/scene-selection.hpp"
#include <QTextStream>
#include <QLabel>
@@ -666,6 +667,38 @@ void populateSceneItemSelection(QComboBox *list, OBSWeakSource sceneWeakSource)
list->setCurrentIndex(0);
}
void populateSceneItemSelection(QComboBox *list, SceneSelection &s)
{
std::set<QString> names;
if (s.GetType() == SceneSelectionType::CURRENT) {
auto enumScenes = [](void *param, obs_source_t *source) {
if (!source) {
return true;
}
std::set<QString> *names =
reinterpret_cast<std::set<QString> *>(param);
auto scene = obs_scene_from_source(source);
obs_scene_enum_items(scene, enumSceneItem, names);
return true;
};
obs_enum_scenes(enumScenes, &names);
} else {
auto source = obs_weak_source_get_source(s.GetScene(false));
auto scene = obs_scene_from_source(source);
obs_scene_enum_items(scene, enumSceneItem, &names);
obs_source_release(source);
}
for (auto &name : names) {
list->addItem(name);
}
list->model()->sort(0);
addSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
list->setCurrentIndex(0);
}
QMetaObject::Connection PulseWidget(QWidget *widget, QColor endColor,
QColor startColor, QString specifier)
{