]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/windows/BrowserWindow.h
Partial filter list implementation.
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.h
index b3630db54e3459fb0f97baf450018cf16e3e4fd9..052a311d7eb4e984644a52c5aa61133559debfda 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * 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>.
+ * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc/>.
  *
  * Privacy Browser PC is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define BROWSERWINDOW_H
 
 // Application headers.
-#include "views/BrowserView.h"
+#include "widgets/TabWidget.h"
+#include "widgets/UrlLineEdit.h"
 
 // KDE Frameworks headers.
 #include <KConfigDialog>
+#include <KToggleFullScreenAction>
+#include <KToolBar>
 #include <KXmlGuiWindow>
 
 // Qt toolkit headers.
+#include <QComboBox>
 #include <QLabel>
 #include <QProgressBar>
 
@@ -38,47 +42,119 @@ class BrowserWindow : public KXmlGuiWindow
 
 public:
     // The default constructor.
-    BrowserWindow();
+    BrowserWindow(bool firstWindow=true, QString *initialUrlStringPointer = nullptr);
 
     // The public functions.
     QSize sizeHint() const override;
 
+    // The public variables.
+    TabWidget *tabWidgetPointer;
+
+public Q_SLOTS:
+    // The public slots.
+    void populateBookmarksInThisWindow();  // This is public so that the bookmarks can be repopulated over D-Bus when changed by another instance of Privacy Browser.
+
 private Q_SLOTS:
     // The private slots.
+    void addOrEditDomainSettings();
     void back() const;
-    void fileNew() const;
+    void clearUrlLineEditFocus() const;
+    void decrementZoom();
+    void editBookmarks();
+    void escape() const;
+    void findNext() const;
+    void findPrevious() const;
     void forward() const;
+    void fullScreenRequested(const bool toggleOn);
     void getZoomFactorFromUser();
+    void hideFindTextActions() const;
+    void hideProgressBar() const;
     void home() const;
+    void incrementZoom();
     void loadUrlFromLineEdit(const QString &url) const;
-    void openDomainSettings() const;
+    void newWindow() const;
+    void populateBookmarksInAllWindows() const;
     void refresh() const;
-    void settingsConfigure();
+    void reloadAndBypassCache() const;
+    void showBookmarkContextMenu(const QPoint &point);
+    void showCookiesDialog();
+    void showDomainSettingsDialog();
+    void showFilterListsDialog();
+    void showFindTextActions() const;
     void showProgressBar(const int &progress) const;
+    void showRequestsDialog();
+    void showSettingsDialog();
+    void toggleBookmark();
+    void toggleDeveloperTools() const;
+    void toggleDomStorage() const;
+    void toggleFindCaseSensitive() const;
     void toggleJavaScript() const;
     void toggleLocalStorage() const;
-    void updateDomainSettingsIndicator(const bool &status) const;
-    void updateJavaScriptAction(const bool &isEnabled) const;
-    void updateLocalStorageAction(const bool &isEnabled) const;
-    void updateSearchEngineActions(const QString &searchEngine) const;
-    void updateUserAgentActions(const QString &userAgent) const;
-    void updateZoomFactorAction(const double &zoomFactor);
-    void updateSearchEngineLabel(const QString &searchEngineString) const;
-    void updateUrlLineEdit(const QString &newUrl) const;
-    void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
+    void toggleFullScreen();
+    void toggleViewBookmarksToolBar();
+    void toggleViewSource() const;
+    void toggleViewSourceInNewTab() const;
+    void updateCookiesAction(const int numberOfCookies) const;
+    void updateDefaultZoomFactor(const double newDefaultZoomFactorDouble);
+    void updateDomStorageAction(const bool &isEnabled) const;
+    void updateDomainSettingsIndicator(const bool status);
+    void updateFindText(const QString &text, const bool findCaseSensitive) const;
+    void updateFindTextResults(const QWebEngineFindTextResult &findTextResult) const;
+    void updateJavaScriptAction(const bool &isEnabled);
+    void updateLocalStorageAction(const bool &isEnabled);
+    void updateRequestsAction(const int blockedRequests) const;
+    void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
+    void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
+    void updateUrlLineEdit(const QUrl &newUrl);
+    void updateViewBookmarksToolBarCheckbox(const bool visible);
+    void updateWindowTitle(const QString &title);
+    void updateZoomActions(const double zoomFactorDouble);
+    void zoomDefault();
 
 private:
     // The private variables.
-    BrowserView *browserViewPointer;
-    KConfigDialog *configDialogPointer;
-    QAction *domainSettingsActionPointer;
-    QPalette domainSettingsPalette;
-    double currentZoomFactor;
+    KActionCollection *actionCollectionPointer;
+    QAction *bookmarkedActionPointer;
+    QList<QPair<QMenu *, QAction *> *> bookmarkFolderFinalActionList;
+    QList<QPair<QMenu *, QAction *> *> bookmarksMenuActionList;
+    QMenu *bookmarksMenuPointer;
+    QList<QPair<QMenu *, QMenu *> *> bookmarksMenuSubmenuList;
+    QList<QAction*> bookmarksToolBarActionList;
+    QList<QPair<QMenu *, const double> *> bookmarksToolBarMenuList;
+    KToolBar *bookmarksToolBarPointer;
+    QList<QPair<QMenu *, QAction *> *> bookmarksToolBarSubfolderActionList;
+    bool bookmarksToolBarIsVisible = false;
+    bool bookmarksToolBarUninitialized = true;
+    QAction *cookiesActionPointer;
+    QUrl currentUrl;
+    QPushButton *currentZoomButtonPointer;
+    double currentZoomFactorDouble;
+    bool customSearchEngineEnabled;
+    bool customUserAgentEnabled;
+    double defaultZoomFactorDouble;
+    QAction *developerToolsActionPointer;
+    QAction *domStorageActionPointer;
+    QAction *findCaseSensitiveActionPointer;
+    QAction *findNextActionPointer;
+    QAction *findPreviousActionPointer;
+    QAction *findTextLabelActionPointer;
+    QLabel *findTextLabelPointer;
+    QAction *findTextLineEditActionPointer;
+    KLineEdit *findTextLineEditPointer;
+    KToggleFullScreenAction *fullScreenActionPointer;
+    QAction *hideFindTextActionPointer;
     QAction *javaScriptActionPointer;
+    bool javaScriptEnabled;
     QAction *localStorageActionPointer;
-    QPalette noDomainSettingsPalette;
+    bool localStorageEnabled;
+    KToolBar *navigationToolBarPointer;
+    QPalette negativeBackgroundPalette;
+    QPalette normalBackgroundPalette;
+    QPalette positiveBackgroundPalette;
     QProgressBar *progressBarPointer;
-    QLabel *searchEngineLabelPointer;
+    QAction *refreshActionPointer;
+    QAction *requestsActionPointer;
+    QAction *searchEngineMenuActionPointer;
     QAction *searchEngineMojeekActionPointer;
     QAction *searchEngineMonoclesActionPointer;
     QAction *searchEngineMetagerActionPointer;
@@ -86,8 +162,10 @@ private:
     QAction *searchEngineBingActionPointer;
     QAction *searchEngineYahooActionPointer;
     QAction *searchEngineCustomActionPointer;
-    QLabel *userAgentLabelPointer;
+    QAction *stopActionPointer;
+    QAction *userAgentMenuActionPointer;
     QAction *userAgentPrivacyBrowserActionPointer;
+    QAction *userAgentWebEngineDefaultActionPointer;
     QAction *userAgentFirefoxLinuxActionPointer;
     QAction *userAgentChromiumLinuxActionPointer;
     QAction *userAgentFirefoxWindowsActionPointer;
@@ -95,7 +173,24 @@ private:
     QAction *userAgentEdgeWindowsActionPointer;
     QAction *userAgentSafariMacosActionPointer;
     QAction *userAgentCustomActionPointer;
-    KLineEdit *urlLineEditPointer;
+    UrlLineEdit *urlLineEditPointer;
+    KToolBar *urlToolBarPointer;
+    QAction *viewBookmarksToolBarActionPointer;
+    QAction *viewSourceActionPointer;
+    QAction *viewSourceInNewTabActionPointer;
+    QAction *zoomDefaultActionPointer;
     QAction *zoomFactorActionPointer;
+    QAction *zoomInActionPointer;
+    QPushButton *zoomMinusButtonPointer;
+    QAction *zoomOutActionPointer;
+    QPushButton *zoomPlusButtonPointer;
+
+    // The private functions.
+    void addBookmarkFolderFinalActions(QMenu *menuPointer, const double folderId, const bool addToList);
+    int calculateSettingsInt(const bool settingCurrentlyEnabled, const bool settingEnabledByDefault) const;
+    void populateBookmarksMenuSubfolders(const double folderId, QMenu *menuPointer);
+    void populateBookmarksToolBar();
+    void populateBookmarksToolBarSubfolders(const double folderId, QMenu *menuPointer);
+    void updateBookmarkedAction() const;
 };
 #endif