UI: Add obs_frontend_add_scene_collection API call

Allows the ability to add a new scene collection via the frontend API.
Blocks until the scene collection has been successfully added to ensure
synchronization between the calling thread and the UI thread.

(Jim: Added detailed description to commit message)

Closes obsproject/obs-studio#1232
This commit is contained in:
Ilya Melamed
2018-05-04 15:36:01 -07:00
committed by jp9000
parent 3eec139b2e
commit c768f703ad
6 changed files with 37 additions and 4 deletions

View File

@@ -154,13 +154,19 @@ static bool GetSceneCollectionName(QWidget *parent, std::string &name,
return true;
}
void OBSBasic::AddSceneCollection(bool create_new)
bool OBSBasic::AddSceneCollection(bool create_new, const QString &qname)
{
std::string name;
std::string file;
if (!GetSceneCollectionName(this, name, file))
return;
if (qname.isEmpty()) {
if (!GetSceneCollectionName(this, name, file))
return false;
} else {
name = QT_TO_UTF8(qname);
if (SceneCollectionExists(name.c_str()))
return false;
}
SaveProjectNow();
@@ -185,6 +191,8 @@ void OBSBasic::AddSceneCollection(bool create_new)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}
return true;
}
void OBSBasic::RefreshSceneCollections()