Dooble
Loading...
Searching...
No Matches
dooble_page.h
1/*
2** Copyright (c) 2008 - present, Alexis Megas.
3** All rights reserved.
4**
5** Redistribution and use in source and binary forms, with or without
6** modification, are permitted provided that the following conditions
7** are met:
8** 1. Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** 2. Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** 3. The name of the author may not be used to endorse or promote products
14** derived from Dooble without specific prior written permission.
15**
16** DOOBLE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25** DOOBLE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef dooble_page_h
29#define dooble_page_h
30
31#include <QPointer>
32#include <QTimer>
33#include <QWebEnginePage>
34#include <QWebEngineSettings>
35
36#include "dooble_settings.h"
37#include "ui_dooble_page.h"
38
39class QPrinter;
40class QShortcut;
41class QWebEngineSettings;
42class QWebEngineView;
43class dooble;
48
49class dooble_page: public QWidget
50{
51 Q_OBJECT
52
53 public:
54 enum class ConstantsEnum
55 {
56 MAXIMUM_HISTORY_ITEMS = 10,
57 MAXIMUM_JAVASCRIPT_POPUPS = 100
58 };
59
60 dooble_page(QWebEngineProfile *web_engine_profile,
62 QWidget *parent);
64 QAction *action_close_tab(void) const;
65 QAction *full_screen_action(void) const;
66 QFrame *frame(void) const;
67 QIcon icon(void) const;
68 QMenu *menu(void);
69 QString title(void) const;
70 QUrl url(void) const;
71 QWebEngineProfile *web_engine_profile(void) const;
72 QWebEngineSettings *web_engine_settings(void) const;
73 bool can_go_back(void) const;
74 bool can_go_forward(void) const;
75 bool is_location_frame_hidden(void) const;
76 bool is_location_frame_user_hidden(void) const;
77 bool is_private(void) const;
78 bool is_web_setting_enabled(QWebEngineSettings::WebAttribute setting) const;
79 dooble_address_widget *address_widget(void) const;
80 dooble_popup_menu *popup_menu(void) const;
81 dooble_web_engine_view *view(void) const;
82 int reload_periodically_seconds(void) const;
83 void download(const QString &file_name, const QUrl &url);
84 void enable_web_setting
85 (QWebEngineSettings::WebAttribute setting, bool state);
86 void hide_location_frame(bool state);
87 void hide_status_bar(bool state);
88 void inject_custom_css(void);
89 void javascript_console(void);
90 void load(const QUrl &url);
91 void prepare_export_as_png(const QString &file_name);
92 void print_page(QPrinter *printer);
93#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
94 void print_page(QPrinter *printer,
95 const QWebEngineCallback<bool> &result_callback);
96#endif
97 void reload(void);
98 void reload_periodically(int seconds);
99 void save(const QString &file_name);
100 void show_menu(void);
101 void stop(void);
102 void user_hide_location_frame(bool state);
103
104 protected:
105 void resizeEvent(QResizeEvent *event);
106
107 private:
108 QLabel *m_progress_label;
109 QList<QPixmap> m_pixmaps;
110 QList<QShortcut *> m_shortcuts;
111 QMenu *m_menu;
112 QPointer<QAction> m_action_close_tab;
113 QPointer<QAction> m_authentication_action;
114 QPointer<QAction> m_clone_action;
115 QPointer<QAction> m_find_action;
116 QPointer<QAction> m_full_screen_action;
117 QPointer<QAction> m_settings_action;
118 QPointer<QProgressDialog> m_export_as_png_progress_dialog;
119 QPointer<dooble_javascript> m_javascript_console;
120 QString m_export_png_file_name;
121 QTimer m_export_png_timer;
122 QTimer m_reload_timer;
123 QVector<QPointer<dooble_web_engine_view> > m_last_javascript_popups;
124 Ui_dooble_page m_ui;
125 bool m_export_as_png;
126 bool m_is_location_frame_user_hidden;
127 bool m_is_private;
128 dooble *find_parent_dooble(void) const;
129 dooble_popup_menu *m_popup_menu;
131 int m_reload_periodically_seconds;
132 void find_text(QWebEnginePage::FindFlags find_flags, const QString &text);
133 void go_to_backward_item(int index);
134 void go_to_forward_item(int index);
135 void prepare_icons(void);
136 void prepare_progress_label_position(bool process_events = true);
137 void prepare_shortcuts(void);
138 void prepare_standard_menus(void);
139 void prepare_style_sheets(void);
140 void prepare_tool_buttons(void);
141 void prepare_zoom_toolbutton(qreal zoom_factor);
142 void reset_url(void);
143 void show_popup_menu(void);
144
145 private slots:
146 void slot_about_to_show_standard_menus(void);
147 void slot_about_to_show_view_menu(void);
148 void slot_accepted_or_blocked_add_exception(void);
149 void slot_accepted_or_blocked_clicked(void);
150 void slot_always_allow_javascript_popup(void);
151 void slot_authentication_required(const QUrl &url,
152 QAuthenticator *authenticator);
153 void slot_clear_visited_links(void);
154 void slot_close_javascript_popup_exception_frame(void);
155 void slot_create_dialog_request(dooble_web_engine_view *view);
156 void slot_current_url_executable(void);
157 void slot_dooble_credentials_authenticated(bool state);
158 void slot_dooble_credentials_created(void);
159 void slot_downloads_finished(void);
160 void slot_downloads_started(void);
161 void slot_enable_javascript(void);
162 void slot_escape(void);
163 void slot_export_as_png_timer_timeout(void);
164 void slot_favorite_changed(const QUrl &url, bool state);
165 void slot_feature_permission_allow(void);
166 void slot_feature_permission_deny(void);
167 void slot_feature_permission_request_canceled
168 (const QUrl &security_origin, QWebEnginePage::Feature feature);
169 void slot_feature_permission_requested(const QUrl &security_origin,
170 QWebEnginePage::Feature feature);
171 void slot_find_next(void);
172 void slot_find_previous(void);
173 void slot_find_text_edited(const QString &text);
174 void slot_go_backward(void);
175 void slot_go_forward(void);
176 void slot_go_home(void);
177 void slot_go_to_backward_item(void);
178 void slot_go_to_forward_item(void);
179 void slot_icon_changed(const QIcon &icon);
180 void slot_inject_custom_css(void);
181 void slot_javascript_allow_popup_exception(void);
182 void slot_javascript_console(void);
183 void slot_link_hovered(const QString &url);
184 void slot_load_finished(bool ok);
185 void slot_load_page(void);
186 void slot_load_progress(int progress);
187 void slot_load_started(void);
188 void slot_loading(const QUrl &url);
189#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
190 void slot_loading_changed(const QWebEngineLoadingInfo &info);
191#endif
192 void slot_only_now_allow_javascript_popup(void);
193 void slot_open_link(const QUrl &url);
194 void slot_open_link(void);
195 void slot_prepare_backward_menu(void);
196 void slot_prepare_forward_menu(void);
197 void slot_prepare_reload_menu(void);
198 void slot_proxy_authentication_required(const QUrl &url,
199 QAuthenticator *authenticator,
200 const QString &proxy_host);
201 void slot_reload(void);
202 void slot_reload_bypass_cache(void);
203 void slot_reload_or_stop(void);
204 void slot_reload_periodically(void);
205 void slot_render_pixmap(void);
206 void slot_scroll_position_changed(const QPointF &position);
207 void slot_scroll_to_top_finished(void);
208 void slot_settings_applied(void);
209 void slot_show_certificate_exception(void);
210 void slot_show_favorites_popup(void);
211 void slot_show_find(void);
212 void slot_show_popup(void);
213 void slot_show_popup_menu(void);
214 void slot_show_pull_down_menu(void);
215 void slot_show_status_bar(bool state);
216 void slot_show_web_settings_panel(void);
217 void slot_url_changed(const QUrl &url);
218 void slot_zoom_in(void);
219 void slot_zoom_out(void);
220 void slot_zoom_reset(void);
221 void slot_zoomed(void);
222
223 signals:
224 void authenticate(void);
225 void clear_downloads(void);
226 void clone(void);
227 void close_tab(void);
228 void close_window(void);
229 void create_dialog(dooble_web_engine_view *view);
230 void create_tab(dooble_web_engine_view *view);
231 void create_window(dooble_web_engine_view *view);
232 void dooble_credentials_authenticated(bool state);
233 void export_as_png(void);
234 void iconChanged(const QIcon &icon);
235 void javascript_allow_popup_exception(const QUrl &url);
236 void loadFinished(bool ok);
237 void loadStarted(void);
238 void new_private_window(void);
239 void new_tab(void);
240 void new_window(void);
241 void open_link_in_new_private_window(const QUrl &url);
242 void open_link_in_new_tab(const QUrl &url);
243 void open_link_in_new_window(const QUrl &url);
244 void open_local_file(void);
245 void peekaboo_text(const QString &text);
246 void print(void);
247 void print_preview(void);
248 void quit_dooble(void);
249 void save(void);
250 void show_about(void);
251 void show_accepted_or_blocked_domains(void);
252 void show_certificate_exceptions(void);
253 void show_chart_xyseries(void);
254 void show_clear_items(void);
255 void show_cookies(void);
256 void show_documentation(void);
257 void show_downloads(void);
258 void show_favorites(void);
259 void show_floating_digital_clock(void);
260 void show_floating_history_popup(void);
261 void show_floating_menu(void);
262 void show_full_screen(bool state);
263 void show_full_screen(void);
264 void show_history(void);
265 void show_release_notes(void);
266 void show_search_engines(void);
267 void show_settings(void);
268 void show_settings_panel(dooble_settings::Panels panel);
269 void show_site_cookies(void);
270 void titleChanged(const QString &title);
271 void translate_page(void);
272 void vacuum_databases(void);
273 void windowCloseRequested(void);
274 void zoomed(qreal zoom_factor);
275};
276
277#endif
Definition dooble_address_widget.h:43
Definition dooble_javascript.h:39
Definition dooble_page.h:50
Definition dooble_popup_menu.h:36
Definition dooble_web_engine_view.h:39
Definition dooble.h:76