]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Add bookmarks. https://redmine.stoutner.com/issues/968
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.h
1 /*
2  * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
5  *
6  * Privacy Browser PC is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Privacy Browser PC is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef BROWSERWINDOW_H
21 #define BROWSERWINDOW_H
22
23 // Application headers.
24 #include "widgets/TabWidget.h"
25
26 // KDE Frameworks headers.
27 #include <KConfigDialog>
28 #include <KToggleFullScreenAction>
29 #include <KToolBar>
30 #include <KXmlGuiWindow>
31
32 // Qt toolkit headers.
33 #include <QComboBox>
34 #include <QLabel>
35 #include <QProgressBar>
36
37 class BrowserWindow : public KXmlGuiWindow
38 {
39     // Include the Q_OBJECT macro.
40     Q_OBJECT
41
42 public:
43     // The default constructor.
44     BrowserWindow(bool firstWindow=true, QString *initialUrlStringPointer = nullptr);
45
46     // The public functions.
47     QSize sizeHint() const override;
48
49     // The public variables.
50     TabWidget *tabWidgetPointer;
51
52 private Q_SLOTS:
53     // The private slots.
54     void addOrEditDomainSettings() const;
55     void back() const;
56     void clearUrlLineEditFocus() const;
57     void decrementZoom();
58     void editBookmarks() const;
59     void escape() const;
60     void findNext() const;
61     void findPrevious() const;
62     void forward() const;
63     void fullScreenRequested(const bool toggleOn);
64     void getZoomFactorFromUser();
65     void hideFindTextActions() const;
66     void home() const;
67     void incrementZoom();
68     void loadUrlFromLineEdit(const QString &url) const;
69     void newWindow() const;
70     void populateBookmarks();
71     void refresh() const;
72     void reloadAndBypassCache() const;
73     void showBookmarkContextMenu(const QPoint &point);
74     void showCookiesDialog();
75     void showDownloadLocationBrowseDialog() const;
76     void showDomainSettingsDialog() const;
77     void showFindTextActions() const;
78     void showProgressBar(const int &progress) const;
79     void showSettingsDialog();
80     void toggleBookmark();
81     void toggleDomStorage() const;
82     void toggleFindCaseSensitive() const;
83     void toggleJavaScript() const;
84     void toggleLocalStorage() const;
85     void toggleFullScreen();
86     void toggleViewBookmarksToolBar();
87     void toggleViewSource() const;
88     void toggleViewSourceInNewTab() const;
89     void updateCookiesAction(const int numberOfCookies) const;
90     void updateDefaultZoomFactor(const double newDefaultZoomFactor);
91     void updateDomStorageAction(const bool &isEnabled) const;
92     void updateDomainSettingsIndicator(const bool status);
93     void updateFindText(const QString &text, const bool findCaseSensitive) const;
94     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
95     void updateJavaScriptAction(const bool &isEnabled);
96     void updateLocalStorageAction(const bool &isEnabled);
97     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
98     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
99     void updateZoomActions(const double &zoomFactor);
100     void updateSearchEngineLabel(const QString &searchEngineString) const;
101     void updateUrlLineEdit(const QUrl &newUrl);
102     void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
103     void updateViewBookmarksToolBarCheckbox(const bool visible);
104     void updateWindowTitle(const QString &title);
105     void zoomDefault();
106
107 private:
108     // The private variables.
109     KActionCollection *actionCollectionPointer;
110     QAction *bookmarkedActionPointer;
111     QList<QPair<QMenu *, QAction *> *> bookmarksMenuActionList;
112     QMenu *bookmarksMenuPointer;
113     QList<QPair<QMenu *, QMenu *> *> bookmarksMenuSubmenuList;
114     QList<QAction*> bookmarksToolBarActionList;
115     QList<QPair<QMenu *, const double> *> bookmarksToolBarMenuList;
116     KToolBar *bookmarksToolBarPointer;
117     QList<QPair<QMenu *, QAction *> *> bookmarksToolBarSubfolderActionList;
118     bool bookmarksToolBarIsVisible = false;
119     bool bookmarksToolBarUninitialized = true;
120     KConfigDialog *configDialogPointer;
121     QAction *cookiesActionPointer;
122     QUrl currentUrl;
123     QPushButton *currentZoomButtonPointer;
124     double currentZoomFactor;
125     bool customSearchEngineEnabled;
126     bool customUserAgentEnabled;
127     double defaultZoomFactor;
128     QAction *domStorageActionPointer;
129     QComboBox *downloadLocationComboBoxPointer;
130     QList<QPair<QMenu *, QAction *> *> finalBookmarkFolderMenuActionList;
131     QAction *findCaseSensitiveActionPointer;
132     QAction *findNextActionPointer;
133     QAction *findPreviousActionPointer;
134     QAction *findTextLabelActionPointer;
135     QLabel *findTextLabelPointer;
136     QAction *findTextLineEditActionPointer;
137     KLineEdit *findTextLineEditPointer;
138     KToggleFullScreenAction *fullScreenActionPointer;
139     QAction *hideFindTextActionPointer;
140     QAction *javaScriptActionPointer;
141     bool javaScriptEnabled;
142     QAction *localStorageActionPointer;
143     bool localStorageEnabled;
144     KToolBar *navigationToolBarPointer;
145     QPalette negativeBackgroundPalette;
146     QPalette normalBackgroundPalette;
147     QPalette positiveBackgroundPalette;
148     QProgressBar *progressBarPointer;
149     QLabel *searchEngineLabelPointer;
150     QAction *searchEngineMenuActionPointer;
151     QAction *searchEngineMojeekActionPointer;
152     QAction *searchEngineMonoclesActionPointer;
153     QAction *searchEngineMetagerActionPointer;
154     QAction *searchEngineGoogleActionPointer;
155     QAction *searchEngineBingActionPointer;
156     QAction *searchEngineYahooActionPointer;
157     QAction *searchEngineCustomActionPointer;
158     QLabel *userAgentLabelPointer;
159     QAction *userAgentMenuActionPointer;
160     QAction *userAgentPrivacyBrowserActionPointer;
161     QAction *userAgentWebEngineDefaultActionPointer;
162     QAction *userAgentFirefoxLinuxActionPointer;
163     QAction *userAgentChromiumLinuxActionPointer;
164     QAction *userAgentFirefoxWindowsActionPointer;
165     QAction *userAgentChromeWindowsActionPointer;
166     QAction *userAgentEdgeWindowsActionPointer;
167     QAction *userAgentSafariMacosActionPointer;
168     QAction *userAgentCustomActionPointer;
169     KLineEdit *urlLineEditPointer;
170     KToolBar *urlToolBarPointer;
171     QAction *viewBookmarksToolBarActionPointer;
172     QAction *viewSourceActionPointer;
173     QAction *viewSourceInNewTabActionPointer;
174     QAction *zoomDefaultActionPointer;
175     QAction *zoomFactorActionPointer;
176     QAction *zoomInActionPointer;
177     QPushButton *zoomMinusButtonPointer;
178     QAction *zoomOutActionPointer;
179     QPushButton *zoomPlusButtonPointer;
180
181     // The private functions.
182     void addFinalBookmarkFolderMenuActions(QMenu *menuPointer, double folderId);
183     void populateBookmarksMenuSubfolders(const double folderId, QMenu *menuPointer);
184     void populateBookmarksToolBar();
185     void populateBookmarksToolBarSubfolders(const double folderId, QMenu *menuPointer);
186     void updateBookmarkedAction() const;
187 };
188 #endif