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