]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.h
Add a default folder icon to the edit folder dialog. https://redmine.stoutner.com...
[PrivacyBrowserPC.git] / src / widgets / TabWidget.h
index ed9ad03b002e314227c792d6a501d86f7533cd2c..4b06c640f5f1080e795b5567ba8ff58446e04985 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2024 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
  *
 
 // Application headers.
 #include "PrivacyWebEngineView.h"
+#include "helpers/UserAgentHelper.h"
 
 // KDE Framework headers.
 #include <KLineEdit>
 
 // Qt toolkit headers.
+#include <QMovie>
 #include <QPushButton>
 #include <QTabWidget>
 #include <QWebEngineCookieStore>
@@ -43,19 +45,26 @@ class TabWidget : public QWidget
 
 public:
     // The primary contructor.
-    explicit TabWidget(QWidget *parent);
+    explicit TabWidget(QWidget *windowPointer);
 
     // The destructor.
     ~TabWidget();
 
     // The public functions.
-    void applyOnTheFlyZoomFactor(const double &zoomFactor);
+    void applyOnTheFlyZoomFactor(const double zoomFactorDouble) const;
     PrivacyWebEngineView* loadBlankInitialWebsite();
     void loadInitialWebsite();
+    void findPrevious(const QString &text) const;
     std::list<QNetworkCookie>* getCookieList() const;
+    QIcon getCurrentTabFavoritIcon() const;
+    QString getCurrentTabTitle() const;
+    QString getCurrentTabUrl() const;
+    QString getCurrentUserAgent() const;
     QString& getDomainSettingsName() const;
     void setTabBarVisible(const bool visible) const;
+    void toggleDeveloperTools(const bool enabled) const;
     void toggleDomStorage() const;
+    void toggleFindCaseSensitive(const QString &text);
     void toggleJavaScript() const;
     void toggleLocalStorage();
 
@@ -73,8 +82,12 @@ signals:
     void showProgressBar(const int &progress) const;
     void updateBackAction(const bool &isEnabled) const;
     void updateCookiesAction(const int numberOfCookies) const;
+    void updateDefaultZoomFactor(const double newDefaultZoomFactorDouble) const;
+    void updateDeveloperToolsAction(const bool &isEnabled) const;
     void updateDomStorageAction(const bool &isEnabled) const;
     void updateDomainSettingsIndicator(const bool status) const;
+    void updateFindText(const QString &text, const bool findCaseSensitive) const;
+    void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
     void updateForwardAction(const bool &isEnabled) const;
     void updateJavaScriptAction(const bool &isEnabled) const;
     void updateLocalStorageAction(const bool &isEnabled) const;
@@ -82,20 +95,21 @@ signals:
     void updateUrlLineEdit(const QUrl &newUrl) const;
     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus) const;
     void updateWindowTitle(const QString &title) const;
-    void updateZoomFactorAction(const double &zoomFactor) const;
+    void updateZoomActions(const double zoomFactorDouble) const;
 
 public Q_SLOTS:
     // The public slots.
     void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const;
-    PrivacyWebEngineView* addTab(const bool focusNewWebEngineView=false);
+    PrivacyWebEngineView* addTab(const bool removeUrlLineEditFocus = false, const bool adjacent = false, const bool backgroundTab = false, const QString urlString = nullptr);
     void applyApplicationSettings();
     void applyDomainSettingsAndReload();
-    void applyDomainSettingsWithoutReloading(const QString &hostname);
     void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
     void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
+    void applySpellCheckLanguages() const;
     void back() const;
     void deleteAllCookies() const;
     void deleteCookieFromStore(const QNetworkCookie &cookie) const;
+    void findText(const QString &text) const;
     void forward() const;
     void home() const;
     void loadUrlFromLineEdit(QString url) const;
@@ -104,32 +118,42 @@ public Q_SLOTS:
     void print() const;
     void printPreview() const;
     void refresh() const;
+    void reloadAndBypassCache() const;
+    void saveArchive();
+    void stop() const;
 
 private Q_SLOTS:
     // The private slots.
     void addFirstTab();
     void deleteTab(const int tabIndex);
+    void findTextFinished(const QWebEngineFindTextResult &findTextResult);
     void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest) const;
     void pageLinkHovered(const QString &linkUrl) const;
     void printWebpage(QPrinter *printerPointer) const;
-    void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer) const;
-    void showSaveFilePickerDialog(QUrl &downloadUrl, QString &suggestedFileName);
+    void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer);
+    void stopLoadingFavoriteIconMovie() const;
+    void updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
     void updateUiWithTabSettings();
+    void useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName);
 
 private:
+    // The private functions.
+    void updateDownloadDirectory(QString newDownloadDirectory) const;
+
     // The private variables.
-    double currentZoomFactor;  // This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
     PrivacyWebEngineView *currentPrivacyWebEngineViewPointer;
     QWebEngineCookieStore *currentWebEngineCookieStorePointer;
     QWebEngineHistory *currentWebEngineHistoryPointer;
     QWebEnginePage *currentWebEnginePagePointer;
     QWebEngineProfile *currentWebEngineProfilePointer;
     QWebEngineSettings *currentWebEngineSettingsPointer;
-    QIcon defaultTabIcon = QIcon::fromTheme(QStringLiteral("globe"));
+    QIcon defaultFavoriteIcon = QIcon::fromTheme(QLatin1String("globe"), QIcon::fromTheme(QLatin1String("applications-internet")));
+    bool isRunningKde = false;
+    QMovie *loadingFavoriteIconMoviePointer;
+    QTabWidget *qTabWidgetPointer;
+    bool savingArchive;
     QString searchEngineUrl;
-    QTabWidget *tabWidgetPointer;
-
-    // The private functions.
-    void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
+    UserAgentHelper *userAgentHelperPointer;
+    bool wipingCurrentFindTextSelection = false;
 };
 #endif