]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Partial bookmark implementation. 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);
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 addBookmark() const;
55     void addOrEditDomainSettings() const;
56     void back() const;
57     void clearUrlLineEditFocus() const;
58     void decrementZoom();
59     void editBookmarks() const;
60     void escape() const;
61     void findNext() const;
62     void findPrevious() const;
63     void forward() const;
64     void fullScreenRequested(const bool toggleOn);
65     void getZoomFactorFromUser();
66     void hideFindTextActions() const;
67     void home() const;
68     void incrementZoom();
69     void loadUrlFromLineEdit(const QString &url) const;
70     void newWindow() const;
71     void populateBookmarks();
72     void refresh() const;
73     void reloadAndBypassCache() const;
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 toggleDomStorage() const;
81     void toggleFindCaseSensitive() const;
82     void toggleJavaScript() const;
83     void toggleLocalStorage() const;
84     void toggleFullScreen();
85     void toggleViewBookmarksToolBar();
86     void toggleViewSource() const;
87     void toggleViewSourceInNewTab() const;
88     void updateCookiesAction(const int numberOfCookies) const;
89     void updateDefaultZoomFactor(const double newDefaultZoomFactor);
90     void updateDomStorageAction(const bool &isEnabled) const;
91     void updateDomainSettingsIndicator(const bool status);
92     void updateFindText(const QString &text, const bool findCaseSensitive) const;
93     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
94     void updateJavaScriptAction(const bool &isEnabled);
95     void updateLocalStorageAction(const bool &isEnabled);
96     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
97     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
98     void updateZoomActions(const double &zoomFactor);
99     void updateSearchEngineLabel(const QString &searchEngineString) const;
100     void updateUrlLineEdit(const QUrl &newUrl);
101     void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
102     void updateViewBookmarksToolBarCheckbox(const bool visible);
103     void updateWindowTitle(const QString &title);
104     void zoomDefault();
105
106 private:
107     // The private variables.
108     QList<QAction*> bookmarksMenuCurrentActionList;
109     QMenu *bookmarksMenuPointer;
110     QList<QAction*> bookmarksToolBarCurrentActionList;
111     KToolBar *bookmarksToolBarPointer;
112     bool bookmarksToolBarIsVisible = false;
113     bool bookmarksToolBarUninitialized = true;
114     KConfigDialog *configDialogPointer;
115     QAction *cookiesActionPointer;
116     QUrl currentUrl;
117     QPushButton *currentZoomButtonPointer;
118     double currentZoomFactor;
119     bool customSearchEngineEnabled;
120     bool customUserAgentEnabled;
121     double defaultZoomFactor;
122     QAction *domStorageActionPointer;
123     QComboBox *downloadLocationComboBoxPointer;
124     QAction *findCaseSensitiveActionPointer;
125     QAction *findNextActionPointer;
126     QAction *findPreviousActionPointer;
127     QAction *findTextLabelActionPointer;
128     QLabel *findTextLabelPointer;
129     QAction *findTextLineEditActionPointer;
130     KLineEdit *findTextLineEditPointer;
131     KToggleFullScreenAction *fullScreenActionPointer;
132     QAction *hideFindTextActionPointer;
133     QAction *javaScriptActionPointer;
134     bool javaScriptEnabled;
135     QAction *localStorageActionPointer;
136     bool localStorageEnabled;
137     KToolBar *navigationToolBarPointer;
138     QPalette negativeBackgroundPalette;
139     QPalette normalBackgroundPalette;
140     QPalette positiveBackgroundPalette;
141     QProgressBar *progressBarPointer;
142     QLabel *searchEngineLabelPointer;
143     QAction *searchEngineMenuActionPointer;
144     QAction *searchEngineMojeekActionPointer;
145     QAction *searchEngineMonoclesActionPointer;
146     QAction *searchEngineMetagerActionPointer;
147     QAction *searchEngineGoogleActionPointer;
148     QAction *searchEngineBingActionPointer;
149     QAction *searchEngineYahooActionPointer;
150     QAction *searchEngineCustomActionPointer;
151     QLabel *userAgentLabelPointer;
152     QAction *userAgentMenuActionPointer;
153     QAction *userAgentPrivacyBrowserActionPointer;
154     QAction *userAgentWebEngineDefaultActionPointer;
155     QAction *userAgentFirefoxLinuxActionPointer;
156     QAction *userAgentChromiumLinuxActionPointer;
157     QAction *userAgentFirefoxWindowsActionPointer;
158     QAction *userAgentChromeWindowsActionPointer;
159     QAction *userAgentEdgeWindowsActionPointer;
160     QAction *userAgentSafariMacosActionPointer;
161     QAction *userAgentCustomActionPointer;
162     KLineEdit *urlLineEditPointer;
163     KToolBar *urlToolBarPointer;
164     QAction *viewBookmarksToolBarActionPointer;
165     QAction *viewSourceActionPointer;
166     QAction *viewSourceInNewTabActionPointer;
167     QAction *zoomDefaultActionPointer;
168     QAction *zoomFactorActionPointer;
169     QAction *zoomInActionPointer;
170     QPushButton *zoomMinusButtonPointer;
171     QAction *zoomOutActionPointer;
172     QPushButton *zoomPlusButtonPointer;
173 };
174 #endif