]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/windows/BrowserWindow.h
Implement tabbed browsing.
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.h
1 /*
2  * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
5  *
6  * Privacy Browser PC is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Privacy Browser PC is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef BROWSERWINDOW_H
21 #define BROWSERWINDOW_H
22
23 // Application headers.
24 #include "widgets/TabWidget.h"
25
26 // KDE Frameworks headers.
27 #include <KConfigDialog>
28 #include <KToggleFullScreenAction>
29 #include <KXmlGuiWindow>
30
31 // Qt toolkit headers.
32 #include <QComboBox>
33 #include <QLabel>
34 #include <QProgressBar>
35
36 class BrowserWindow : public KXmlGuiWindow
37 {
38     // Include the Q_OBJECT macro.
39     Q_OBJECT
40
41 public:
42     // The default constructor.
43     BrowserWindow();
44
45     // The public functions.
46     QSize sizeHint() const override;
47
48 private Q_SLOTS:
49     // The private slots.
50     void addOrEditDomainSettings() const;
51     void back() const;
52     void clearUrlLineEditFocus() const;
53     void escape() const;
54     void fileNew() const;
55     void forward() const;
56     void fullScreenRequested(const bool toggleOn);
57     void getZoomFactorFromUser();
58     void home() const;
59     void loadUrlFromLineEdit(const QString &url) const;
60     void refresh() const;
61     void showCookiesDialog();
62     void showDownloadLocationBrowseDialog() const;
63     void showDomainSettingsDialog() const;
64     void showProgressBar(const int &progress) const;
65     void showSettingsDialog();
66     void toggleDomStorage() const;
67     void toggleJavaScript() const;
68     void toggleLocalStorage() const;
69     void toggleFullScreen();
70     void updateCookiesAction(const int numberOfCookies) const;
71     void updateDomStorageAction(const bool &isEnabled) const;
72     void updateDomainSettingsIndicator(const bool status);
73     void updateJavaScriptAction(const bool &isEnabled);
74     void updateLocalStorageAction(const bool &isEnabled);
75     void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus);
76     void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus);
77     void updateZoomFactorAction(const double &zoomFactor);
78     void updateSearchEngineLabel(const QString &searchEngineString) const;
79     void updateUrlLineEdit(const QUrl &newUrl);
80     void updateUserAgentLabel(const QString &userAgentDatabaseName) const;
81
82 private:
83     // The private variables.
84     KConfigDialog *configDialogPointer;
85     QAction *cookiesActionPointer;
86     QUrl currentUrl;
87     double currentZoomFactor;
88     bool customSearchEngineEnabled;
89     bool customUserAgentEnabled;
90     QAction *domStorageActionPointer;
91     QPalette domainSettingsPalette;
92     QComboBox *downloadLocationComboBoxPointer;
93     KToggleFullScreenAction *fullScreenActionPointer;
94     QAction *javaScriptActionPointer;
95     bool javaScriptEnabled;
96     QAction *localStorageActionPointer;
97     bool localStorageEnabled;
98     KToolBar *navigationToolBarPointer;
99     QPalette noDomainSettingsPalette;
100     QProgressBar *progressBarPointer;
101     QLabel *searchEngineLabelPointer;
102     QAction *searchEngineMenuActionPointer;
103     QAction *searchEngineMojeekActionPointer;
104     QAction *searchEngineMonoclesActionPointer;
105     QAction *searchEngineMetagerActionPointer;
106     QAction *searchEngineGoogleActionPointer;
107     QAction *searchEngineBingActionPointer;
108     QAction *searchEngineYahooActionPointer;
109     QAction *searchEngineCustomActionPointer;
110     TabWidget *tabWidgetPointer;
111     QLabel *userAgentLabelPointer;
112     QAction *userAgentMenuActionPointer;
113     QAction *userAgentPrivacyBrowserActionPointer;
114     QAction *userAgentWebEngineDefaultActionPointer;
115     QAction *userAgentFirefoxLinuxActionPointer;
116     QAction *userAgentChromiumLinuxActionPointer;
117     QAction *userAgentFirefoxWindowsActionPointer;
118     QAction *userAgentChromeWindowsActionPointer;
119     QAction *userAgentEdgeWindowsActionPointer;
120     QAction *userAgentSafariMacosActionPointer;
121     QAction *userAgentCustomActionPointer;
122     KLineEdit *urlLineEditPointer;
123     KToolBar *urlToolBarPointer;
124     QAction *zoomFactorActionPointer;
125 };
126 #endif