mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Ladybird: Support multiple browser windows in Qt chrome
This also moves the ownership of the TaskManger to the Application.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "Application.h"
|
||||
#include "StringUtils.h"
|
||||
#include "TaskManagerWindow.h"
|
||||
#include <LibWebView/URL.h>
|
||||
#include <QFileOpenEvent>
|
||||
|
||||
@@ -16,6 +17,11 @@ Application::Application(int& argc, char** argv)
|
||||
{
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
close_task_manager_window();
|
||||
}
|
||||
|
||||
bool Application::event(QEvent* event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
@@ -37,4 +43,33 @@ bool Application::event(QEvent* event)
|
||||
return QApplication::event(event);
|
||||
}
|
||||
|
||||
void Application::show_task_manager_window()
|
||||
{
|
||||
if (!m_task_manager_window) {
|
||||
m_task_manager_window = new TaskManagerWindow(nullptr);
|
||||
}
|
||||
m_task_manager_window->show();
|
||||
m_task_manager_window->activateWindow();
|
||||
m_task_manager_window->raise();
|
||||
}
|
||||
|
||||
void Application::close_task_manager_window()
|
||||
{
|
||||
if (m_task_manager_window) {
|
||||
m_task_manager_window->close();
|
||||
delete m_task_manager_window;
|
||||
m_task_manager_window = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
BrowserWindow& Application::new_window(Vector<URL::URL> const& initial_urls, WebView::CookieJar& cookie_jar, WebContentOptions const& web_content_options, StringView webdriver_content_ipc_path)
|
||||
{
|
||||
auto* window = new BrowserWindow(initial_urls, cookie_jar, web_content_options, webdriver_content_ipc_path);
|
||||
set_active_window(*window);
|
||||
window->show();
|
||||
window->activateWindow();
|
||||
window->raise();
|
||||
return *window;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user