]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/dialogs/DomainSettingsDialog.h
Enable downloading of files that require login cookies. https://redmine.stoutner...
[PrivacyBrowserPC.git] / src / dialogs / DomainSettingsDialog.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 DOMAINSETTINGSDIALOG_H
21 #define DOMAINSETTINGSDIALOG_H
22
23 // Application headers.
24 #include "helpers/UserAgentHelper.h"
25
26 // KDE Frameworks headers.
27 #include <KLineEdit>
28
29 // Qt toolkit headers.
30 #include <QDialog>
31 #include <QDoubleSpinBox>
32 #include <QLabel>
33 #include <QtSql>
34
35 class DomainSettingsDialog : public QDialog
36 {
37     // Include the Q_OBJECT macro.
38     Q_OBJECT
39
40 public:
41     // The primary constructor.
42     explicit DomainSettingsDialog(const int &startType = SHOW_ALL_DOMAINS, const QString &domainName = QStringLiteral(""));
43
44     // The public static int constants.
45     static const int SHOW_ALL_DOMAINS;
46     static const int ADD_DOMAIN;
47     static const int EDIT_DOMAIN;
48
49 signals:
50     void domainSettingsUpdated() const;
51
52 private Q_SLOTS:
53     // The private slots.
54     void apply() const;
55     void cancel();
56     void customZoomFactorChanged(const double &newValue) const;
57     void domStorageChanged(const int &newIndex) const;
58     void domainNameChanged(const QString &updatedDomainName) const;
59     void domainSelected(const QModelIndex &modelIndex) const;
60     void javaScriptChanged(const int &newIndex) const;
61     void localStorageChanged(const int &newIndex) const;
62     void ok();
63     void reset() const;
64     void showAddMessageBox();
65     void showDeleteMessageBox() const;
66     void userAgentChanged(const QString &updatedUserAgent) const;
67     void zoomFactorComboBoxChanged(const int &newIndex) const;
68
69 private:
70     // The private variables.
71     QPushButton *applyButtonPointer;
72     QDoubleSpinBox *customZoomFactorSpinBoxPointer;
73     QPalette defaultPalette;
74     QPushButton *deleteDomainButtonPointer;
75     QWidget *domStorageWidgetPointer;
76     QComboBox *domStorageComboBoxPointer;
77     QLabel *domStorageLabelPointer;
78     KLineEdit *domainNameLineEditPointer;
79     QWidget *domainSettingsWidgetPointer;
80     QListView *domainsListViewPointer;
81     QSqlTableModel *domainsTableModelPointer;
82     QItemSelectionModel *domainsSelectionModelPointer;
83     QPalette highlightedPalette;
84     QWidget *javaScriptWidgetPointer;
85     QComboBox *javaScriptComboBoxPointer;
86     QLabel *javaScriptLabelPointer;
87     QWidget *localStorageWidgetPointer;
88     QComboBox *localStorageComboBoxPointer;
89     QLabel *localStorageLabelPointer;
90     QPushButton *resetButtonPointer;
91     QWidget *userAgentWidgetPointer;
92     QComboBox *userAgentComboBoxPointer;
93     UserAgentHelper *userAgentHelperPointer;
94     QLabel *userAgentLabelPointer;
95     QWidget *zoomFactorWidgetPointer;
96     QComboBox *zoomFactorComboBoxPointer;
97
98     // The private functions.
99     void addDomain(const QString &domainName) const;
100     void populateDomStorageLabel() const;
101     void populateJavaScriptLabel() const;
102     void populateLocalStorageLabel() const;
103     void populateUserAgentLabel(const QString &userAgentName) const;
104     void updateUi() const;
105 };
106 #endif