Dooble
dooble.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_h
29 #define dooble_h
30 
31 #include <QFuture>
32 #include <QMainWindow>
33 #include <QShortcut>
34 #include <QPointer>
35 #include <QTimer>
36 
37 #include "dooble_settings.h"
38 #include "ui_dooble.h"
39 
40 #define DOOBLE_DATE_VERSION_STRING "2017.11.11"
41 #define DOOBLE_VERSION_STRING "2.1"
42 
43 class QWebEngineDownloadItem;
44 class QWebEngineProfile;
45 class dooble_about;
47 class dooble_application;
49 class dooble_cookies;
52 class dooble_downloads;
54 class dooble_history;
56 class dooble_page;
59 
60 class dooble: public QMainWindow
61 {
62  Q_OBJECT
63 
64  public:
65  enum Limits
66  {
67  MAXIMUM_TITLE_LENGTH = 1024,
68  MAXIMUM_URL_LENGTH = 2048
69  };
70 
71  dooble(QWidget *widget);
72  dooble(const QUrl &url, bool is_private);
73  dooble(dooble_page *page);
75  ~dooble();
76  bool is_private(void) const;
77  dooble_page *current_page(void) const;
78  dooble_page *new_page(const QUrl &url, bool is_private);
79  static QPointer<dooble_history> s_history;
80  static QPointer<dooble_about> s_about;
81  static QPointer<dooble_accepted_or_blocked_domains>
82  s_accepted_or_blocked_domains;
83  static QPointer<dooble_application> s_application;
84  static QPointer<dooble_certificate_exceptions> s_certificate_exceptions;
85  static QPointer<dooble_cookies> s_cookies;
86  static QPointer<dooble_cookies_window> s_cookies_window;
87  static QPointer<dooble_cryptography> s_cryptography;
88  static QPointer<dooble_downloads> s_downloads;
89  static QPointer<dooble_favorites_popup> s_favorites_window;
90  static QPointer<dooble_history_window> s_history_window;
91  static QPointer<dooble_settings> s_settings;
92  static QPointer<dooble_web_engine_url_request_interceptor>
93  s_url_request_interceptor;
94  void print_current_page(void);
95 
96  public slots:
97  void show(void);
98 
99  protected:
100  void closeEvent(QCloseEvent *event);
101  void keyPressEvent(QKeyEvent *event);
102 
103  private:
104  QFuture<QList<QByteArray> > m_pbkdf2_future;
105  QFutureWatcher<QList<QByteArray> > m_pbkdf2_future_watcher;
106  QList<QShortcut *> m_shortcuts;
107  QList<QShortcut *> m_tab_widget_shortcuts;
108  QMenu *m_menu;
109  QPointer<QAction> m_action_close_tab;
110  QPointer<QAction> m_authentication_action;
111  QPointer<QAction> m_full_screen_action;
112  QPointer<QAction> m_settings_action;
113  QPointer<QProgressDialog> m_pbkdf2_dialog;
114  QPointer<QWebEngineProfile> m_web_engine_profile;
115  QPointer<dooble_cookies> m_cookies;
116  QPointer<dooble_cookies_window> m_cookies_window;
117  QTimer m_populate_containers_timer;
118  Ui_dooble m_ui;
119  bool m_is_javascript_dialog;
120  bool m_is_private;
121  static QPointer<dooble> s_favorites_popup_opened_from_dooble_window;
122  static bool s_containers_populated;
123  bool can_exit(void);
124  void connect_signals(void);
125  void copy_default_profile_settings(void);
126  void decouple_support_windows(void);
127  void initialize_static_members(void);
128  void new_page(dooble_page *page);
129  void new_page(dooble_web_engine_view *view);
130  void prepare_page_connections(dooble_page *page);
131  void prepare_shortcuts(void);
132  void prepare_standard_menus(void);
133  void prepare_tab_icons(void);
134  void prepare_tab_shortcuts(void);
135  void print(dooble_page *page);
136 
137  private slots:
138  void slot_about_to_hide_main_menu(void);
139  void slot_about_to_show_main_menu(void);
140  void slot_authenticate(void);
141  void slot_clear_visited_links(void);
142  void slot_close_tab(void);
143  void slot_create_dialog(dooble_web_engine_view *view);
144  void slot_create_tab(dooble_web_engine_view *view);
145  void slot_create_window(dooble_web_engine_view *view);
146  void slot_decouple_tab(int index);
147  void slot_dooble_credentials_authenticated(bool state);
148  void slot_download_requested(QWebEngineDownloadItem *download);
149  void slot_icon_changed(const QIcon &icon);
150  void slot_new_private_window(void);
151  void slot_new_tab(void);
152  void slot_new_window(void);
153  void slot_open_favorites_link(const QUrl &url);
154  void slot_open_link_in_new_private_window(const QUrl &url);
155  void slot_open_link_in_new_tab(const QUrl &url);
156  void slot_open_link_in_new_window(const QUrl &url);
157  void slot_open_tab_as_new_window(int index);
158  void slot_open_url(const QUrl &url);
159  void slot_pbkdf2_future_finished(void);
160  void slot_populate_containers_timer_timeout(void);
161  void slot_print(void);
162  void slot_print_preview(void);
163  void slot_quit_dooble(void);
164  void slot_reload_tab(int index);
165  void slot_remove_tab_widget_shortcut(void);
166  void slot_save(void);
167  void slot_set_current_tab(void);
168  void slot_settings_applied(void);
169  void slot_show_about(void);
170  void slot_show_accepted_or_blocked_domains(void);
171  void slot_show_certificate_exceptions(void);
172  void slot_show_clear_items(void);
173  void slot_show_cookies(void);
174  void slot_show_documentation(void);
175  void slot_show_downloads(void);
176  void slot_show_favorites(void);
177  void slot_show_full_screen(void);
178  void slot_show_history(void);
179  void slot_show_main_menu(void);
180  void slot_show_settings(void);
181  void slot_show_settings_panel(dooble_settings::Panels panel);
182  void slot_tab_close_requested(int index);
183  void slot_tab_index_changed(int index);
184  void slot_tab_widget_shortcut_activated(void);
185  void slot_tabs_menu_button_clicked(void);
186  void slot_title_changed(const QString &title);
187 
188  signals:
189  void dooble_credentials_authenticated(bool state);
190 };
191 
192 #endif
Definition: dooble_cookies.h:35
Definition: dooble.h:60
Definition: dooble_favorites_popup.h:35
Definition: dooble_page.h:46
Definition: dooble_history.h:39
Definition: dooble_cryptography.h:35
Definition: dooble_web_engine_view.h:35
Definition: dooble_web_engine_url_request_interceptor.h:34
Definition: dooble_cookies_window.h:41
Definition: dooble_accepted_or_blocked_domains.h:36
Definition: dooble_application.h:35
Definition: dooble_certificate_exceptions.h:36
Definition: dooble_downloads.h:38
Definition: dooble_history_window.h:37
Definition: dooble_about.h:129