]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Add a default zoom action. https://redmine.stoutner.com/issues/1044
[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 <KXmlGuiWindow>
30
31 // Qt toolkit headers.
32 #include <QComboBox>
33 #include <QLabel>
34 #include <QProgressBar>
35
36 class BrowserWindow : public KXmlGuiWindow
37 {
38     // Include the Q_OBJECT macro.
39     Q_OBJECT
40
41 public:
42     // The default constructor.
43     BrowserWindow(bool firstWindow=true);
44
45     // The public functions.
46     QSize sizeHint() const override;
47
48     // The public variables.
49     TabWidget *tabWidgetPointer;
50
51 private Q_SLOTS:
52     // The private slots.
53     void addOrEditDomainSettings() const;
54     void back() const;
55     void clearUrlLineEditFocus() const;
56     void decrementZoom();
57     void escape() const;
58     void findNext() const;
59     void findPrevious() const;
60     void forward() const;
61     void fullScreenRequested(const bool toggleOn);
62     void getZoomFactorFromUser();
63     void hideFindTextActions() const;
64     void home() const;
65     void incrementZoom();
66     void loadUrlFromLineEdit(const QString &url) const;
67     void newWindow() const;
68     void refresh() const;
69     void reloadAndBypassCache() const;
70     void showCookiesDialog();
71     void showDownloadLocationBrowseDialog() const;
72     void showDomainSettingsDialog() const;
73     void showFindTextActions() const;
74     void showProgressBar(const int &progress) const;
75     void showSettingsDialog();
76     void toggleDomStorage() const;
77     void toggleFindCaseSensitive() const;
78     void toggleJavaScript() const;
79     void toggleLocalStorage() const;
80     void toggleFullScreen();
81     void toggleViewSource() const;
82     void toggleViewSourceInNewTab() const;
83     void updateCookiesAction(const int numberOfCookies) const;
84     void updateDefaultZoomFactor(const double newDefaultZoomFactor);
85     void updateDomStorageAction(const bool &isEnabled) const;
86     void updateDomainSettingsIndicator(const bool status);
87     void updateFindText(const QString &text, const bool findCaseSensitive) const;
88     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
89     void updateJavaScriptAction(const bool &isEnabled);
90     void updateLocalStorageAction(const bool &isEnabled);
91     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
92     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
93     void updateZoomActions(const double &zoomFactor);
94     void updateSearchEngineLabel(const QString &searchEngineString) const;
95     void updateUrlLineEdit(const QUrl &newUrl);
96     void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
97     void updateWindowTitle(const QString &title);
98     void zoomDefault();
99
100 private:
101     // The private variables.
102     KConfigDialog *configDialogPointer;
103     QAction *cookiesActionPointer;
104     QUrl currentUrl;
105     QPushButton *currentZoomButtonPointer;
106     double currentZoomFactor;
107     bool customSearchEngineEnabled;
108     bool customUserAgentEnabled;
109     double defaultZoomFactor;
110     QAction *domStorageActionPointer;
111     QComboBox *downloadLocationComboBoxPointer;
112     QAction *findCaseSensitiveActionPointer;
113     QAction *findNextActionPointer;
114     QAction *findPreviousActionPointer;
115     QAction *findTextLabelActionPointer;
116     QLabel *findTextLabelPointer;
117     QAction *findTextLineEditActionPointer;
118     KLineEdit *findTextLineEditPointer;
119     KToggleFullScreenAction *fullScreenActionPointer;
120     QAction *hideFindTextActionPointer;
121     QAction *javaScriptActionPointer;
122     bool javaScriptEnabled;
123     QAction *localStorageActionPointer;
124     bool localStorageEnabled;
125     KToolBar *navigationToolBarPointer;
126     QPalette negativeBackgroundPalette;
127     QPalette normalBackgroundPalette;
128     QPalette positiveBackgroundPalette;
129     QProgressBar *progressBarPointer;
130     QLabel *searchEngineLabelPointer;
131     QAction *searchEngineMenuActionPointer;
132     QAction *searchEngineMojeekActionPointer;
133     QAction *searchEngineMonoclesActionPointer;
134     QAction *searchEngineMetagerActionPointer;
135     QAction *searchEngineGoogleActionPointer;
136     QAction *searchEngineBingActionPointer;
137     QAction *searchEngineYahooActionPointer;
138     QAction *searchEngineCustomActionPointer;
139     QLabel *userAgentLabelPointer;
140     QAction *userAgentMenuActionPointer;
141     QAction *userAgentPrivacyBrowserActionPointer;
142     QAction *userAgentWebEngineDefaultActionPointer;
143     QAction *userAgentFirefoxLinuxActionPointer;
144     QAction *userAgentChromiumLinuxActionPointer;
145     QAction *userAgentFirefoxWindowsActionPointer;
146     QAction *userAgentChromeWindowsActionPointer;
147     QAction *userAgentEdgeWindowsActionPointer;
148     QAction *userAgentSafariMacosActionPointer;
149     QAction *userAgentCustomActionPointer;
150     KLineEdit *urlLineEditPointer;
151     KToolBar *urlToolBarPointer;
152     QAction *viewSourceActionPointer;
153     QAction *viewSourceInNewTabActionPointer;
154     QAction *zoomDefaultActionPointer;
155     QAction *zoomFactorActionPointer;
156     QAction *zoomInActionPointer;
157     QPushButton *zoomMinusButtonPointer;
158     QAction *zoomOutActionPointer;
159     QPushButton *zoomPlusButtonPointer;
160 };
161 #endif