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/>.
23 // KDE Framework headers.
26 // Qt framework headers.
27 #include <QPushButton>
28 #include <QWebEngineHistory>
29 #include <QWebEngineSettings>
30 #include <QWebEngineView>
32 class BrowserView : public QWidget
34 // Include the Q_OBJECT macro.
38 // The primary contructor.
39 explicit BrowserView(QWidget *parent);
41 // The public functions.
42 void applyOnTheFlyZoomFactor(const double &zoomFactor);
43 void loadInitialWebsite();
44 void toggleJavaScript() const;
45 void toggleLocalStorage() const;
47 // The public static variables.
48 static QString webEngineDefaultUserAgent;
52 void clearUrlLineEditFocus() const;
53 void hideProgressBar() const;
54 void linkHovered(const QString &linkUrl) const;
55 void showProgressBar(const int &progress) const;
56 void updateBackAction(const bool &isEnabled) const;
57 void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain) const;
58 void updateForwardAction(const bool &isEnabled) const;
59 void updateJavaScriptAction(const bool &isEnabled) const;
60 void updateLocalStorageAction(const bool &isEnabled) const;
61 void updateSearchEngineActions(const QString &searchEngine) const;
62 void updateUrlLineEdit(const QUrl &newUrl) const;
63 void updateUserAgentActions(const QString &userAgent) const;
64 void updateZoomFactorAction(const double &zoomFactor) const;
68 void applyApplicationSettings();
69 void applyDomainSettingsAndReload();
70 void applyDomainSettingsWithoutReloading(const QString &hostname);
71 void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
72 void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
76 void loadUrlFromLineEdit(QString url) const;
77 void mouseBack() const;
78 void mouseForward() const;
83 void loadFinished() const;
84 void loadProgress(const int &progress) const;
85 void loadStarted() const;
86 void pageLinkHovered(const QString &linkUrl) const;
87 void updateUrl(const QUrl &url) const;
90 // The private variables.
91 double currentZoomFactor; // This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
92 QString searchEngineUrl;
93 QWebEngineHistory *webEngineHistoryPointer;
94 QWebEngineProfile *webEngineProfilePointer;
95 QWebEngineSettings *webEngineSettingsPointer;
96 QWebEngineView *webEngineViewPointer;
98 // The private functions.
99 void applyDomainSettings(const QString &hostname, const bool reloadWebsite);