UI: Allow adding scenes as scene items
Allows adding scenes as scene items. Note that you will not be able to add scenes if it detects infinite recursion (i.e. adding scene A to scene B, then adding scene B to scene A), in that case it will just fail to create the scene item.
This commit is contained in:
parent
4d61fa9a4c
commit
3d63096076
4 changed files with 52 additions and 9 deletions
|
|
@ -3050,21 +3050,24 @@ QMenu *OBSBasic::CreateAddSourcePopupMenu()
|
|||
size_t idx = 0;
|
||||
|
||||
QMenu *popup = new QMenu(QTStr("Add"), this);
|
||||
while (obs_enum_input_types(idx++, &type)) {
|
||||
const char *name = obs_source_get_display_name(type);
|
||||
|
||||
if (strcmp(type, "scene") == 0)
|
||||
continue;
|
||||
|
||||
auto addSource = [this, popup] (const char *type, const char *name) {
|
||||
QAction *popupItem = new QAction(QT_UTF8(name), this);
|
||||
popupItem->setData(QT_UTF8(type));
|
||||
connect(popupItem, SIGNAL(triggered(bool)),
|
||||
this, SLOT(AddSourceFromAction()));
|
||||
popup->addAction(popupItem);
|
||||
};
|
||||
|
||||
while (obs_enum_input_types(idx++, &type)) {
|
||||
const char *name = obs_source_get_display_name(type);
|
||||
|
||||
addSource(type, name);
|
||||
foundValues = true;
|
||||
}
|
||||
|
||||
addSource("scene", Str("Basic.Scene"));
|
||||
|
||||
if (!foundValues) {
|
||||
delete popup;
|
||||
popup = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue