frontend: Use OBSBasic::Get() in all places

This reduces duplicated code when getting the OBSBasic context.
This commit is contained in:
cg2121
2025-02-05 15:15:52 -05:00
committed by Ryan Foster
parent a562b8bf52
commit 4e8b131509
25 changed files with 75 additions and 78 deletions
+3 -3
View File
@@ -1216,7 +1216,7 @@ bool OBSApp::notify(QObject *receiver, QEvent *e)
if (windowType == Qt::WindowType::Dialog || windowType == Qt::WindowType::Window ||
windowType == Qt::WindowType::Tool) {
OBSBasic *main = reinterpret_cast<OBSBasic *>(GetMainWindow());
OBSBasic *main = OBSBasic::Get();
if (main)
main->SetDisplayAffinity(window);
}
@@ -1355,7 +1355,7 @@ string GetFormatExt(const char *container)
string GetOutputFilename(const char *path, const char *container, bool noSpace, bool overwrite, const char *format)
{
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
OBSBasic *main = OBSBasic::Get();
os_dir_t *dir = path && path[0] ? os_opendir(path) : nullptr;
@@ -1558,7 +1558,7 @@ void OBSApp::ProcessSigInt(void)
char tmp;
recv(sigintFd[1], &tmp, sizeof(tmp), 0);
OBSBasic *main = reinterpret_cast<OBSBasic *>(GetMainWindow());
OBSBasic *main = OBSBasic::Get();
if (main)
main->close();
#endif