aboutsummaryrefslogtreecommitdiff
path: root/src/dialogs/settingsdialog.hpp
blob: fd1d7cbf17ed95ba45e587e29a1d1fccd71f1a0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef SETTINGSDIALOG_HPP
#define SETTINGSDIALOG_HPP

#include <QDialog>

#include "renderers/geminirenderer.hpp"
#include "protocolsetup.hpp"
#include "documentstyle.hpp"
#include "ssltrust.hpp"
#include "kristall.hpp"

namespace Ui {
class SettingsDialog;
}

class SettingsDialog : public QDialog
{
    Q_OBJECT

public:
    explicit SettingsDialog(QWidget *parent = nullptr);
    ~SettingsDialog();

    void setGeminiStyle(DocumentStyle const & style);

    DocumentStyle geminiStyle() const {
        return current_style;
    }

    ProtocolSetup protocols() const;
    void setProtocols(ProtocolSetup const & proto);

    SslTrust geminiSslTrust() const;
    void setGeminiSslTrust(SslTrust const & trust);

    SslTrust httpsSslTrust() const;
    void setHttpsSslTrust(SslTrust const & trust);

    GenericSettings options() const;
    void setOptions(GenericSettings const & options);

private slots:
    void on_std_change_font_clicked();

    void on_pre_change_font_clicked();

    void on_h1_change_font_clicked();

    void on_h2_change_font_clicked();

    void on_h3_change_font_clicked();

    void on_std_change_color_clicked();

    void on_pre_change_color_clicked();

    void on_h1_change_color_clicked();

    void on_h2_change_color_clicked();

    void on_h3_change_color_clicked();

    void on_bg_change_color_clicked();

    void on_link_local_change_color_clicked();

    void on_link_foreign_change_color_clicked();

    void on_link_cross_change_color_clicked();

    void on_link_local_prefix_textChanged(const QString &arg1);

    void on_link_foreign_prefix_textChanged(const QString &arg1);

    void on_auto_theme_currentIndexChanged(int index);

    void on_preview_url_textChanged(const QString &arg1);

    void on_page_margin_valueChanged(double arg1);

    void on_presets_currentIndexChanged(int index);

    void on_preset_new_clicked();

    void on_SettingsDialog_accepted();

    void on_quote_change_color_clicked();

    void on_preset_save_clicked();

    void on_preset_load_clicked();

    void on_preset_import_clicked();

    void on_preset_export_clicked();

    void on_start_page_textChanged(const QString &arg1);

    void on_ui_theme_currentIndexChanged(int index);

    void on_ui_density_currentIndexChanged(int index);

    void on_fancypants_on_clicked();

    void on_fancypants_off_clicked();

    void on_texthl_on_clicked();

    void on_texthl_off_clicked();

    void on_gophermap_icon_clicked();

    void on_gophermap_text_clicked();

    void on_scheme_os_default_clicked();

    void on_scheme_error_clicked();

    void on_show_hidden_files_clicked();

    void on_hide_hidden_files_clicked();

    void on_urlbarhl_fancy_clicked();

    void on_urlbarhl_none_clicked();

    void on_redirection_mode_currentIndexChanged(int index);

    void on_max_redirects_valueChanged(int arg1);

    void on_network_timeout_valueChanged(int arg1);

    void on_enable_home_btn_clicked(bool arg1);

private:
    void reloadStylePreview();

    void updateFont(QFont & input);

    void updateColor(QColor & input);

private:
    Ui::SettingsDialog *ui;

    DocumentStyle current_style;
    std::unique_ptr<QTextDocument> preview_document;

    QMap<QString, DocumentStyle> predefined_styles;

    SslTrust current_trust;

    GenericSettings current_options;
};

#endif // SETTINGSDIALOG_HPP