KTextEditor

katethemeconfig.h
1/*
2 SPDX-FileCopyrightText: 2001-2003 Christoph Cullmann <cullmann@kde.org>
3 SPDX-FileCopyrightText: 2002, 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 SPDX-FileCopyrightText: 2012-2018 Dominik Haumann <dhaumann@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KATE_SCHEMA_CONFIG_H
10#define KATE_SCHEMA_CONFIG_H
11
12#include "kateconfigpage.h"
13#include "kateextendedattribute.h"
14
15#include <map>
16#include <unordered_map>
17
19class KateColorTreeWidget;
20class KMessageWidget;
21class KateColorItem;
22
23namespace KTextEditor
24{
25class ViewPrivate;
26class DocumentPrivate;
27}
28
29class QComboBox;
30
31class KateThemeConfigColorTab : public QWidget
32{
34
35public:
36 KateThemeConfigColorTab();
37
38 QColor backgroundColor() const;
39 QColor selectionColor() const;
40
41public Q_SLOTS:
42 void apply();
43 void reload();
44 void schemaChanged(const QString &newSchema);
45
47 void changed();
48
49private:
50 // multiple shemas may be edited. Hence, we need one ColorList for each schema
51 std::map<QString, QList<KateColorItem>> m_schemas;
52 QString m_currentSchema;
53 KateColorTreeWidget *ui;
54};
55
56class KateThemeConfigDefaultStylesTab : public QWidget
57{
59
60public:
61 explicit KateThemeConfigDefaultStylesTab(KateThemeConfigColorTab *colorTab);
62
64 void changed();
65
66public:
67 void schemaChanged(const QString &schema);
68 void reload();
69 void apply();
70
71 KateAttributeList *attributeList(const QString &schema);
72
73protected:
74 void showEvent(QShowEvent *event) override;
75 void updateColorPalette(const QColor &textColor);
76
77private:
78 KateStyleTreeWidget *m_defaultStyles;
79 std::unordered_map<QString, KateAttributeList> m_defaultStyleLists;
80 KateThemeConfigColorTab *m_colorTab;
81 QString m_currentSchema;
82};
83
84class KateThemeConfigHighlightTab : public QWidget
85{
87
88public:
89 explicit KateThemeConfigHighlightTab(KateThemeConfigDefaultStylesTab *page, KateThemeConfigColorTab *colorTab);
90
91 void schemaChanged(const QString &schema);
92 void reload();
93 void apply();
94
96 void changed();
97
98protected Q_SLOTS:
99 void hlChanged(int z);
100
101protected:
102 void showEvent(QShowEvent *event) override;
103 void updateColorPalette(const QColor &textColor);
104
105private:
106 KateThemeConfigDefaultStylesTab *m_defaults;
107 KateThemeConfigColorTab *m_colorTab;
108
109 QComboBox *hlCombo;
110 KateStyleTreeWidget *m_styles;
111
112 QString m_schema;
113 int m_hl;
114
116
117 /**
118 * store attribute we modify
119 * this unifies them to be unique (aka in all highlighting's the embedded stuff is shared!)
120 *
121 * theme => highlighting => attribute => pair of value + default
122 */
123 std::map<QString, std::map<QString, std::map<QString, std::pair<KTextEditor::Attribute::Ptr, KTextEditor::Attribute::Ptr>>>> m_uniqueAttributes;
124
125public:
126 QList<int> hlsForSchema(const QString &schema);
127};
128
129class KateThemeConfigPage : public KateConfigPage
130{
131public:
132 explicit KateThemeConfigPage(QWidget *parent);
133 QString name() const override;
134 QString fullName() const override;
135 QIcon icon() const override;
136
137public:
138 void apply() override;
139 void reload() override;
140 void reset() override;
141 void defaults() override;
142 void exportFullSchema();
143 void importFullSchema();
144
145private:
146 void layoutThemeChooserTab(QWidget *tab);
147 void layoutThemeEditorTab(QWidget *tab);
148 void deleteSchema();
149 bool copyTheme();
150 void schemaChanged(const QString &schema);
151 void comboBoxIndexChanged(int currentIndex);
152
153private:
154 void refillCombos(const QString &schemaName, const QString &defaultSchemaName);
155
156private:
157 QString m_currentSchema;
158
159 KMessageWidget *m_readOnlyThemeLabel = nullptr;
160 class QPushButton *btndel;
161 class QComboBox *defaultSchemaCombo;
162 class QComboBox *schemaCombo;
163 KateThemeConfigColorTab *m_colorTab;
164 KateThemeConfigDefaultStylesTab *m_defaultStylesTab;
165 KateThemeConfigHighlightTab *m_highlightTab;
166 KTextEditor::DocumentPrivate *m_doc = nullptr;
167 KTextEditor::ViewPrivate *m_themePreview = nullptr;
168};
169
170#endif
Backend of KTextEditor::Document related public KTextEditor interfaces.
QTreeWidget that automatically adds columns for KateStyleListItems and provides a popup menu and a sl...
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.