2022-07-05 23:18:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2023-01-12 14:39:53 +00:00
|
|
|
* Copyright (c) 2023, Linus Groh <linusg@serenityos.org>
|
2022-07-05 23:18:21 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-12-05 13:09:42 -05:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-05 23:18:21 +01:00
|
|
|
#include "Tab.h"
|
2022-07-06 14:36:49 +01:00
|
|
|
#include <AK/NonnullOwnPtrVector.h>
|
2022-07-05 18:42:45 +01:00
|
|
|
#include <LibCore/Forward.h>
|
2022-07-05 05:53:11 +01:00
|
|
|
#include <QIcon>
|
2022-07-03 21:26:51 +02:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QMainWindow>
|
2022-07-05 23:18:21 +01:00
|
|
|
#include <QMenuBar>
|
|
|
|
#include <QTabWidget>
|
2022-07-03 21:26:51 +02:00
|
|
|
#include <QToolBar>
|
|
|
|
|
2022-10-05 15:23:41 +02:00
|
|
|
class WebContentView;
|
2022-07-03 21:26:51 +02:00
|
|
|
|
2022-12-05 13:09:42 -05:00
|
|
|
namespace Browser {
|
|
|
|
class CookieJar;
|
|
|
|
}
|
|
|
|
|
2022-07-03 21:26:51 +02:00
|
|
|
class BrowserWindow : public QMainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-12-15 09:18:52 -05:00
|
|
|
explicit BrowserWindow(Browser::CookieJar&, StringView webdriver_content_ipc_path);
|
2022-07-03 21:26:51 +02:00
|
|
|
|
2022-10-05 15:23:41 +02:00
|
|
|
WebContentView& view() const { return m_current_tab->view(); }
|
2022-07-03 21:26:51 +02:00
|
|
|
|
2022-07-05 23:18:21 +01:00
|
|
|
int tab_index(Tab*);
|
2022-07-05 18:42:45 +01:00
|
|
|
|
2023-01-08 11:21:55 +01:00
|
|
|
enum class Activate {
|
|
|
|
Yes,
|
|
|
|
No,
|
|
|
|
};
|
|
|
|
|
2022-07-05 21:10:50 +02:00
|
|
|
public slots:
|
2022-07-05 23:18:21 +01:00
|
|
|
void tab_title_changed(int index, QString const&);
|
|
|
|
void tab_favicon_changed(int index, QIcon icon);
|
2023-01-08 11:21:55 +01:00
|
|
|
void new_tab(QString const&, Activate);
|
2022-07-06 14:36:49 +01:00
|
|
|
void close_tab(int index);
|
2022-07-19 06:16:46 -04:00
|
|
|
void close_current_tab();
|
2022-09-12 09:22:43 +02:00
|
|
|
void open_next_tab();
|
|
|
|
void open_previous_tab();
|
2022-09-19 10:48:02 +02:00
|
|
|
void enable_auto_color_scheme();
|
|
|
|
void enable_light_color_scheme();
|
|
|
|
void enable_dark_color_scheme();
|
2023-01-12 14:39:53 +00:00
|
|
|
void zoom_in();
|
|
|
|
void zoom_out();
|
|
|
|
void reset_zoom();
|
2023-01-11 20:09:52 +01:00
|
|
|
void select_all();
|
|
|
|
void copy_selected_text();
|
2022-07-05 21:10:50 +02:00
|
|
|
|
2022-07-03 21:26:51 +02:00
|
|
|
private:
|
2022-12-04 18:43:54 +00:00
|
|
|
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
|
2022-07-08 14:14:40 +02:00
|
|
|
|
2022-07-05 23:18:21 +01:00
|
|
|
QTabWidget* m_tabs_container { nullptr };
|
2022-07-06 14:36:49 +01:00
|
|
|
NonnullOwnPtrVector<Tab> m_tabs;
|
2022-07-05 23:18:21 +01:00
|
|
|
Tab* m_current_tab { nullptr };
|
2022-10-11 10:53:28 +02:00
|
|
|
|
2022-12-05 13:09:42 -05:00
|
|
|
Browser::CookieJar& m_cookie_jar;
|
2022-11-14 11:08:44 -05:00
|
|
|
|
2022-12-15 09:18:52 -05:00
|
|
|
StringView m_webdriver_content_ipc_path;
|
2022-07-03 21:26:51 +02:00
|
|
|
};
|