]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/PrivacyWebEngineView.cpp
Add DevTools. https://redmine.stoutner.com/issues/1126
[PrivacyBrowserPC.git] / src / widgets / PrivacyWebEngineView.cpp
index 37c26bfef12f8b918a1d251baf691b54d66da638..8f61f9156acd62994e26da68eab4dbb845a8cc8d 100644 (file)
@@ -30,7 +30,7 @@
 #include <QMenu>
 
 // Construct the class.
-PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
+PrivacyWebEngineView::PrivacyWebEngineView(QWidget *parentWidgetPointer) : QWebEngineView(parentWidgetPointer)
 {
     // Create an off-the-record profile (the default when no profile name is specified).
     webEngineProfilePointer = new QWebEngineProfile(QLatin1String(""));
@@ -45,7 +45,7 @@ PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
     webEngineSettingsPointer = webEnginePagePointer->settings();
 
     // Instantiate the URL request interceptor.
-    UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor();
+    UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor(this);
 
     // Set the URL request interceptor.
     webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
@@ -180,12 +180,12 @@ void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bo
         if (domainQuery.value(DomainsDatabase::ZOOM_FACTOR).toInt())
         {
             // Store the current zoom factor.
-            setZoomFactor(domainQuery.value(DomainsDatabase::CUSTOM_ZOOM_FACTOR).toDouble());
+            defaultZoomFactor = domainQuery.value(DomainsDatabase::CUSTOM_ZOOM_FACTOR).toDouble();
         }
         else
         {
-            // Reset the current zoom factor.
-            setZoomFactor(Settings::zoomFactor());
+            // Store the current zoom factor.
+            defaultZoomFactor = Settings::zoomFactor();
         }
     }
     else  // The hostname does not have domain settings.
@@ -205,10 +205,13 @@ void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bo
         // Set the user agent.
         webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
 
-        // Set the zoom factor.
-        setZoomFactor(Settings::zoomFactor());
+        // Store the zoom factor.
+        defaultZoomFactor = Settings::zoomFactor();
     }
 
+    // Set the current zoom factor.
+    setZoomFactor(defaultZoomFactor);
+
     // Reload the website if requested.
     if (reloadWebsite)
         reload();