From 2b3c90d2ccd888523ebe7a5de8587eed55fd61b5 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 28 Jul 2022 14:51:21 -0700 Subject: [PATCH] UI: Show warning on plugin load failure Allows the user to know what plugins failed to load. This is particularly useful if we're going to block Qt5 plugins as well, or if certain plugins can't load because they're incompatible with a newer version. --- UI/data/locale/en-US.ini | 4 ++++ UI/window-basic-main.cpp | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini index ce923d5c6159d..90f6de35569ad 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -113,6 +113,10 @@ MoveSourceDown="Move Source(s) Down" SourceProperties="Open Source Properties" SourceFilters="Open Source Filters" +# warning for plugin load failures +PluginsFailedToLoad.Title="Plugin Load Error" +PluginsFailedToLoad.Text="The following OBS plugins failed to load:\n\n%1\nPlease update or remove these plugins." + # warning if program already open AlreadyRunning.Title="OBS is already running" AlreadyRunning.Text="OBS is already running! Unless you meant to do this, please shut down any existing instances of OBS before trying to run a new instance. If you have OBS set to minimize to the system tray, please check to see if it's still running there." diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index e66ca53e71426..fb36a36d2e1e2 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -1778,15 +1778,18 @@ void OBSBasic::OBSInit() LoadLibraryW(L"Qt6Network"); #endif #endif + struct obs_module_failure_info mfi; AddExtraModulePaths(); blog(LOG_INFO, "---------------------------------"); - obs_load_all_modules(); + obs_load_all_modules2(&mfi); blog(LOG_INFO, "---------------------------------"); obs_log_loaded_modules(); blog(LOG_INFO, "---------------------------------"); obs_post_load_modules(); + BPtr failed_modules = mfi.failed_modules; + #ifdef BROWSER_AVAILABLE cef = obs_browser_init_panel(); #endif @@ -2071,6 +2074,25 @@ void OBSBasic::OBSInit() OnFirstLoad(); activateWindow(); + + /* ------------------------------------------- */ + /* display warning message for failed modules */ + + if (mfi.count) { + QString failed_plugins; + + char **plugin = mfi.failed_modules; + while (*plugin) { + failed_plugins += *plugin; + failed_plugins += "\n"; + plugin++; + } + + QString failed_msg = + QTStr("PluginsFailedToLoad.Text").arg(failed_plugins); + OBSMessageBox::warning(this, QTStr("PluginsFailedToLoad.Title"), + failed_msg); + } } void OBSBasic::OnFirstLoad()