2 * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
4 * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
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.
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.
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/>.
20 #ifndef BROWSERWINDOW_H
21 #define BROWSERWINDOW_H
23 // Application headers.
24 #include "widgets/TabWidget.h"
26 // KDE Frameworks headers.
27 #include <KConfigDialog>
28 #include <KToggleFullScreenAction>
29 #include <KXmlGuiWindow>
31 // Qt toolkit headers.
34 #include <QProgressBar>
36 class BrowserWindow : public KXmlGuiWindow
38 // Include the Q_OBJECT macro.
42 // The default constructor.
43 BrowserWindow(bool firstWindow=true);
45 // The public functions.
46 QSize sizeHint() const override;
48 // The public variables.
49 TabWidget *tabWidgetPointer;
53 void addOrEditDomainSettings() const;
55 void clearUrlLineEditFocus() const;
58 void findNext() const;
59 void findPrevious() const;
61 void fullScreenRequested(const bool toggleOn);
62 void getZoomFactorFromUser();
63 void hideFindTextActions() const;
66 void loadUrlFromLineEdit(const QString &url) const;
67 void newWindow() 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 updateDomStorageAction(const bool &isEnabled) const;
85 void updateDomainSettingsIndicator(const bool status);
86 void updateFindText(const QString &text, const bool findCaseSensitive) const;
87 void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
88 void updateJavaScriptAction(const bool &isEnabled);
89 void updateLocalStorageAction(const bool &isEnabled);
90 void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
91 void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
92 void updateZoomFactorAction(const double &zoomFactor);
93 void updateSearchEngineLabel(const QString &searchEngineString) const;
94 void updateUrlLineEdit(const QUrl &newUrl);
95 void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
96 void updateWindowTitle(const QString &title);
99 // The private variables.
100 KConfigDialog *configDialogPointer;
101 QAction *cookiesActionPointer;
103 QPushButton *currentZoomButtonPointer;
104 double currentZoomFactor;
105 bool customSearchEngineEnabled;
106 bool customUserAgentEnabled;
107 QAction *domStorageActionPointer;
108 QComboBox *downloadLocationComboBoxPointer;
109 QAction *findCaseSensitiveActionPointer;
110 QAction *findNextActionPointer;
111 QAction *findPreviousActionPointer;
112 QAction *findTextLabelActionPointer;
113 QLabel *findTextLabelPointer;
114 QAction *findTextLineEditActionPointer;
115 KLineEdit *findTextLineEditPointer;
116 KToggleFullScreenAction *fullScreenActionPointer;
117 QAction *hideFindTextActionPointer;
118 QAction *javaScriptActionPointer;
119 bool javaScriptEnabled;
120 QAction *localStorageActionPointer;
121 bool localStorageEnabled;
122 KToolBar *navigationToolBarPointer;
123 QPalette negativeBackgroundPalette;
124 QPalette normalBackgroundPalette;
125 QPalette positiveBackgroundPalette;
126 QProgressBar *progressBarPointer;
127 QLabel *searchEngineLabelPointer;
128 QAction *searchEngineMenuActionPointer;
129 QAction *searchEngineMojeekActionPointer;
130 QAction *searchEngineMonoclesActionPointer;
131 QAction *searchEngineMetagerActionPointer;
132 QAction *searchEngineGoogleActionPointer;
133 QAction *searchEngineBingActionPointer;
134 QAction *searchEngineYahooActionPointer;
135 QAction *searchEngineCustomActionPointer;
136 QLabel *userAgentLabelPointer;
137 QAction *userAgentMenuActionPointer;
138 QAction *userAgentPrivacyBrowserActionPointer;
139 QAction *userAgentWebEngineDefaultActionPointer;
140 QAction *userAgentFirefoxLinuxActionPointer;
141 QAction *userAgentChromiumLinuxActionPointer;
142 QAction *userAgentFirefoxWindowsActionPointer;
143 QAction *userAgentChromeWindowsActionPointer;
144 QAction *userAgentEdgeWindowsActionPointer;
145 QAction *userAgentSafariMacosActionPointer;
146 QAction *userAgentCustomActionPointer;
147 KLineEdit *urlLineEditPointer;
148 KToolBar *urlToolBarPointer;
149 QAction *viewSourceActionPointer;
150 QAction *viewSourceInNewTabActionPointer;
151 QAction *zoomFactorActionPointer;