]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Add view page source controls. https://redmine.stoutner.com/issues/1022
[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 escape() const;
57     void findNext() const;
58     void findPrevious() const;
59     void forward() const;
60     void fullScreenRequested(const bool toggleOn);
61     void getZoomFactorFromUser();
62     void hideFindTextActions() const;
63     void home() const;
64     void loadUrlFromLineEdit(const QString &url) const;
65     void newWindow() const;
66     void refresh() const;
67     void reloadAndBypassCache() const;
68     void showCookiesDialog();
69     void showDownloadLocationBrowseDialog() const;
70     void showDomainSettingsDialog() const;
71     void showFindTextActions() const;
72     void showProgressBar(const int &progress) const;
73     void showSettingsDialog();
74     void toggleDomStorage() const;
75     void toggleFindCaseSensitive() const;
76     void toggleJavaScript() const;
77     void toggleLocalStorage() const;
78     void toggleFullScreen();
79     void toggleViewSource() const;
80     void toggleViewSourceInNewTab() const;
81     void updateCookiesAction(const int numberOfCookies) const;
82     void updateDomStorageAction(const bool &isEnabled) const;
83     void updateDomainSettingsIndicator(const bool status);
84     void updateFindText(const QString &text, const bool findCaseSensitive) const;
85     void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
86     void updateJavaScriptAction(const bool &isEnabled);
87     void updateLocalStorageAction(const bool &isEnabled);
88     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
89     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
90     void updateZoomFactorAction(const double &zoomFactor);
91     void updateSearchEngineLabel(const QString &searchEngineString) const;
92     void updateUrlLineEdit(const QUrl &newUrl);
93     void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
94     void updateWindowTitle(const QString &title);
95
96 private:
97     // The private variables.
98     KConfigDialog *configDialogPointer;
99     QAction *cookiesActionPointer;
100     QUrl currentUrl;
101     double currentZoomFactor;
102     bool customSearchEngineEnabled;
103     bool customUserAgentEnabled;
104     QAction *domStorageActionPointer;
105     QComboBox *downloadLocationComboBoxPointer;
106     QAction *findCaseSensitiveActionPointer;
107     QAction *findNextActionPointer;
108     QAction *findPreviousActionPointer;
109     QAction *findTextLabelActionPointer;
110     QLabel *findTextLabelPointer;
111     QAction *findTextLineEditActionPointer;
112     KLineEdit *findTextLineEditPointer;
113     KToggleFullScreenAction *fullScreenActionPointer;
114     QAction *hideFindTextActionPointer;
115     QAction *javaScriptActionPointer;
116     bool javaScriptEnabled;
117     QAction *localStorageActionPointer;
118     bool localStorageEnabled;
119     KToolBar *navigationToolBarPointer;
120     QPalette negativeBackgroundPalette;
121     QPalette normalBackgroundPalette;
122     QPalette positiveBackgroundPalette;
123     QProgressBar *progressBarPointer;
124     QLabel *searchEngineLabelPointer;
125     QAction *searchEngineMenuActionPointer;
126     QAction *searchEngineMojeekActionPointer;
127     QAction *searchEngineMonoclesActionPointer;
128     QAction *searchEngineMetagerActionPointer;
129     QAction *searchEngineGoogleActionPointer;
130     QAction *searchEngineBingActionPointer;
131     QAction *searchEngineYahooActionPointer;
132     QAction *searchEngineCustomActionPointer;
133     QLabel *userAgentLabelPointer;
134     QAction *userAgentMenuActionPointer;
135     QAction *userAgentPrivacyBrowserActionPointer;
136     QAction *userAgentWebEngineDefaultActionPointer;
137     QAction *userAgentFirefoxLinuxActionPointer;
138     QAction *userAgentChromiumLinuxActionPointer;
139     QAction *userAgentFirefoxWindowsActionPointer;
140     QAction *userAgentChromeWindowsActionPointer;
141     QAction *userAgentEdgeWindowsActionPointer;
142     QAction *userAgentSafariMacosActionPointer;
143     QAction *userAgentCustomActionPointer;
144     KLineEdit *urlLineEditPointer;
145     KToolBar *urlToolBarPointer;
146     QAction *viewSourceActionPointer;
147     QAction *zoomFactorActionPointer;
148 };
149 #endif