mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Refactor integration and browser docks
Use the QAction provided by QDockWidget with new Qt connection rather than creating a new one for each dock. Separate extra browser docks from extra docks, the latter is meant for plugin/integration docks.
This commit is contained in:
+19
-5
@@ -42,6 +42,8 @@ using namespace json11;
|
||||
#define YOUTUBE_CHAT_POPOUT_URL \
|
||||
"https://www.youtube.com/live_chat?is_popout=1&dark_theme=1&v=%1"
|
||||
|
||||
#define YOUTUBE_CHAT_DOCK_NAME "ytChat"
|
||||
|
||||
static const char allowedChars[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
static const int allowedCount = static_cast<int>(sizeof(allowedChars) - 1);
|
||||
@@ -71,6 +73,19 @@ YoutubeAuth::YoutubeAuth(const Def &d)
|
||||
{
|
||||
}
|
||||
|
||||
YoutubeAuth::~YoutubeAuth()
|
||||
{
|
||||
if (!uiLoaded)
|
||||
return;
|
||||
|
||||
#ifdef BROWSER_AVAILABLE
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
|
||||
main->RemoveDockWidget(YOUTUBE_CHAT_DOCK_NAME);
|
||||
chat = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool YoutubeAuth::RetryLogin()
|
||||
{
|
||||
return true;
|
||||
@@ -139,20 +154,19 @@ void YoutubeAuth::LoadUI()
|
||||
QSize size = main->frameSize();
|
||||
QPoint pos = main->pos();
|
||||
|
||||
chat.reset(new YoutubeChatDock());
|
||||
chat->setObjectName("ytChat");
|
||||
chat = new YoutubeChatDock();
|
||||
chat->setObjectName(YOUTUBE_CHAT_DOCK_NAME);
|
||||
chat->resize(300, 600);
|
||||
chat->setMinimumSize(200, 300);
|
||||
chat->setWindowTitle(QTStr("Auth.Chat"));
|
||||
chat->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||
|
||||
browser = cef->create_widget(chat.data(), YOUTUBE_CHAT_PLACEHOLDER_URL,
|
||||
browser = cef->create_widget(chat, YOUTUBE_CHAT_PLACEHOLDER_URL,
|
||||
panel_cookies);
|
||||
browser->setStartupScript(ytchat_script);
|
||||
|
||||
chat->SetWidget(browser);
|
||||
main->addDockWidget(Qt::RightDockWidgetArea, chat.data());
|
||||
chatMenu.reset(main->AddDockWidget(chat.data()));
|
||||
main->AddDockWidget(chat, Qt::RightDockWidgetArea);
|
||||
|
||||
chat->setFloating(true);
|
||||
chat->move(pos.x() + size.width() - chat->width() - 50, pos.y() + 50);
|
||||
|
||||
Reference in New Issue
Block a user