Dooble
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 <QWebEnginePage>
33 #include <QWebEngineSettings>
34 #include <QWidget>
35 
36 #include "dooble_settings.h"
37 #include "ui_dooble_page.h"
38 
39 class QPrinter;
40 class QShortcut;
41 class QWebEngineSettings;
42 class dooble;
45 
46 class dooble_page: public QWidget
47 {
48  Q_OBJECT
49 
50  public:
51  enum ConstantsEnum
52  {
53  MAXIMUM_HISTORY_ITEMS = 20
54  };
55 
56  dooble_page(QWebEngineProfile *web_engine_profile,
58  QWidget *parent);
59  ~dooble_page();
60  QAction *action_close_tab(void) const;
61  QAction *full_screen_action(void) const;
62  QIcon icon(void) const;
63  QMenu *menu(void);
64  QString title(void) const;
65  QUrl url(void) const;
66  QWebEngineSettings *web_engine_settings(void) const;
67  bool is_private(void) const;
68  dooble_address_widget *address_widget(void) const;
69  dooble_web_engine_view *view(void) const;
70  void enable_web_setting(QWebEngineSettings::WebAttribute setting,
71  bool state);
72  void load(const QUrl &url);
73  void print_page(QPrinter *printer);
74  void reload(void);
75  void save(const QString &file_name);
76  void show_menu(void);
77 
78  protected:
79  void resizeEvent(QResizeEvent *event);
80 
81  private:
82  QList<QShortcut *> m_shortcuts;
83  QMenu *m_menu;
84  QPointer<QAction> m_action_close_tab;
85  QPointer<QAction> m_authentication_action;
86  QPointer<QAction> m_find_action;
87  QPointer<QAction> m_full_screen_action;
88  QPointer<QAction> m_settings_action;
89  QVector<QPointer<dooble_web_engine_view> > m_last_javascript_popups;
90  Ui_dooble_page m_ui;
91  bool m_is_private;
92  dooble *find_parent_dooble(void) const;
93  dooble_web_engine_view *m_view;
94  void find_text(QWebEnginePage::FindFlags find_flags, const QString &text);
95  void go_to_backward_item(int index);
96  void go_to_forward_item(int index);
97  void prepare_icons(void);
98  void prepare_shortcuts(void);
99  void prepare_standard_menus(void);
100  void prepare_tool_buttons(void);
101  void show_popup_menu(void);
102 
103  private slots:
104  void slot_about_to_show_standard_menus(void);
105  void slot_accepted_or_blocked_add_exception(void);
106  void slot_accepted_or_blocked_clicked(void);
107  void slot_always_allow_javascript_popup(void);
108  void slot_authentication_required(const QUrl &url,
109  QAuthenticator *authenticator);
110  void slot_clear_visited_links(void);
111  void slot_close_javascript_popup_exception_frame(void);
112  void slot_create_dialog_request(dooble_web_engine_view *view);
113  void slot_dooble_credentials_authenticated(bool state);
114  void slot_dooble_credentials_created(void);
115  void slot_downloads_finished(void);
116  void slot_downloads_started(void);
117  void slot_escape(void);
118  void slot_favorite_changed(const QUrl &url, bool state);
119  void slot_find_next(void);
120  void slot_find_previous(void);
121  void slot_find_text_edited(const QString &text);
122  void slot_go_backward(void);
123  void slot_go_forward(void);
124  void slot_go_to_backward_item(void);
125  void slot_go_to_forward_item(void);
126  void slot_icon_changed(const QIcon &icon);
127  void slot_javascript_allow_popup_exception(void);
128  void slot_link_hovered(const QString &url);
129  void slot_load_finished(bool ok);
130  void slot_load_page(void);
131  void slot_load_progress(int progress);
132  void slot_load_started(void);
133  void slot_only_now_allow_javascript_popup(void);
134  void slot_open_url(const QUrl &url);
135  void slot_open_url(void);
136  void slot_prepare_backward_menu(void);
137  void slot_prepare_forward_menu(void);
138  void slot_print_preview(QPrinter *printer);
139  void slot_proxy_authentication_required(const QUrl &url,
140  QAuthenticator *authenticator,
141  const QString &proxy_host);
142  void slot_reload_or_stop(void);
143  void slot_reset_url(void);
144  void slot_settings_applied(void);
145  void slot_show_certificate_exception(void);
146  void slot_show_favorites_popup(void);
147  void slot_show_find(void);
148  void slot_show_popup(void);
149  void slot_show_popup_menu(void);
150  void slot_show_pull_down_menu(void);
151  void slot_show_status_bar(bool state);
152  void slot_show_web_settings_panel(void);
153  void slot_url_changed(const QUrl &url);
154  void slot_zoom_in(void);
155  void slot_zoom_out(void);
156  void slot_zoom_reset(void);
157 
158  signals:
159  void authenticate(void);
160  void close_tab(void);
161  void create_dialog(dooble_web_engine_view *view);
162  void create_tab(dooble_web_engine_view *view);
163  void create_window(dooble_web_engine_view *view);
164  void dooble_credentials_authenticated(bool state);
165  void downloadRequested(QWebEngineDownloadItem *download);
166  void iconChanged(const QIcon &icon);
167  void javascript_allow_popup_exception(const QUrl &url);
168  void loadFinished(bool ok);
169  void loadStarted(void);
170  void new_private_window(void);
171  void new_tab(void);
172  void new_window(void);
173  void open_link_in_new_private_window(const QUrl &url);
174  void open_link_in_new_tab(const QUrl &url);
175  void open_link_in_new_window(const QUrl &url);
176  void print(void);
177  void print_preview(void);
178  void quit_dooble(void);
179  void save(void);
180  void show_about(void);
181  void show_accepted_or_blocked_domains(void);
182  void show_certificate_exceptions(void);
183  void show_clear_items(void);
184  void show_cookies(void);
185  void show_documentation(void);
186  void show_downloads(void);
187  void show_favorites(void);
188  void show_full_screen(void);
189  void show_history(void);
190  void show_settings(void);
191  void show_settings_panel(dooble_settings::Panels panel);
192  void titleChanged(const QString &title);
193  void zoomed(qreal zoom_factor);
194 };
195 
196 #endif
Definition: dooble.h:60
Definition: dooble_page.h:46
Definition: dooble_address_widget.h:38
Definition: dooble_web_engine_view.h:35