Allow selecting source type for scene visibility action

This should allow to simplify some setups which required showing /
hiding all sources of a particular type.
This commit is contained in:
WarmUpTill
2021-11-07 12:21:07 +01:00
committed by WarmUpTill
parent fbc9818764
commit e452d8cc8c
5 changed files with 161 additions and 19 deletions

View File

@@ -828,6 +828,36 @@ void populateSceneItemSelection(QComboBox *list, SceneSelection &s)
list->setCurrentIndex(0);
}
void populateSourceTypeSelection(QComboBox *list)
{
std::set<QString> sourceTypeNames;
auto enumSourcesTypes = [](void *param, obs_source_t *source) {
if (!source) {
return true;
}
std::set<QString> *names =
reinterpret_cast<std::set<QString> *>(param);
if (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT) {
return true;
}
names->insert(
obs_source_get_display_name(obs_source_get_id(source)));
return true;
};
obs_enum_sources(enumSourcesTypes, &sourceTypeNames);
for (auto &name : sourceTypeNames) {
if (!name.isEmpty()) {
list->addItem(name);
}
}
list->model()->sort(0);
addSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
list->setCurrentIndex(0);
}
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
QColor endColor, QString specifier,
bool once)