#include "MouseEventFilter.h"
#include "Settings.h"
#include "ui_BrowserView.h"
-#include "UrlRequestInterceptor.h"
#include "helpers/DomainsDatabaseHelper.h"
#include "helpers/SearchEngineHelper.h"
#include "helpers/UserAgentHelper.h"
+#include "interceptors/UrlRequestInterceptor.h"
#include "windows/BrowserWindow.h"
// Qt framework headers.
}
// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
-void BrowserView::applyDomainSettingsAndReload() const
+// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
+void BrowserView::applyDomainSettingsAndReload()
{
// Apply the domain settings. `true` reloads the website.
applyDomainSettings(webEngineViewPointer->url().host(), true);
}
// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
-void BrowserView::applyDomainSettingsWithoutReloading(const QString &hostname) const
+// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
+void BrowserView::applyDomainSettingsWithoutReloading(const QString &hostname)
{
// Apply the domain settings `false` does not reload the website.
applyDomainSettings(hostname, false);
}
-void BrowserView::applyDomainSettings(const QString &hostname, const bool reloadWebsite) const
+// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
+void BrowserView::applyDomainSettings(const QString &hostname, const bool reloadWebsite)
{
// Get the record for the hostname.
QSqlQuery domainQuery = DomainsDatabaseHelper::getDomainQuery(hostname);
// Set the user agent.
webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainRecord.field(DomainsDatabaseHelper::USER_AGENT).value().toString()));
- // Set the zoom factor.
- webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+ // Check if a custom zoom factor is set.
+ if (domainRecord.field(DomainsDatabaseHelper::ZOOM_FACTOR).value().toInt())
+ {
+ // Store the current zoom factor.
+ currentZoomFactor = domainRecord.field(DomainsDatabaseHelper::CUSTOM_ZOOM_FACTOR).value().toDouble();
+ }
+ else
+ {
+ // Reset the current zoom factor.
+ currentZoomFactor = Settings::zoomFactor();
+ }
+
+ // Set the zoom factor. The use of `currentZoomFactor` can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
+ webEngineViewPointer->setZoomFactor(currentZoomFactor);
// Apply the domain settings palette to the URL line edit.
emit updateDomainSettingsIndicator(true);
// Set the user agent.
webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
+ // Store the current zoom factor. This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
+ currentZoomFactor = Settings::zoomFactor();
+
// Set the zoom factor.
webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
webEngineViewPointer->reload();
}
-void BrowserView::applyOnTheFlyZoomFactor(const double &zoomFactor) const
+// This can be const once <https://redmine.stoutner.com/issues/799> has been resolved.
+void BrowserView::applyOnTheFlyZoomFactor(const double &zoomFactor)
{
+ // Update the current zoom factor. This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
+ currentZoomFactor = zoomFactor;
+
// Set the zoom factor.
webEngineViewPointer->setZoomFactor(zoomFactor);
}
emit updateBackAction(webEngineHistoryPointer->canGoBack());
emit updateForwardAction(webEngineHistoryPointer->canGoForward());
- // Reapply the zoom factor. This is a bug in QWebEngineView that resets the zoom with every load. Hopefully it will be fixed in Qt6. <https://bugreports.qt.io/browse/QTBUG-51992>
- webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+ // Reapply the zoom factor. This is a bug in QWebEngineView that resets the zoom with every load. <https://redmine.stoutner.com/issues/799>
+ webEngineViewPointer->setZoomFactor(currentZoomFactor);
}