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.
master
jp9000 2022-07-28 14:51:21 -07:00
parent 23c3ad4d02
commit 2b3c90d2cc
2 changed files with 27 additions and 1 deletions

View File

@ -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."

View File

@ -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<char *> 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()