]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Add context menus to the bookmarks toolbar.
[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 showAddBookmarkDialog() const;
74     void showBookmarkContextMenu(const QPoint &point);
75     void showCookiesDialog();
76     void showDownloadLocationBrowseDialog() const;
77     void showDomainSettingsDialog() const;
78     void showFindTextActions() const;
79     void showProgressBar(const int &progress) const;
80     void showSettingsDialog();
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     QList<QAction*> bookmarksMenuCurrentActionList;
110     QMenu *bookmarksMenuPointer;
111     QList<QAction*> bookmarksToolBarCurrentActionList;
112     KToolBar *bookmarksToolBarPointer;
113     bool bookmarksToolBarIsVisible = false;
114     bool bookmarksToolBarUninitialized = true;
115     KConfigDialog *configDialogPointer;
116     QAction *cookiesActionPointer;
117     QUrl currentUrl;
118     QPushButton *currentZoomButtonPointer;
119     double currentZoomFactor;
120     bool customSearchEngineEnabled;
121     bool customUserAgentEnabled;
122     double defaultZoomFactor;
123     QAction *domStorageActionPointer;
124     QComboBox *downloadLocationComboBoxPointer;
125     QAction *findCaseSensitiveActionPointer;
126     QAction *findNextActionPointer;
127     QAction *findPreviousActionPointer;
128     QAction *findTextLabelActionPointer;
129     QLabel *findTextLabelPointer;
130     QAction *findTextLineEditActionPointer;
131     KLineEdit *findTextLineEditPointer;
132     KToggleFullScreenAction *fullScreenActionPointer;
133     QAction *hideFindTextActionPointer;
134     QAction *javaScriptActionPointer;
135     bool javaScriptEnabled;
136     QAction *localStorageActionPointer;
137     bool localStorageEnabled;
138     KToolBar *navigationToolBarPointer;
139     QPalette negativeBackgroundPalette;
140     QPalette normalBackgroundPalette;
141     QPalette positiveBackgroundPalette;
142     QProgressBar *progressBarPointer;
143     QLabel *searchEngineLabelPointer;
144     QAction *searchEngineMenuActionPointer;
145     QAction *searchEngineMojeekActionPointer;
146     QAction *searchEngineMonoclesActionPointer;
147     QAction *searchEngineMetagerActionPointer;
148     QAction *searchEngineGoogleActionPointer;
149     QAction *searchEngineBingActionPointer;
150     QAction *searchEngineYahooActionPointer;
151     QAction *searchEngineCustomActionPointer;
152     QLabel *userAgentLabelPointer;
153     QAction *userAgentMenuActionPointer;
154     QAction *userAgentPrivacyBrowserActionPointer;
155     QAction *userAgentWebEngineDefaultActionPointer;
156     QAction *userAgentFirefoxLinuxActionPointer;
157     QAction *userAgentChromiumLinuxActionPointer;
158     QAction *userAgentFirefoxWindowsActionPointer;
159     QAction *userAgentChromeWindowsActionPointer;
160     QAction *userAgentEdgeWindowsActionPointer;
161     QAction *userAgentSafariMacosActionPointer;
162     QAction *userAgentCustomActionPointer;
163     KLineEdit *urlLineEditPointer;
164     KToolBar *urlToolBarPointer;
165     QAction *viewBookmarksToolBarActionPointer;
166     QAction *viewSourceActionPointer;
167     QAction *viewSourceInNewTabActionPointer;
168     QAction *zoomDefaultActionPointer;
169     QAction *zoomFactorActionPointer;
170     QAction *zoomInActionPointer;
171     QPushButton *zoomMinusButtonPointer;
172     QAction *zoomOutActionPointer;
173     QPushButton *zoomPlusButtonPointer;
174 };
175 #endif