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;
49 void hideProgressBar() const;
50 void linkHovered(const QString &linkUrl) const;
51 void showProgressBar(const int &progress) const;
52 void updateBackAction(const bool &isEnabled) const;
53 void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain) const;
54 void updateForwardAction(const bool &isEnabled) const;
55 void updateJavaScriptAction(const bool &isEnabled) const;
56 void updateLocalStorageAction(const bool &isEnabled) const;
57 void updateSearchEngineActions(const QString &searchEngine) const;
58 void updateUrlLineEdit(const QUrl &newUrl) const;
59 void updateUserAgentActions(const QString &userAgent) const;
60 void updateZoomFactorAction(const double &zoomFactor) const;
64 void applyApplicationSettings();
65 void applyDomainSettingsAndReload();
66 void applyDomainSettingsWithoutReloading(const QString &hostname);
67 void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
68 void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
72 void loadUrlFromLineEdit(QString url) const;
77 void loadFinished() const;
78 void loadProgress(const int &progress) const;
79 void loadStarted() const;
80 void pageLinkHovered(const QString &linkUrl) const;
81 void updateUrl(const QUrl &url) const;
84 // The private variables.
85 double currentZoomFactor; // This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
86 QString searchEngineUrl;
87 QWebEngineHistory *webEngineHistoryPointer;
88 QWebEngineProfile *webEngineProfilePointer;
89 QWebEngineSettings *webEngineSettingsPointer;
90 QWebEngineView *webEngineViewPointer;
92 // The private functions.
93 void applyDomainSettings(const QString &hostname, const bool reloadWebsite);