mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
Ladybird: Rudimentary tabbed browsing support
This patch removes the browser WebView from the window and places it inside a Tab object, all wrapped up in a QT tab control. So far you can create tabs, but can't close them.
This commit is contained in:
parent
ec44691b56
commit
8af5b49cba
5 changed files with 182 additions and 43 deletions
|
@ -1,7 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "Tab.h"
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <QIcon>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QTabWidget>
|
||||
#include <QToolBar>
|
||||
|
||||
#pragma once
|
||||
|
@ -13,21 +23,21 @@ class BrowserWindow : public QMainWindow {
|
|||
public:
|
||||
explicit BrowserWindow(Core::EventLoop&);
|
||||
|
||||
WebView& view() { return *m_view; }
|
||||
WebView& view() const { return m_current_tab->view(); }
|
||||
|
||||
int tab_index(Tab*);
|
||||
|
||||
virtual void closeEvent(QCloseEvent*) override;
|
||||
|
||||
public slots:
|
||||
void location_edit_return_pressed();
|
||||
void page_title_changed(QString);
|
||||
void page_favicon_changed(QIcon);
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
void tab_title_changed(int index, QString const&);
|
||||
void tab_favicon_changed(int index, QIcon icon);
|
||||
void new_tab();
|
||||
|
||||
private:
|
||||
QToolBar* m_toolbar { nullptr };
|
||||
QLineEdit* m_location_edit { nullptr };
|
||||
WebView* m_view { nullptr };
|
||||
QTabWidget* m_tabs_container { nullptr };
|
||||
Vector<NonnullOwnPtr<Tab>> m_tabs;
|
||||
Tab* m_current_tab { nullptr };
|
||||
|
||||
Core::EventLoop& m_event_loop;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue