UI: Add _CHANGING frontend events

Adds the following events:
- `OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING`
- `OBS_FRONTEND_EVENT_PROFILE_CHANGING`

Both emitted right before the change occurs. Can provide plugins with
better awareness of these critical operations happening, so that they
can react accordingly.
This commit is contained in:
tt2468 2021-10-07 02:59:20 -07:00 • committed by Jim
commit feda1aaa28
3 changed files with 26 additions and 0 deletions

View file

@ -305,6 +305,9 @@ bool OBSBasic::CreateProfile(const std::string &newName, bool create_new,
return false;
}
if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
config_set_string(App()->GlobalConfig(), "Basic", "Profile",
newName.c_str());
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
@ -514,6 +517,9 @@ void OBSBasic::on_actionDupProfile_triggered()
void OBSBasic::on_actionRenameProfile_triggered()
{
if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
std::string curDir =
config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir");
std::string curName =
@ -580,6 +586,9 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
return;
}
if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
newPath.resize(newPath_len);
const char *newDir = strrchr(newPath.c_str(), '/') + 1;
@ -755,6 +764,9 @@ void OBSBasic::ChangeProfile()
return;
}
if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
path.resize(path_len);
const char *newName = config_get_string(config, "General", "Name");