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
|
|
|
|
|
2022-10-05 13:23:41 +00:00
|
|
|
#include "WebContentView.h"
|
2022-10-22 21:42:00 +00:00
|
|
|
#include <Browser/History.h>
|
2022-07-05 22:18:21 +00:00
|
|
|
#include <QBoxLayout>
|
2022-09-09 12:23:36 +00:00
|
|
|
#include <QLabel>
|
2022-07-05 22:18:21 +00:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2022-09-21 19:17:13 +00:00
|
|
|
class BrowserWindow;
|
|
|
|
|
2022-07-05 22:18:21 +00:00
|
|
|
class Tab final : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-11-14 16:08:44 +00:00
|
|
|
Tab(BrowserWindow* window, int webdriver_fd_passing_socket);
|
2022-07-05 22:18:21 +00:00
|
|
|
|
2022-10-05 13:23:41 +00:00
|
|
|
WebContentView& view() { return *m_view; }
|
2022-07-05 22:18:21 +00:00
|
|
|
|
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:
|
2022-09-12 07:12:04 +00:00
|
|
|
void focus_location_editor();
|
2022-07-05 22:18:21 +00:00
|
|
|
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:
|
2022-09-09 12:23:36 +00:00
|
|
|
virtual void resizeEvent(QResizeEvent*) override;
|
|
|
|
|
|
|
|
void update_hover_label();
|
|
|
|
|
2022-07-05 22:18:21 +00:00
|
|
|
QBoxLayout* m_layout;
|
|
|
|
QToolBar* m_toolbar { nullptr };
|
|
|
|
QLineEdit* m_location_edit { nullptr };
|
2022-10-05 13:23:41 +00:00
|
|
|
WebContentView* m_view { nullptr };
|
2022-09-21 19:17:13 +00:00
|
|
|
BrowserWindow* m_window { nullptr };
|
2022-07-06 13:38:50 +00:00
|
|
|
Browser::History m_history;
|
|
|
|
QString m_title;
|
2022-09-09 12:23:36 +00:00
|
|
|
QLabel* m_hover_label { nullptr };
|
2022-07-06 13:38:50 +00:00
|
|
|
|
|
|
|
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();
|
2022-11-08 12:01:20 +00:00
|
|
|
|
|
|
|
bool m_is_history_navigation { false };
|
2022-07-05 22:18:21 +00:00
|
|
|
};
|