1/*
2 SPDX-FileCopyrightText: 2011-2018 Dominik Haumann <dhaumann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef VARIABLE_EDITOR_H
8#define VARIABLE_EDITOR_H
9
10#include <QWidget>
11
12class KateHelpButton;
13
14class VariableBoolItem;
15class VariableColorItem;
16class VariableFontItem;
17class VariableItem;
18class VariableStringListItem;
19class VariableIntItem;
20class VariableStringItem;
21class VariableSpellCheckItem;
22class VariableRemoveSpacesItem;
23
24class KColorCombo;
25class QFontComboBox;
26class QCheckBox;
27class QComboBox;
28class QLabel;
29class QLineEdit;
30class QSpinBox;
31
32namespace Sonnet
33{
34class DictionaryComboBox;
35}
36
37class VariableEditor : public QWidget
38{
39 Q_OBJECT
40
41public:
42 explicit VariableEditor(VariableItem *item, QWidget *parent = nullptr);
43
44 VariableItem *item() const;
45
46Q_SIGNALS:
47 void valueChanged();
48
49protected Q_SLOTS:
50 void itemEnabled(bool enabled);
51 void activateItem();
52
53protected:
54 void paintEvent(QPaintEvent *event) override;
55 void enterEvent(QEnterEvent *event) override;
56 void leaveEvent(QEvent *event) override;
57
58private:
59 VariableItem *m_item;
60
61 QCheckBox *m_checkBox;
62 QLabel *m_variable;
63 QLabel *m_helpText;
64 KateHelpButton *m_btnHelp;
65};
66
67class VariableIntEditor : public VariableEditor
68{
69public:
70 VariableIntEditor(VariableIntItem *item, QWidget *parent);
71
72protected:
73 void setItemValue(int newValue);
74
75private:
76 QSpinBox *m_spinBox;
77};
78
79class VariableBoolEditor : public VariableEditor
80{
81public:
82 VariableBoolEditor(VariableBoolItem *item, QWidget *parent);
83
84protected:
85 void setItemValue(int enabled);
86
87private:
88 QComboBox *m_comboBox;
89};
90
91class VariableStringListEditor : public VariableEditor
92{
93public:
94 VariableStringListEditor(VariableStringListItem *item, QWidget *parent);
95
96protected:
97 void setItemValue(const QString &newValue);
98
99private:
100 QComboBox *m_comboBox;
101};
102
103class VariableColorEditor : public VariableEditor
104{
105public:
106 VariableColorEditor(VariableColorItem *item, QWidget *parent);
107
108protected:
109 void setItemValue(const QColor &newValue);
110
111private:
112 KColorCombo *m_comboBox;
113};
114
115class VariableFontEditor : public VariableEditor
116{
117public:
118 VariableFontEditor(VariableFontItem *item, QWidget *parent);
119
120protected:
121 void setItemValue(const QFont &newValue);
122
123private:
124 QFontComboBox *m_comboBox;
125};
126
127class VariableStringEditor : public VariableEditor
128{
129public:
130 VariableStringEditor(VariableStringItem *item, QWidget *parent);
131
132protected:
133 void setItemValue(const QString &newValue);
134
135private:
136 QLineEdit *m_lineEdit;
137};
138
139class VariableSpellCheckEditor : public VariableEditor
140{
141public:
142 VariableSpellCheckEditor(VariableSpellCheckItem *item, QWidget *parent);
143
144protected:
145 void setItemValue(const QString &newValue);
146
147private:
148 Sonnet::DictionaryComboBox *m_dictionaryCombo;
149};
150
151class VariableRemoveSpacesEditor : public VariableEditor
152{
153public:
154 VariableRemoveSpacesEditor(VariableRemoveSpacesItem *item, QWidget *parent);
155
156protected:
157 void setItemValue(int enabled);
158
159private:
160 QComboBox *m_comboBox;
161};
162
163#endif
164

source code of ktexteditor/src/variableeditor/variableeditor.h