requesthandler: Use Frontend API for CreateSceneCollection

This commit is contained in:
gxalpha 2023-03-07 02:07:04 +01:00 committed by tt2468
parent 6c67b276a7
commit caaec5d97f

View File

@ -198,10 +198,7 @@ RequestResult RequestHandler::CreateSceneCollection(const Request &request)
if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end()) if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end())
return RequestResult::Error(RequestStatus::ResourceAlreadyExists); return RequestResult::Error(RequestStatus::ResourceAlreadyExists);
QMainWindow *mainWindow = static_cast<QMainWindow *>(obs_frontend_get_main_window()); bool success = obs_frontend_add_scene_collection(sceneCollectionName.c_str());
bool success = false;
QMetaObject::invokeMethod(mainWindow, "AddSceneCollection", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, success),
Q_ARG(bool, true), Q_ARG(QString, QString::fromStdString(sceneCollectionName)));
if (!success) if (!success)
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene collection."); return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene collection.");