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 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);
101 // The private variables.
102 KConfigDialog *configDialogPointer;
103 QAction *cookiesActionPointer;
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;