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
|
|
|
|
|
2023-01-18 17:12:13 +03:00
|
|
|
#include "LocationEdit.h"
|
2022-10-05 16:23:41 +03:00
|
|
|
#include "WebContentView.h"
|
2022-10-23 00:42:00 +03:00
|
|
|
#include <Browser/History.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>
|
2023-03-29 02:25:42 +03:00
|
|
|
#include <QToolButton>
|
2022-07-06 01:18:21 +03:00
|
|
|
#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:
|
2023-04-15 03:04:28 +03:00
|
|
|
Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling);
|
2022-07-06 01:18:21 +03:00
|
|
|
|
2022-10-05 16:23:41 +03:00
|
|
|
WebContentView& view() { return *m_view; }
|
2022-07-06 01:18:21 +03:00
|
|
|
|
2023-01-08 17:01:26 +03:00
|
|
|
enum class LoadType {
|
|
|
|
Normal,
|
|
|
|
HistoryNavigation,
|
|
|
|
};
|
|
|
|
void navigate(QString, LoadType = LoadType::Normal);
|
2022-07-06 16:38:50 +03:00
|
|
|
|
2022-12-04 21:43:54 +03:00
|
|
|
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
|
2022-07-08 15:14:40 +03:00
|
|
|
|
2023-03-29 02:25:42 +03:00
|
|
|
void update_reset_zoom_button();
|
|
|
|
|
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();
|
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;
|
2023-05-05 16:38:46 +03:00
|
|
|
virtual bool event(QEvent*) override;
|
2022-09-09 15:23:36 +03:00
|
|
|
|
2023-05-05 16:38:46 +03:00
|
|
|
void rerender_toolbar_icons();
|
2022-09-09 15:23:36 +03:00
|
|
|
void update_hover_label();
|
|
|
|
|
2023-05-15 19:27:10 +03:00
|
|
|
void open_link(URL const&);
|
|
|
|
void open_link_in_new_tab(URL const&);
|
|
|
|
void copy_link_url(URL const&);
|
|
|
|
|
2022-07-06 01:18:21 +03:00
|
|
|
QBoxLayout* m_layout;
|
|
|
|
QToolBar* m_toolbar { nullptr };
|
2023-03-29 02:25:42 +03:00
|
|
|
QToolButton* m_reset_zoom_button { nullptr };
|
|
|
|
QAction* m_reset_zoom_button_action { nullptr };
|
2023-01-18 17:12:13 +03:00
|
|
|
LocationEdit* m_location_edit { nullptr };
|
2022-10-05 16:23:41 +03:00
|
|
|
WebContentView* 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
|
|
|
|
2023-05-15 18:49:44 +03:00
|
|
|
OwnPtr<QMenu> m_page_context_menu;
|
|
|
|
|
2023-05-15 19:27:10 +03:00
|
|
|
OwnPtr<QMenu> m_video_context_menu;
|
|
|
|
OwnPtr<QIcon> m_video_context_menu_play_icon;
|
|
|
|
OwnPtr<QIcon> m_video_context_menu_pause_icon;
|
|
|
|
OwnPtr<QAction> m_video_context_menu_play_pause_action;
|
|
|
|
OwnPtr<QAction> m_video_context_menu_controls_action;
|
|
|
|
OwnPtr<QAction> m_video_context_menu_loop_action;
|
|
|
|
URL m_video_context_menu_url;
|
|
|
|
|
2022-07-06 01:18:21 +03:00
|
|
|
int tab_index();
|
2022-11-08 15:01:20 +03:00
|
|
|
|
|
|
|
bool m_is_history_navigation { false };
|
2022-07-06 01:18:21 +03:00
|
|
|
};
|