UI: Add the ability to create custom browser docks

Allows the ability for users to add custom browser widget docks that
they can use for their third party services if they feel the need,
mostly as a convenience tool so they don't have to open extra browsers
alongside the program.
This commit is contained in:
jp9000
2019-08-08 03:27:45 -07:00
parent d5d8492bb3
commit 0759652cee
7 changed files with 817 additions and 0 deletions

View File

@@ -1689,6 +1689,23 @@ void OBSBasic::OBSInit()
OBSBasicStats *statsDlg = new OBSBasicStats(statsDock, false);
statsDock->setWidget(statsDlg);
/* ----------------------------- */
/* add custom browser docks */
#ifdef BROWSER_AVAILABLE
if (cef) {
QAction *action = new QAction(QTStr("Basic.MainMenu."
"View.Docks."
"CustomBrowserDocks"));
ui->viewMenuDocks->insertAction(ui->toggleScenes, action);
connect(action, &QAction::triggered, this,
&OBSBasic::ManageExtraBrowserDocks);
ui->viewMenuDocks->insertSeparator(ui->toggleScenes);
LoadExtraBrowserDocks();
}
#endif
const char *dockStateStr = config_get_string(
App()->GlobalConfig(), "BasicWindow", "DockState");
if (!dockStateStr) {
@@ -3794,9 +3811,16 @@ void OBSBasic::closeEvent(QCloseEvent *event)
SaveProjectNow();
auth.reset();
delete extraBrowsers;
config_set_string(App()->GlobalConfig(), "BasicWindow", "DockState",
saveState().toBase64().constData());
#ifdef BROWSER_AVAILABLE
SaveExtraBrowserDocks();
ClearExtraBrowserDocks();
#endif
if (api)
api->on_event(OBS_FRONTEND_EVENT_EXIT);