mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-15 12:09:33 -04:00
frontend: Use OBSBasic::Get() in all places
This reduces duplicated code when getting the OBSBasic context.
This commit is contained in:
@@ -56,7 +56,7 @@ bool OBSBasicSourceSelect::EnumGroups(void *data, obs_source_t *source)
|
||||
const char *id = obs_source_get_unversioned_id(source);
|
||||
|
||||
if (strcmp(id, window->id) == 0) {
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
|
||||
obs_sceneitem_t *existing = obs_scene_get_group(scene, name);
|
||||
@@ -152,7 +152,7 @@ char *get_new_source_name(const char *name, const char *format)
|
||||
static void AddExisting(OBSSource source, bool visible, bool duplicate, obs_transform_info *transform,
|
||||
obs_sceneitem_crop *crop, obs_blending_method *blend_method, obs_blending_type *blend_mode)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
if (!scene)
|
||||
return;
|
||||
@@ -193,7 +193,7 @@ static void AddExisting(const char *name, bool visible, bool duplicate, obs_tran
|
||||
bool AddNew(QWidget *parent, const char *id, const char *name, const bool visible, OBSSource &newSource,
|
||||
OBSSceneItem &newSceneItem)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
bool success = false;
|
||||
if (!scene)
|
||||
@@ -245,7 +245,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
QString source_name = item->text();
|
||||
AddExisting(QT_TO_UTF8(source_name), visible, false, nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
const char *scene_name = obs_source_get_name(main->GetCurrentSceneSource());
|
||||
|
||||
auto undo = [scene_name, main](const std::string &) {
|
||||
@@ -377,7 +377,7 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_, un
|
||||
});
|
||||
|
||||
if (strcmp(id_, "scene") == 0) {
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
OBSSource curSceneSource = main->GetCurrentSceneSource();
|
||||
|
||||
ui->selectExisting->setChecked(true);
|
||||
|
||||
Reference in New Issue
Block a user