2022-07-05 22:18:21 +00:00
|
|
|
/*
|
2022-07-19 10:23:11 +00:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2022-07-05 22:18:21 +00:00
|
|
|
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-07-06 13:38:50 +00:00
|
|
|
#define AK_DONT_REPLACE_STD
|
|
|
|
|
|
|
|
#include "History.h"
|
2022-07-05 22:18:21 +00:00
|
|
|
#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; }
|
|
|
|
|
2022-07-14 15:32:51 +00:00
|
|
|
void navigate(QString);
|
2022-07-06 13:38:50 +00:00
|
|
|
|
2022-07-08 12:14:40 +00:00
|
|
|
void debug_request(String const& request, String const& argument);
|
|
|
|
|
2022-07-05 22:18:21 +00:00
|
|
|
public slots:
|
|
|
|
void location_edit_return_pressed();
|
|
|
|
void page_title_changed(QString);
|
|
|
|
void page_favicon_changed(QIcon);
|
2022-07-06 13:38:50 +00:00
|
|
|
void back();
|
|
|
|
void forward();
|
|
|
|
void home();
|
2022-07-05 22:18:21 +00:00
|
|
|
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 };
|
2022-07-06 13:38:50 +00:00
|
|
|
Browser::History m_history;
|
|
|
|
QString m_title;
|
|
|
|
|
|
|
|
OwnPtr<QAction> m_back_action;
|
|
|
|
OwnPtr<QAction> m_forward_action;
|
|
|
|
OwnPtr<QAction> m_home_action;
|
|
|
|
OwnPtr<QAction> m_reload_action;
|
2022-07-05 22:18:21 +00:00
|
|
|
|
|
|
|
int tab_index();
|
|
|
|
};
|