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 PRIVACYWEBENGINEVIEW_H
21 #define PRIVACYWEBENGINEVIEW_H
23 // Qt toolkit headers.
25 #include <QNetworkCookie>
26 #include <QWebEngineFindTextResult>
27 #include <QWebEngineView>
29 class PrivacyWebEngineView : public QWebEngineView
31 // Include the Q_OBJECT macro.
35 // The default constructor.
36 explicit PrivacyWebEngineView();
38 // The public variables.
39 std::list<QNetworkCookie> *cookieListPointer = new std::list<QNetworkCookie>;
40 double defaultZoomFactor = 1.00;
41 QString domainSettingsName = QStringLiteral("");
42 QIcon favoriteIcon = QIcon::fromTheme(QStringLiteral("globe"));
43 bool findCaseSensitive = false;
44 QString findString = QStringLiteral("");
45 QWebEngineFindTextResult findTextResult = QWebEngineFindTextResult();
46 bool isLoading = false;
47 int loadProgressInt = -1;
48 bool localStorageEnabled = false;
50 // The public functions.
51 void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
55 void displayHttpPingBlockedDialog(const QString &httpPingUrl) const;
56 void updateCookiesAction(const int numberOfCookies) const;
57 void updateUi(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
61 void addCookieToList(const QNetworkCookie &cookie) const;
62 void removeCookieFromList(const QNetworkCookie &cookie) const;
66 void applyDomainSettingsWithoutReloading(const QString &hostname);
67 void displayHttpPingDialog(const QString &httpPingUrl) const;
70 // The private variables.
71 QWebEngineProfile *webEngineProfilePointer;
72 QWebEngineSettings *webEngineSettingsPointer;
75 // The protected functions.
76 void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
77 QWebEngineView* createWindow(QWebEnginePage::WebWindowType webWindowType) override;