2022-07-06 01:18:21 +03:00
|
|
|
/*
|
2022-07-19 13:23:11 +03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2022-07-06 01:18:21 +03:00
|
|
|
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-07-06 16:38:50 +03:00
|
|
|
#define AK_DONT_REPLACE_STD
|
|
|
|
|
|
|
|
#include "History.h"
|
2022-09-25 13:02:05 +03:00
|
|
|
#include "SimpleWebView.h"
|
2022-07-06 01:18:21 +03:00
|
|
|
#include <QBoxLayout>
|
2022-09-09 15:23:36 +03:00
|
|
|
#include <QLabel>
|
2022-07-06 01:18:21 +03:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2022-09-21 22:17:13 +03:00
|
|
|
class BrowserWindow;
|
|
|
|
|
2022-07-06 01:18:21 +03:00
|
|
|
class Tab final : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-09-21 22:17:13 +03:00
|
|
|
explicit Tab(BrowserWindow* window);
|
2022-07-06 01:18:21 +03:00
|
|
|
|
2022-09-25 13:02:05 +03:00
|
|
|
SimpleWebView& view() { return *m_view; }
|
2022-07-06 01:18:21 +03:00
|
|
|
|
2022-07-14 18:32:51 +03:00
|
|
|
void navigate(QString);
|
2022-07-06 16:38:50 +03:00
|
|
|
|
2022-07-08 15:14:40 +03:00
|
|
|
void debug_request(String const& request, String const& argument);
|
|
|
|
|
2022-07-06 01:18:21 +03:00
|
|
|
public slots:
|
2022-09-12 10:12:04 +03:00
|
|
|
void focus_location_editor();
|
2022-07-06 01:18:21 +03:00
|
|
|
void location_edit_return_pressed();
|
|
|
|
void page_title_changed(QString);
|
|
|
|
void page_favicon_changed(QIcon);
|
2022-07-06 16:38:50 +03:00
|
|
|
void back();
|
|
|
|
void forward();
|
|
|
|
void home();
|
2022-07-06 01:18:21 +03:00
|
|
|
void reload();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void title_changed(int id, QString);
|
|
|
|
void favicon_changed(int id, QIcon);
|
|
|
|
|
|
|
|
private:
|
2022-09-09 15:23:36 +03:00
|
|
|
virtual void resizeEvent(QResizeEvent*) override;
|
|
|
|
|
|
|
|
void update_hover_label();
|
|
|
|
|
2022-07-06 01:18:21 +03:00
|
|
|
QBoxLayout* m_layout;
|
|
|
|
QToolBar* m_toolbar { nullptr };
|
|
|
|
QLineEdit* m_location_edit { nullptr };
|
2022-09-25 13:02:05 +03:00
|
|
|
SimpleWebView* m_view { nullptr };
|
2022-09-21 22:17:13 +03:00
|
|
|
BrowserWindow* m_window { nullptr };
|
2022-07-06 16:38:50 +03:00
|
|
|
Browser::History m_history;
|
|
|
|
QString m_title;
|
2022-09-09 15:23:36 +03:00
|
|
|
QLabel* m_hover_label { nullptr };
|
2022-07-06 16:38:50 +03:00
|
|
|
|
|
|
|
OwnPtr<QAction> m_back_action;
|
|
|
|
OwnPtr<QAction> m_forward_action;
|
|
|
|
OwnPtr<QAction> m_home_action;
|
|
|
|
OwnPtr<QAction> m_reload_action;
|
2022-07-06 01:18:21 +03:00
|
|
|
|
|
|
|
int tab_index();
|
|
|
|
};
|