UI: Add func to load browser/cookies, but show dialog

Adds a function for initializing browser and cookies in a separate
thread while, and while waiting for it to complete, show a dialog
stating that the browser is currently being loaded.  Allows the ability
to safely prevent the user from taking any action without actually
freezing up the UI thread.
This commit is contained in:
jp9000 committed 2019-02-07 14:47:15 -08:00
1 parent fe043f2b2a
commit 1b8bc55f6a
3 files changed
+31

No files matched your search

+25
View File
@@ -132,3 +132,28 @@ void DuplicateCurrentCookieProfile(ConfigFile &config)
UNUSED_PARAMETER(config);
#endif
}
void OBSBasic::InitBrowserPanelSafeBlock(bool showDialog)
{
#ifdef BROWSER_AVAILABLE
if (!cef)
return;
if (cef->init_browser()) {
InitPanelCookieManager();
return;
}
if (showDialog)
ExecuteFuncSafeBlockMsgBox(
[] {cef->wait_for_browser_init();},
QTStr("BrowserPanelInit.Title"),
QTStr("BrowserPanelInit.Text"));
else
ExecuteFuncSafeBlock(
[] {cef->wait_for_browser_init();});
InitPanelCookieManager();
#else
UNUSED_PARAMETER(showDialog);
#endif
}