X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwindows%2FBrowserWindow.cpp;h=03ababcb877893de2941c9cd409d92bd4d8d45e3;hp=77bb43b021f112e656da12f42dc731bc9815bcf8;hb=9514cabb5648123b68264e595e9ffef6261bd215;hpb=fb7b0588f2e95260578076aceb22a5644e81f8b6 diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index 77bb43b..03ababc 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -130,13 +130,28 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() domainSettingsActionPointer->setText(i18nc("Domain Settings button", "Domain Settings")); // Set the action icons. - //refreshActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); + userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode")); + userAgentFirefoxLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr"))); + userAgentChromiumLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("chromium"))); + userAgentFirefoxWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr"))); + userAgentChromeWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("chromium"))); + userAgentEdgeWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties"))); + userAgentSafariMacosActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties"))); + userAgentCustomActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties"))); + searchEngineMojeekActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search"))); + searchEngineMonoclesActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search"))); + searchEngineMetagerActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search"))); + searchEngineGoogleActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("im-google"))); + searchEngineBingActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search"))); + searchEngineYahooActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("im-yahoo"))); + searchEngineCustomActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search"))); + zoomFactorActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("zoom"))); domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("network-server-symbolic"))); // Update the on-the-fly menus. - connect(browserViewPointer, SIGNAL(userAgentUpdated(QString)), this, SLOT(updateOnTheFlyUserAgent(QString))); - connect(browserViewPointer, SIGNAL(zoomFactorUpdated(double)), this, SLOT(updateOnTheFlyZoomFactor(double))); - connect(browserViewPointer, SIGNAL(searchEngineUpdated(QString)), this, SLOT(updateOnTheFlySearchEngine(QString))); + connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString))); + connect(browserViewPointer, SIGNAL(updateZoomFactorAction(double)), this, SLOT(updateZoomFactorAction(double))); + connect(browserViewPointer, SIGNAL(updateSearchEngineActions(QString)), this, SLOT(updateSearchEngineActions(QString))); // Apply the on-the-fly settings when selected. connect(userAgentActionGroupPointer, SIGNAL(triggered(QAction*)), browserViewPointer, SLOT(applyOnTheFlyUserAgent(QAction*))); @@ -177,9 +192,19 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() // Get a handle for the status bar. QStatusBar *statusBarPointer = statusBar(); + // Create a progress bar. + progressBarPointer = new QProgressBar(); + + // Add the progress bar to to the status bar. + statusBarPointer->addPermanentWidget(progressBarPointer); + // Update the status bar with the URL when a link is hovered. connect(browserViewPointer, SIGNAL(linkHovered(QString)), statusBarPointer, SLOT(showMessage(QString))); + // Update the progress bar. + connect(browserViewPointer, SIGNAL(showProgressBar(const int)), this, SLOT(showProgressBar(const int))); + connect(browserViewPointer, SIGNAL(hideProgressBar()), progressBarPointer, SLOT(hide())); + // Get the URL line edit palettes. noDomainSettingsPalette = urlLineEditPointer->palette(); domainSettingsPalette = urlLineEditPointer->palette(); @@ -238,7 +263,7 @@ void BrowserWindow::getZoomFactorFromUser() browserViewPointer->applyOnTheFlyZoomFactor(newZoomFactor); // Update the on-the-fly action text. - updateOnTheFlyZoomFactor(newZoomFactor); + updateZoomFactorAction(newZoomFactor); } } @@ -290,6 +315,15 @@ void BrowserWindow::refresh() const browserViewPointer->refresh(); } +void BrowserWindow::showProgressBar(const int &progress) const +{ + // Set the progress bar value. + progressBarPointer->setValue(progress); + + // Show the progress bar. + progressBarPointer->show(); +} + void BrowserWindow::toggleJavaScript() const { // Remove the focus from the URL line edit. @@ -394,7 +428,7 @@ void BrowserWindow::updateJavaScriptAction(const bool &isEnabled) const else javaScriptActionPointer->setIcon(QIcon(":/icons/privacy-mode")); } -void BrowserWindow::updateOnTheFlySearchEngine(const QString &searchEngine) const +void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const { // Initialize the custom search engine flag. bool customSearchEngine = false; @@ -451,7 +485,7 @@ void BrowserWindow::updateOnTheFlySearchEngine(const QString &searchEngine) cons } } -void BrowserWindow::updateOnTheFlyUserAgent(const QString &userAgent) const +void BrowserWindow::updateUserAgentActions(const QString &userAgent) const { // Initialize the custom user agent flag. bool customUserAgent = false; @@ -493,10 +527,10 @@ void BrowserWindow::updateOnTheFlyUserAgent(const QString &userAgent) const } } -void BrowserWindow::updateOnTheFlyZoomFactor(const double &zoomFactor) +void BrowserWindow::updateZoomFactorAction(const double &zoomFactor) { // Set the current zoom factor. - currentZoomFactor = Settings::zoomFactor(); + currentZoomFactor = zoomFactor; // Update the zoom factor action text, formatting the double with 2 decimal places. zoomFactorActionPointer->setText(ki18nc("@action", "Zoom Factor - %1").subs(zoomFactor, 0, '0', 2).toString());