2 * Copyright © 2022 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;
60 void focusFindLineEdit() const;
62 void fullScreenRequested(const bool toggleOn);
63 void getZoomFactorFromUser();
65 void loadUrlFromLineEdit(const QString &url) const;
67 void showCookiesDialog();
68 void showDownloadLocationBrowseDialog() const;
69 void showDomainSettingsDialog() const;
70 void showProgressBar(const int &progress) const;
71 void showSettingsDialog();
72 void toggleDomStorage() const;
73 void toggleFindCaseSensitive() const;
74 void toggleJavaScript() const;
75 void toggleLocalStorage() const;
76 void toggleFullScreen();
77 void updateCookiesAction(const int numberOfCookies) const;
78 void updateDomStorageAction(const bool &isEnabled) const;
79 void updateDomainSettingsIndicator(const bool status);
80 void updateFindText(const QString &text, const bool findCaseSensitive) const;
81 void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
82 void updateJavaScriptAction(const bool &isEnabled);
83 void updateLocalStorageAction(const bool &isEnabled);
84 void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
85 void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
86 void updateZoomFactorAction(const double &zoomFactor);
87 void updateSearchEngineLabel(const QString &searchEngineString) const;
88 void updateUrlLineEdit(const QUrl &newUrl);
89 void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
90 void updateWindowTitle(const QString &title);
93 // The private variables.
94 KConfigDialog *configDialogPointer;
95 QAction *cookiesActionPointer;
97 double currentZoomFactor;
98 bool customSearchEngineEnabled;
99 bool customUserAgentEnabled;
100 QAction *domStorageActionPointer;
101 QComboBox *downloadLocationComboBoxPointer;
102 QAction *findCaseSensitiveActionPointer;
103 QLabel *findTextLabelPointer;
104 KLineEdit *findTextLineEditPointer;
105 KToggleFullScreenAction *fullScreenActionPointer;
106 QAction *javaScriptActionPointer;
107 bool javaScriptEnabled;
108 QAction *localStorageActionPointer;
109 bool localStorageEnabled;
110 KToolBar *navigationToolBarPointer;
111 QPalette negativeBackgroundPalette;
112 QPalette normalBackgroundPalette;
113 QPalette positiveBackgroundPalette;
114 QProgressBar *progressBarPointer;
115 QLabel *searchEngineLabelPointer;
116 QAction *searchEngineMenuActionPointer;
117 QAction *searchEngineMojeekActionPointer;
118 QAction *searchEngineMonoclesActionPointer;
119 QAction *searchEngineMetagerActionPointer;
120 QAction *searchEngineGoogleActionPointer;
121 QAction *searchEngineBingActionPointer;
122 QAction *searchEngineYahooActionPointer;
123 QAction *searchEngineCustomActionPointer;
124 QLabel *userAgentLabelPointer;
125 QAction *userAgentMenuActionPointer;
126 QAction *userAgentPrivacyBrowserActionPointer;
127 QAction *userAgentWebEngineDefaultActionPointer;
128 QAction *userAgentFirefoxLinuxActionPointer;
129 QAction *userAgentChromiumLinuxActionPointer;
130 QAction *userAgentFirefoxWindowsActionPointer;
131 QAction *userAgentChromeWindowsActionPointer;
132 QAction *userAgentEdgeWindowsActionPointer;
133 QAction *userAgentSafariMacosActionPointer;
134 QAction *userAgentCustomActionPointer;
135 KLineEdit *urlLineEditPointer;
136 KToolBar *urlToolBarPointer;
137 QAction *zoomFactorActionPointer;