+ // Update the title for this tab.
+ qTabWidgetPointer->setTabText(tabIndex, title);
+
+ // Update the window title if this is the current tab.
+ if (tabIndex == qTabWidgetPointer->currentIndex())
+ emit updateWindowTitle(title);
+ });
+
+ // Connect the loading favorite icon movie to the tab icon.
+ connect(loadingFavoriteIconMoviePointer, &QMovie::frameChanged, [this, privacyWebEngineViewPointer]
+ {
+ // Get the index for this tab.
+ int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer);
+
+ // Display the loading favorite icon if this tab is loading.
+ if (privacyWebEngineViewPointer->isLoading)
+ qTabWidgetPointer->setTabIcon(tabIndex, loadingFavoriteIconMoviePointer->currentPixmap());
+ });
+
+ // Update the icon when it changes.
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [this, privacyWebEngineViewPointer] (const QIcon &newFavoriteIcon)
+ {
+ // Store the favorite icon in the privacy web engine view.
+ if (newFavoriteIcon.isNull())
+ privacyWebEngineViewPointer->favoriteIcon = defaultFavoriteIcon;
+ else
+ privacyWebEngineViewPointer->favoriteIcon = newFavoriteIcon;
+
+ // Get the index for this tab.
+ int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer);
+
+ // Update the icon for this tab.
+ if (newFavoriteIcon.isNull())
+ qTabWidgetPointer->setTabIcon(tabIndex, defaultFavoriteIcon);
+ else
+ qTabWidgetPointer->setTabIcon(tabIndex, newFavoriteIcon);
+ });
+
+ // Update the progress bar and the favorite icon when a load is started.
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadStarted, [this, privacyWebEngineViewPointer] ()
+ {
+ // Set the privacy web engine view to be loading.
+ privacyWebEngineViewPointer->isLoading = true;
+
+ // Store the load progress.
+ privacyWebEngineViewPointer->loadProgressInt = 0;
+
+ // Show the progress bar if this is the current tab.
+ if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+ emit showProgressBar(0);
+
+ // Start the loading favorite icon movie.
+ loadingFavoriteIconMoviePointer->start();
+ });
+
+ // Update the progress bar when a load progresses.
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadProgress, [this, privacyWebEngineViewPointer] (const int progress)
+ {
+ // Store the load progress.
+ privacyWebEngineViewPointer->loadProgressInt = progress;
+
+ // Update the progress bar if this is the current tab.
+ if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+ emit showProgressBar(progress);
+ });
+
+ // Update the progress bar when a load finishes.
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadFinished, [this, privacyWebEngineViewPointer] ()
+ {
+ // Set the privacy web engine view to be not loading.
+ privacyWebEngineViewPointer->isLoading = false;
+
+ // Store the load progress.
+ privacyWebEngineViewPointer->loadProgressInt = -1;
+
+ // Hide the progress bar if this is the current tab.
+ if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+ emit hideProgressBar();
+
+ // Get the index for this tab.
+ int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer);
+
+ // Display the current favorite icon
+ qTabWidgetPointer->setTabIcon(tabIndex, privacyWebEngineViewPointer->favoriteIcon);
+
+ // Create a no tabs loading variable.
+ bool noTabsLoading = true;
+
+ // Check to see if any other tabs are loading.
+ for (int i = 0; i < qTabWidgetPointer->count(); i++)
+ {
+ // Get the privacy WebEngine view for the tab.
+ PrivacyWebEngineView *webEngineViewPointer = qobject_cast<PrivacyWebEngineView*>(qTabWidgetPointer->widget(i));
+
+ // Check to see if it is currently loading.
+ if (webEngineViewPointer->isLoading)
+ noTabsLoading = false;
+ }
+
+ // Stop the loading favorite icon movie if there are no loading tabs.
+ if (noTabsLoading)
+ loadingFavoriteIconMoviePointer->stop();
+ });
+
+ // Display HTTP Ping blocked dialogs.
+ connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::displayHttpPingBlockedDialog, [this, privacyWebEngineViewPointer] (const QString &httpPingUrl)
+ {
+ // Only display the HTTP Ping blocked dialog if this is the current tab.
+ if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+ {
+ // Instantiate an HTTP ping blocked message box.
+ QMessageBox httpPingBlockedMessageBox;
+
+ // Set the icon.
+ httpPingBlockedMessageBox.setIcon(QMessageBox::Information);
+
+ // Set the window title.
+ httpPingBlockedMessageBox.setWindowTitle(i18nc("HTTP Ping blocked dialog title", "HTTP Ping Blocked"));
+
+ // Set the text.
+ httpPingBlockedMessageBox.setText(i18nc("HTTP Ping blocked dialog text", "This request has been blocked because it sends a naughty HTTP ping to %1.", httpPingUrl));
+
+ // Set the standard button.
+ httpPingBlockedMessageBox.setStandardButtons(QMessageBox::Ok);
+
+ // Display the message box.
+ httpPingBlockedMessageBox.exec();
+ }
+ });
+
+ // Update the zoom factor when changed by CTRL-Scrolling. This can be modified when <https://redmine.stoutner.com/issues/845> 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 &)));