mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
UI: Cleanup frontend event handling
This adds a function to OBSBasic to call on_event, so every time a event is called, the api variable doesn't have to be checked everytime.
This commit is contained in:
parent
0306effc5f
commit
89554112c1
@ -305,8 +305,8 @@ bool OBSBasic::CreateProfile(const std::string &newName, bool create_new,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api && !rename)
|
if (!rename)
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
||||||
|
|
||||||
config_set_string(App()->GlobalConfig(), "Basic", "Profile",
|
config_set_string(App()->GlobalConfig(), "Basic", "Profile",
|
||||||
newName.c_str());
|
newName.c_str());
|
||||||
@ -355,9 +355,9 @@ bool OBSBasic::CreateProfile(const std::string &newName, bool create_new,
|
|||||||
wizard.exec();
|
wizard.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api && !rename) {
|
if (!rename) {
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -451,8 +451,7 @@ void OBSBasic::DeleteProfile(const QString &profileName)
|
|||||||
DeleteProfile(name.c_str(), profileDir);
|
DeleteProfile(name.c_str(), profileDir);
|
||||||
RefreshProfiles();
|
RefreshProfiles();
|
||||||
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
|
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::RefreshProfiles()
|
void OBSBasic::RefreshProfiles()
|
||||||
@ -539,8 +538,7 @@ void OBSBasic::on_actionRenameProfile_triggered()
|
|||||||
RefreshProfiles();
|
RefreshProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_RENAMED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_RENAMED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
||||||
@ -589,8 +587,7 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
|
||||||
|
|
||||||
newPath.resize(newPath_len);
|
newPath.resize(newPath_len);
|
||||||
|
|
||||||
@ -626,10 +623,8 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
|||||||
|
|
||||||
Auth::Load();
|
Auth::Load();
|
||||||
|
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsRestart) {
|
if (needsRestart) {
|
||||||
QMessageBox::StandardButton button = OBSMessageBox::question(
|
QMessageBox::StandardButton button = OBSMessageBox::question(
|
||||||
@ -768,8 +763,7 @@ void OBSBasic::ChangeProfile()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
|
|
||||||
|
|
||||||
path.resize(path_len);
|
path.resize(path_len);
|
||||||
|
|
||||||
@ -811,8 +805,7 @@ void OBSBasic::ChangeProfile()
|
|||||||
blog(LOG_INFO, "Switched to profile '%s' (%s)", newName, newDir);
|
blog(LOG_INFO, "Switched to profile '%s' (%s)", newName, newDir);
|
||||||
blog(LOG_INFO, "------------------------------------------------");
|
blog(LOG_INFO, "------------------------------------------------");
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
||||||
|
|
||||||
if (needsRestart) {
|
if (needsRestart) {
|
||||||
QMessageBox::StandardButton button = OBSMessageBox::question(
|
QMessageBox::StandardButton button = OBSMessageBox::question(
|
||||||
|
@ -168,8 +168,7 @@ bool OBSBasic::AddSceneCollection(bool create_new, const QString &qname)
|
|||||||
RefreshSceneCollections();
|
RefreshSceneCollections();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
|
||||||
|
|
||||||
new_collection(file, name);
|
new_collection(file, name);
|
||||||
|
|
||||||
@ -179,10 +178,8 @@ bool OBSBasic::AddSceneCollection(bool create_new, const QString &qname)
|
|||||||
|
|
||||||
UpdateTitleBar();
|
UpdateTitleBar();
|
||||||
|
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -294,8 +291,7 @@ void OBSBasic::on_actionRenameSceneCollection_triggered()
|
|||||||
UpdateTitleBar();
|
UpdateTitleBar();
|
||||||
RefreshSceneCollections();
|
RefreshSceneCollections();
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_RENAMED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_RENAMED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionRemoveSceneCollection_triggered()
|
void OBSBasic::on_actionRemoveSceneCollection_triggered()
|
||||||
@ -339,8 +335,7 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
|
||||||
|
|
||||||
oldFile.insert(0, path);
|
oldFile.insert(0, path);
|
||||||
/* os_rename() overwrites if necessary, only the .bak file will remain. */
|
/* os_rename() overwrites if necessary, only the .bak file will remain. */
|
||||||
@ -360,10 +355,8 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
|
|||||||
|
|
||||||
UpdateTitleBar();
|
UpdateTitleBar();
|
||||||
|
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionImportSceneCollection_triggered()
|
void OBSBasic::on_actionImportSceneCollection_triggered()
|
||||||
@ -461,8 +454,7 @@ void OBSBasic::ChangeSceneCollection()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
|
|
||||||
|
|
||||||
SaveProjectNow();
|
SaveProjectNow();
|
||||||
|
|
||||||
@ -480,6 +472,5 @@ void OBSBasic::ChangeSceneCollection()
|
|||||||
|
|
||||||
UpdateTitleBar();
|
UpdateTitleBar();
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,7 @@ ScreenshotObj::~ScreenshotObj()
|
|||||||
|
|
||||||
main->lastScreenshot = path;
|
main->lastScreenshot = path;
|
||||||
|
|
||||||
if (main->api)
|
main->OnEvent(OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
|
||||||
main->api->on_event(
|
|
||||||
OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,10 +267,8 @@ void OBSBasic::TransitionStopped()
|
|||||||
EnableTransitionWidgets(true);
|
EnableTransitionWidgets(true);
|
||||||
UpdatePreviewProgramIndicators();
|
UpdatePreviewProgramIndicators();
|
||||||
|
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_STOPPED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_STOPPED);
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
swapScene = nullptr;
|
swapScene = nullptr;
|
||||||
}
|
}
|
||||||
@ -371,8 +369,7 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force,
|
|||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
obs_transition_set(transition, source);
|
obs_transition_set(transition, source);
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
|
||||||
} else {
|
} else {
|
||||||
int duration = ui->transitionDuration->value();
|
int duration = ui->transitionDuration->value();
|
||||||
|
|
||||||
@ -450,8 +447,7 @@ void OBSBasic::SetTransition(OBSSource transition)
|
|||||||
ui->transitionRemove->setEnabled(configurable);
|
ui->transitionRemove->setEnabled(configurable);
|
||||||
ui->transitionProps->setEnabled(configurable);
|
ui->transitionProps->setEnabled(configurable);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSSource OBSBasic::GetCurrentTransition()
|
OBSSource OBSBasic::GetCurrentTransition()
|
||||||
@ -509,9 +505,7 @@ void OBSBasic::AddTransition(const char *id)
|
|||||||
CreatePropertiesWindow(source);
|
CreatePropertiesWindow(source);
|
||||||
obs_source_release(source);
|
obs_source_release(source);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||||
api->on_event(
|
|
||||||
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
|
||||||
|
|
||||||
ClearQuickTransitionWidgets();
|
ClearQuickTransitionWidgets();
|
||||||
RefreshQuickTransitions();
|
RefreshQuickTransitions();
|
||||||
@ -566,8 +560,7 @@ void OBSBasic::on_transitionRemove_clicked()
|
|||||||
|
|
||||||
ui->transitions->removeItem(idx);
|
ui->transitions->removeItem(idx);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
|
||||||
|
|
||||||
ClearQuickTransitionWidgets();
|
ClearQuickTransitionWidgets();
|
||||||
RefreshQuickTransitions();
|
RefreshQuickTransitions();
|
||||||
@ -607,9 +600,7 @@ void OBSBasic::RenameTransition(OBSSource transition)
|
|||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
ui->transitions->setItemText(idx, QT_UTF8(name.c_str()));
|
ui->transitions->setItemText(idx, QT_UTF8(name.c_str()));
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||||
api->on_event(
|
|
||||||
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
|
||||||
|
|
||||||
ClearQuickTransitionWidgets();
|
ClearQuickTransitionWidgets();
|
||||||
RefreshQuickTransitions();
|
RefreshQuickTransitions();
|
||||||
@ -643,9 +634,7 @@ void OBSBasic::on_transitionProps_clicked()
|
|||||||
|
|
||||||
void OBSBasic::on_transitionDuration_valueChanged()
|
void OBSBasic::on_transitionDuration_valueChanged()
|
||||||
{
|
{
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickTransition *OBSBasic::GetQuickTransition(int id)
|
QuickTransition *OBSBasic::GetQuickTransition(int id)
|
||||||
@ -714,9 +703,7 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force)
|
|||||||
outputHandler
|
outputHandler
|
||||||
->UpdateVirtualCamOutputSource();
|
->UpdateVirtualCamOutputSource();
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
||||||
api->on_event(
|
|
||||||
OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -968,8 +955,7 @@ void OBSBasic::TBarChanged(int value)
|
|||||||
obs_transition_set_manual_time(transition,
|
obs_transition_set_manual_time(transition,
|
||||||
(float)value / T_BAR_PRECISION_F);
|
(float)value / T_BAR_PRECISION_F);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int OBSBasic::GetTbarPosition()
|
int OBSBasic::GetTbarPosition()
|
||||||
@ -1668,8 +1654,7 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
|
|||||||
ui->previewLayout->setAlignment(programOptions,
|
ui->previewLayout->setAlignment(programOptions,
|
||||||
Qt::AlignCenter);
|
Qt::AlignCenter);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);
|
|
||||||
|
|
||||||
blog(LOG_INFO, "Switched to Preview/Program mode");
|
blog(LOG_INFO, "Switched to Preview/Program mode");
|
||||||
blog(LOG_INFO, "-----------------------------"
|
blog(LOG_INFO, "-----------------------------"
|
||||||
@ -1707,8 +1692,7 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
|
|||||||
ui->transitions->setEnabled(true);
|
ui->transitions->setEnabled(true);
|
||||||
tBarActive = false;
|
tBarActive = false;
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED);
|
|
||||||
|
|
||||||
blog(LOG_INFO, "Switched to regular Preview mode");
|
blog(LOG_INFO, "Switched to regular Preview mode");
|
||||||
blog(LOG_INFO, "-----------------------------"
|
blog(LOG_INFO, "-----------------------------"
|
||||||
|
@ -619,10 +619,8 @@ OBSBasic::OBSBasic(QWidget *parent)
|
|||||||
connect(ui->scenes, &SceneTree::scenesReordered,
|
connect(ui->scenes, &SceneTree::scenesReordered,
|
||||||
[]() { OBSProjector::UpdateMultiviewProjectors(); });
|
[]() { OBSProjector::UpdateMultiviewProjectors(); });
|
||||||
|
|
||||||
connect(App(), &OBSApp::StyleChanged, this, [this]() {
|
connect(App(), &OBSApp::StyleChanged, this,
|
||||||
if (api)
|
[this]() { OnEvent(OBS_FRONTEND_EVENT_THEME_CHANGED); });
|
||||||
api->on_event(OBS_FRONTEND_EVENT_THEME_CHANGED);
|
|
||||||
});
|
|
||||||
|
|
||||||
QActionGroup *actionGroup = new QActionGroup(this);
|
QActionGroup *actionGroup = new QActionGroup(this);
|
||||||
actionGroup->addAction(ui->actionSceneListMode);
|
actionGroup->addAction(ui->actionSceneListMode);
|
||||||
@ -1470,10 +1468,8 @@ retryScene:
|
|||||||
if (vcamEnabled)
|
if (vcamEnabled)
|
||||||
outputHandler->UpdateVirtualCamOutputSource();
|
outputHandler->UpdateVirtualCamOutputSource();
|
||||||
|
|
||||||
if (api) {
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SERVICE_PATH "service.json"
|
#define SERVICE_PATH "service.json"
|
||||||
@ -2549,8 +2545,7 @@ void OBSBasic::OBSInit()
|
|||||||
|
|
||||||
void OBSBasic::OnFirstLoad()
|
void OBSBasic::OnFirstLoad()
|
||||||
{
|
{
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_FINISHED_LOADING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_FINISHED_LOADING);
|
|
||||||
|
|
||||||
#ifdef WHATSNEW_ENABLED
|
#ifdef WHATSNEW_ENABLED
|
||||||
/* Attempt to load init screen if available */
|
/* Attempt to load init screen if available */
|
||||||
@ -3376,8 +3371,7 @@ void OBSBasic::AddScene(OBSSource source)
|
|||||||
OBSProjector::UpdateMultiviewProjectors();
|
OBSProjector::UpdateMultiviewProjectors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::RemoveScene(OBSSource source)
|
void OBSBasic::RemoveScene(OBSSource source)
|
||||||
@ -3412,8 +3406,7 @@ void OBSBasic::RemoveScene(OBSSource source)
|
|||||||
OBSProjector::UpdateMultiviewProjectors();
|
OBSProjector::UpdateMultiviewProjectors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool select_one(obs_scene_t * /* scene */, obs_sceneitem_t *item,
|
static bool select_one(obs_scene_t * /* scene */, obs_sceneitem_t *item,
|
||||||
@ -4505,8 +4498,7 @@ void OBSBasic::RemoveSelectedScene()
|
|||||||
|
|
||||||
RemoveSceneAndReleaseNested(source);
|
RemoveSceneAndReleaseNested(source);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::ReorderSources(OBSScene scene)
|
void OBSBasic::ReorderSources(OBSScene scene)
|
||||||
@ -5131,8 +5123,7 @@ void OBSBasic::ClearSceneData()
|
|||||||
obs_enum_scenes(cb, nullptr);
|
obs_enum_scenes(cb, nullptr);
|
||||||
obs_enum_sources(cb, nullptr);
|
obs_enum_sources(cb, nullptr);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP);
|
|
||||||
|
|
||||||
undo_s.clear();
|
undo_s.clear();
|
||||||
|
|
||||||
@ -5304,8 +5295,7 @@ void OBSBasic::closeEvent(QCloseEvent *event)
|
|||||||
ClearExtraBrowserDocks();
|
ClearExtraBrowserDocks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN);
|
|
||||||
|
|
||||||
disableSaving++;
|
disableSaving++;
|
||||||
|
|
||||||
@ -5313,8 +5303,7 @@ void OBSBasic::closeEvent(QCloseEvent *event)
|
|||||||
* sources, etc) so that all references are released before shutdown */
|
* sources, etc) so that all references are released before shutdown */
|
||||||
ClearSceneData();
|
ClearSceneData();
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_EXIT);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_EXIT);
|
|
||||||
|
|
||||||
// Destroys the frontend API so plugins can't continue calling it
|
// Destroys the frontend API so plugins can't continue calling it
|
||||||
obs_frontend_set_callbacks_internal(nullptr);
|
obs_frontend_set_callbacks_internal(nullptr);
|
||||||
@ -5554,8 +5543,7 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
|
|||||||
if (vcamEnabled && vcamConfig.type == VCamOutputType::PreviewOutput)
|
if (vcamEnabled && vcamConfig.type == VCamOutputType::PreviewOutput)
|
||||||
outputHandler->UpdateVirtualCamOutputSource();
|
outputHandler->UpdateVirtualCamOutputSource();
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
|
||||||
|
|
||||||
UpdateContextBar();
|
UpdateContextBar();
|
||||||
}
|
}
|
||||||
@ -6898,8 +6886,7 @@ void OBSBasic::SceneNameEdited(QWidget *editor)
|
|||||||
|
|
||||||
ui->scenesDock->addAction(renameScene);
|
ui->scenesDock->addAction(renameScene);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::OpenFilters(OBSSource source)
|
void OBSBasic::OpenFilters(OBSSource source)
|
||||||
@ -7132,8 +7119,7 @@ void OBSBasic::StartStreaming()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STREAMING_STARTING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STARTING);
|
|
||||||
|
|
||||||
SaveProject();
|
SaveProject();
|
||||||
|
|
||||||
@ -7490,8 +7476,7 @@ void OBSBasic::StreamDelayStopping(int sec)
|
|||||||
|
|
||||||
ui->statusbar->StreamDelayStopping(sec);
|
ui->statusbar->StreamDelayStopping(sec);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STREAMING_STOPPING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STOPPING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::StreamingStart()
|
void OBSBasic::StreamingStart()
|
||||||
@ -7522,8 +7507,7 @@ void OBSBasic::StreamingStart()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STREAMING_STARTED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STARTED);
|
|
||||||
|
|
||||||
OnActivate();
|
OnActivate();
|
||||||
|
|
||||||
@ -7543,8 +7527,7 @@ void OBSBasic::StreamStopping()
|
|||||||
sysTrayStream->setText(QTStr("Basic.Main.StoppingStreaming"));
|
sysTrayStream->setText(QTStr("Basic.Main.StoppingStreaming"));
|
||||||
|
|
||||||
streamingStopping = true;
|
streamingStopping = true;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STREAMING_STOPPING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STOPPING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::StreamingStop(int code, QString last_error)
|
void OBSBasic::StreamingStop(int code, QString last_error)
|
||||||
@ -7605,8 +7588,7 @@ void OBSBasic::StreamingStop(int code, QString last_error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
streamingStopping = false;
|
streamingStopping = false;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_STREAMING_STOPPED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STOPPED);
|
|
||||||
|
|
||||||
OnDeactivate();
|
OnDeactivate();
|
||||||
|
|
||||||
@ -7738,8 +7720,7 @@ void OBSBasic::StartRecording()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_STARTING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STARTING);
|
|
||||||
|
|
||||||
SaveProject();
|
SaveProject();
|
||||||
|
|
||||||
@ -7754,8 +7735,7 @@ void OBSBasic::RecordStopping()
|
|||||||
sysTrayRecord->setText(QTStr("Basic.Main.StoppingRecording"));
|
sysTrayRecord->setText(QTStr("Basic.Main.StoppingRecording"));
|
||||||
|
|
||||||
recordingStopping = true;
|
recordingStopping = true;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_STOPPING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STOPPING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::StopRecording()
|
void OBSBasic::StopRecording()
|
||||||
@ -7777,8 +7757,7 @@ void OBSBasic::RecordingStart()
|
|||||||
sysTrayRecord->setText(QTStr("Basic.Main.StopRecording"));
|
sysTrayRecord->setText(QTStr("Basic.Main.StopRecording"));
|
||||||
|
|
||||||
recordingStopping = false;
|
recordingStopping = false;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_STARTED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STARTED);
|
|
||||||
|
|
||||||
if (!diskFullTimer->isActive())
|
if (!diskFullTimer->isActive())
|
||||||
diskFullTimer->start(1000);
|
diskFullTimer->start(1000);
|
||||||
@ -7852,8 +7831,7 @@ void OBSBasic::RecordingStop(int code, QString last_error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_STOPPED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STOPPED);
|
|
||||||
|
|
||||||
if (diskFullTimer->isActive())
|
if (diskFullTimer->isActive())
|
||||||
diskFullTimer->stop();
|
diskFullTimer->stop();
|
||||||
@ -7924,8 +7902,7 @@ void OBSBasic::StartReplayBuffer()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTING);
|
|
||||||
|
|
||||||
SaveProject();
|
SaveProject();
|
||||||
|
|
||||||
@ -7947,8 +7924,7 @@ void OBSBasic::ReplayBufferStopping()
|
|||||||
QTStr("Basic.Main.StoppingReplayBuffer"));
|
QTStr("Basic.Main.StoppingReplayBuffer"));
|
||||||
|
|
||||||
replayBufferStopping = true;
|
replayBufferStopping = true;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPING);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::StopReplayBuffer()
|
void OBSBasic::StopReplayBuffer()
|
||||||
@ -7976,8 +7952,7 @@ void OBSBasic::ReplayBufferStart()
|
|||||||
QTStr("Basic.Main.StopReplayBuffer"));
|
QTStr("Basic.Main.StopReplayBuffer"));
|
||||||
|
|
||||||
replayBufferStopping = false;
|
replayBufferStopping = false;
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED);
|
|
||||||
|
|
||||||
OnActivate();
|
OnActivate();
|
||||||
|
|
||||||
@ -8016,8 +7991,7 @@ void OBSBasic::ReplayBufferSaved()
|
|||||||
lastReplay = path;
|
lastReplay = path;
|
||||||
calldata_free(&cd);
|
calldata_free(&cd);
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED);
|
|
||||||
|
|
||||||
AutoRemux(QT_UTF8(path.c_str()));
|
AutoRemux(QT_UTF8(path.c_str()));
|
||||||
}
|
}
|
||||||
@ -8061,8 +8035,7 @@ void OBSBasic::ReplayBufferStop(int code)
|
|||||||
QSystemTrayIcon::Warning);
|
QSystemTrayIcon::Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPED);
|
|
||||||
|
|
||||||
OnDeactivate();
|
OnDeactivate();
|
||||||
}
|
}
|
||||||
@ -8104,8 +8077,7 @@ void OBSBasic::OnVirtualCamStart()
|
|||||||
if (sysTrayVirtualCam)
|
if (sysTrayVirtualCam)
|
||||||
sysTrayVirtualCam->setText(QTStr("Basic.Main.StopVirtualCam"));
|
sysTrayVirtualCam->setText(QTStr("Basic.Main.StopVirtualCam"));
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_VIRTUALCAM_STARTED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_VIRTUALCAM_STARTED);
|
|
||||||
|
|
||||||
OnActivate();
|
OnActivate();
|
||||||
|
|
||||||
@ -8122,8 +8094,7 @@ void OBSBasic::OnVirtualCamStop(int)
|
|||||||
if (sysTrayVirtualCam)
|
if (sysTrayVirtualCam)
|
||||||
sysTrayVirtualCam->setText(QTStr("Basic.Main.StartVirtualCam"));
|
sysTrayVirtualCam->setText(QTStr("Basic.Main.StartVirtualCam"));
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_VIRTUALCAM_STOPPED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_VIRTUALCAM_STOPPED);
|
|
||||||
|
|
||||||
blog(LOG_INFO, VIRTUAL_CAM_STOP);
|
blog(LOG_INFO, VIRTUAL_CAM_STOP);
|
||||||
|
|
||||||
@ -10751,8 +10722,7 @@ void OBSBasic::PauseRecording()
|
|||||||
trayIconFile));
|
trayIconFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_PAUSED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_PAUSED);
|
|
||||||
|
|
||||||
if (os_atomic_load_bool(&replaybuf_active))
|
if (os_atomic_load_bool(&replaybuf_active))
|
||||||
ShowReplayBufferPauseWarning();
|
ShowReplayBufferPauseWarning();
|
||||||
@ -10789,8 +10759,7 @@ void OBSBasic::UnpauseRecording()
|
|||||||
trayIconFile));
|
trayIconFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api)
|
OnEvent(OBS_FRONTEND_EVENT_RECORDING_UNPAUSED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_UNPAUSED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11114,3 +11083,9 @@ float OBSBasic::GetDevicePixelRatio()
|
|||||||
{
|
{
|
||||||
return dpi;
|
return dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OBSBasic::OnEvent(enum obs_frontend_event event)
|
||||||
|
{
|
||||||
|
if (api)
|
||||||
|
api->on_event(event);
|
||||||
|
}
|
||||||
|
@ -359,6 +359,8 @@ private:
|
|||||||
std::atomic<obs_scene_t *> currentScene = nullptr;
|
std::atomic<obs_scene_t *> currentScene = nullptr;
|
||||||
std::optional<std::pair<uint32_t, uint32_t>> lastOutputResolution;
|
std::optional<std::pair<uint32_t, uint32_t>> lastOutputResolution;
|
||||||
|
|
||||||
|
void OnEvent(enum obs_frontend_event event);
|
||||||
|
|
||||||
void UpdateMultiviewProjectorMenu();
|
void UpdateMultiviewProjectorMenu();
|
||||||
|
|
||||||
void DrawBackdrop(float cx, float cy);
|
void DrawBackdrop(float cx, float cy);
|
||||||
|
Loading…
Reference in New Issue
Block a user