X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwidgets%2FTabWidget.cpp;h=5ef7fc5aa5c36e1513c3b25bbc53dde44512dcc6;hb=95aa7dff6f4da3aa85775d46600f9be2e2f856eb;hp=aee71d73820d3db97c3f3e2ac433be8731fddb47;hpb=5f747e35e3555da6a0f89f0444163d578ab1db22;p=PrivacyBrowserPC.git diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index aee71d7..5ef7fc5 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -219,6 +219,14 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const emit hideProgressBar(); }); + // Update the zoom factor when changed by CTRL-Scrolling. This can be modified when is fixed. + connect(webEnginePagePointer, &QWebEnginePage::contentsSizeChanged, [webEnginePagePointer, this] () + { + // Only update the zoom factor action text if this is the current tab. + if (webEnginePagePointer == currentWebEnginePagePointer) + emit updateZoomFactorAction(webEnginePagePointer->zoomFactor()); + }); + // Display find text results. connect(webEnginePagePointer, SIGNAL(findTextFinished(const QWebEngineFindTextResult &)), this, SLOT(findTextFinished(const QWebEngineFindTextResult &))); @@ -341,7 +349,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const webEngineProfilePointer->setSpellCheckEnabled(true); // Set the spell check language. - webEngineProfilePointer->setSpellCheckLanguages({QLatin1String("en_US")}); + webEngineProfilePointer->setSpellCheckLanguages(Settings::spellCheckLanguages()); // Populate the zoom factor. This is necessary if a URL is being loaded, like a local URL, that does not trigger `applyDomainSettings()`. privacyWebEngineViewPointer->setZoomFactor(Settings::zoomFactor()); @@ -554,7 +562,7 @@ void TabWidget::applyOnTheFlySearchEngine(QAction *searchEngineActionPointer) // Store the search engine string. searchEngineUrl = SearchEngineHelper::getSearchUrl(searchEngineName); - // Update the search engine actionas. + // Update the search engine actions. emit updateSearchEngineActions(searchEngineName, false); } @@ -586,6 +594,28 @@ void TabWidget::applyOnTheFlyZoomFactor(const double &zoomFactor) currentPrivacyWebEngineViewPointer->setZoomFactor(zoomFactor); } +void TabWidget::applySpellCheckLanguages() const +{ + // Get the number of tab. + int numberOfTabs = tabWidgetPointer->count(); + + // Set the spell check languages for each tab. + for (int i = 0; i < numberOfTabs; ++i) + { + // Get the WebEngine view pointer. + PrivacyWebEngineView *webEngineViewPointer = qobject_cast(tabWidgetPointer->currentWidget()); + + // Get the WebEngine page pointer. + QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page(); + + // Get the WebEngine profile pointer. + QWebEngineProfile *webEngineProfilePointer = webEnginePagePointer->profile(); + + // Set the spell check languages. + webEngineProfilePointer->setSpellCheckLanguages(Settings::spellCheckLanguages()); + } +} + void TabWidget::back() const { // Go back. @@ -955,15 +985,21 @@ void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPoin // Update the notification when the download progresses. connect(webEngineDownloadItemPointer, &QWebEngineDownloadItem::downloadProgress, [fileDownloadNotificationPointer, saveFileName] (qint64 bytesReceived, qint64 totalBytes) { - // Calculate the download percentage. - int downloadPercentage = 100 * bytesReceived / totalBytes; - // Set the new text. Total bytes will be 0 if the download size is unknown. if (totalBytes > 0) + { + // Calculate the download percentage. + int downloadPercentage = 100 * bytesReceived / totalBytes; + + // Set the file download notification text. fileDownloadNotificationPointer->setText(i18nc("Download progress notification text", "%1\% of %2 downloaded (%3 of %4 bytes)", downloadPercentage, saveFileName, bytesReceived, totalBytes)); + } else + { + // Set the file download notification text. fileDownloadNotificationPointer->setText(i18nc("Download progress notification text", "%1: %2 bytes downloaded", saveFileName, bytesReceived)); + } // Display the updated notification. fileDownloadNotificationPointer->update(); @@ -1058,7 +1094,7 @@ void TabWidget::toggleJavaScript() const void TabWidget::toggleLocalStorage() { - // Toggle local storeage. + // Toggle local storage. currentPrivacyWebEngineViewPointer->localStorageEnabled = !currentPrivacyWebEngineViewPointer->localStorageEnabled; // Update the local storage action.