1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +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:
Matthew Costa 2022-07-05 23:18:21 +01:00 committed by Andrew Kaster
parent ec44691b56
commit 8af5b49cba
5 changed files with 182 additions and 43 deletions

41
Ladybird/Tab.h Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "WebView.h"
#include <QBoxLayout>
#include <QLineEdit>
#include <QToolBar>
#include <QWidget>
class Tab final : public QWidget {
Q_OBJECT
public:
explicit Tab(QMainWindow* window);
WebView& view() { return *m_view; }
public slots:
void location_edit_return_pressed();
void page_title_changed(QString);
void page_favicon_changed(QIcon);
void reload();
signals:
void title_changed(int id, QString);
void favicon_changed(int id, QIcon);
private:
QBoxLayout* m_layout;
QToolBar* m_toolbar { nullptr };
QLineEdit* m_location_edit { nullptr };
WebView* m_view { nullptr };
QMainWindow* m_window { nullptr };
int tab_index();
};