• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • schema
kateschemaconfig.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001-2003 Christoph Cullmann <cullmann@kde.org>
3  Copyright (C) 2002, 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
4  Copyright (C) 2012 Dominik Haumann <dhaumann kde org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __KATE_SCHEMA_CONFIG_H__
22 #define __KATE_SCHEMA_CONFIG_H__
23 
24 #include "katedialogs.h"
25 #include "katecolortreewidget.h"
26 #include "kateextendedattribute.h"
27 
28 #include <QtCore/QMap>
29 #include <QtGui/QFont>
30 
31 #include <kconfig.h>
32 
33 class KateStyleTreeWidget;
34 
35 class KComboBox;
36 class KTabWidget;
37 
38 
39 class KateSchemaConfigColorTab : public QWidget
40 {
41  Q_OBJECT
42 
43  public:
44  KateSchemaConfigColorTab();
45  ~KateSchemaConfigColorTab();
46 
47  QColor backgroundColor() const;
48  QColor selectionColor() const;
49 
50  public Q_SLOTS:
51  void apply();
52  void reload();
53  void schemaChanged( const QString &newSchema );
54 
55  void importSchema(KConfigGroup& config);
56  void exportSchema(KConfigGroup& config);
57 
58  Q_SIGNALS:
59  void changed();
60 
61  private:
62  QVector<KateColorItem> colorItemList() const;
63  QVector<KateColorItem> readConfig(KConfigGroup& config);
64 
65  private:
66  // multiple shemas may be edited. Hence, we need one ColorList for each schema
67  QMap<QString, QVector<KateColorItem> > m_schemas;
68  QString m_currentSchema;
69 
70  KateColorTreeWidget* ui;
71 };
72 
73 class KateSchemaConfigFontTab : public QWidget
74 {
75  Q_OBJECT
76 
77  public:
78  KateSchemaConfigFontTab();
79  ~KateSchemaConfigFontTab();
80 
81  public:
82  void readConfig (KConfig *config);
83 
84  void importSchema(KConfigGroup& config);
85  void exportSchema(KConfigGroup& config);
86 
87  public Q_SLOTS:
88  void apply();
89  void reload();
90  void schemaChanged( const QString &newSchema );
91 
92  Q_SIGNALS:
93  void changed();
94 
95  private:
96  class KFontChooser *m_fontchooser;
97  QMap<QString, QFont> m_fonts;
98  QString m_currentSchema;
99 
100  private Q_SLOTS:
101  void slotFontSelected( const QFont &font );
102 };
103 
104 class KateSchemaConfigDefaultStylesTab : public QWidget
105 {
106  Q_OBJECT
107 
108  public:
109  KateSchemaConfigDefaultStylesTab(KateSchemaConfigColorTab* colorTab);
110  ~KateSchemaConfigDefaultStylesTab();
111 
112  Q_SIGNALS:
113  void changed();
114 
115  public:
116  void schemaChanged (const QString &schema);
117  void reload ();
118  void apply ();
119 
120  KateAttributeList *attributeList (const QString &schema);
121  void exportSchema(const QString &schema, KConfig *cfg);
122  void importSchema(const QString& schemaName, const QString &schema, KConfig *cfg);
123 
124  protected:
125  virtual void showEvent(QShowEvent* event);
126  void updateColorPalette(const QColor& textColor);
127 
128  private:
129  KateStyleTreeWidget* m_defaultStyles;
130  QHash<QString,KateAttributeList*> m_defaultStyleLists;
131  KateSchemaConfigColorTab* m_colorTab;
132  QString m_currentSchema;
133 };
134 
135 class KateSchemaConfigHighlightTab : public QWidget
136 {
137  Q_OBJECT
138 
139  public:
140  explicit KateSchemaConfigHighlightTab(KateSchemaConfigDefaultStylesTab *page, KateSchemaConfigColorTab* colorTab);
141  ~KateSchemaConfigHighlightTab();
142 
143  void schemaChanged (const QString &schema);
144  void reload ();
145  void apply ();
146 
147  Q_SIGNALS:
148  void changed();
149 
150  protected Q_SLOTS:
151  void hlChanged(int z);
152 
153  public Q_SLOTS:
154  void exportHl(QString schema=QString(),int hl=-1,KConfig* cfg=0);
155  void importHl(const QString& fromSchemaName=QString(), QString schema=QString(), int hl=-1, KConfig *cfg=0);
156 
157  protected:
158  virtual void showEvent(QShowEvent* event);
159  void updateColorPalette(const QColor& textColor);
160 
161  private:
162  KateSchemaConfigDefaultStylesTab *m_defaults;
163  KateSchemaConfigColorTab* m_colorTab;
164 
165  KComboBox *hlCombo;
166  KateStyleTreeWidget *m_styles;
167 
168  QString m_schema;
169  int m_hl;
170 
171  QHash<QString, QHash<int, QList<KateExtendedAttribute::Ptr> > > m_hlDict;
172 
173 public:
174  QList<int> hlsForSchema(const QString &schema);
175  bool loadAllHlsForSchema(const QString &schema);
176 };
177 
178 class KateSchemaConfigPage : public KateConfigPage
179 {
180  Q_OBJECT
181 
182  public:
183  explicit KateSchemaConfigPage ( QWidget *parent);
184  virtual ~KateSchemaConfigPage ();
185 
186  public Q_SLOTS:
187  void apply();
188  void reload();
189  void reset();
190  void defaults();
191  void exportFullSchema();
192  void importFullSchema();
193 
194  private Q_SLOTS:
195  void deleteSchema ();
196  bool newSchema (const QString& newName = QString());
197  void schemaChanged (const QString &schema);
198  void comboBoxIndexChanged (int currentIndex);
199 
200  private:
201  void refillCombos(const QString& schemaName, const QString& defaultSchemaName);
202  QString requestSchemaName(const QString& suggestedName);
203 
204  private:
205  QString m_currentSchema;
206 
207  class KTabWidget *m_tabWidget;
208  class QPushButton *btndel;
209  class KComboBox *defaultSchemaCombo;
210  class KComboBox *schemaCombo;
211  KateSchemaConfigColorTab *m_colorTab;
212  KateSchemaConfigFontTab *m_fontTab;
213  KateSchemaConfigDefaultStylesTab *m_defaultStylesTab;
214  KateSchemaConfigHighlightTab *m_highlightTab;
215 };
216 
217 #endif
218 
219 // kate: space-indent on; indent-width 2; replace-tabs on;
KateSchemaConfigFontTab::changed
void changed()
KateSchemaConfigHighlightTab::KateSchemaConfigHighlightTab
KateSchemaConfigHighlightTab(KateSchemaConfigDefaultStylesTab *page, KateSchemaConfigColorTab *colorTab)
Definition: kateschemaconfig.cpp:562
KateSchemaConfigDefaultStylesTab::reload
void reload()
Definition: kateschemaconfig.cpp:521
QWidget
KateSchemaConfigColorTab
Definition: kateschemaconfig.h:39
KateSchemaConfigPage::reset
void reset()
Definition: kateschemaconfig.cpp:1207
KateSchemaConfigColorTab::selectionColor
QColor selectionColor() const
Definition: kateschemaconfig.cpp:379
KateSchemaConfigDefaultStylesTab::changed
void changed()
KateSchemaConfigColorTab::schemaChanged
void schemaChanged(const QString &newSchema)
Definition: kateschemaconfig.cpp:252
KateSchemaConfigHighlightTab::hlsForSchema
QList< int > hlsForSchema(const QString &schema)
Definition: kateschemaconfig.cpp:751
KateSchemaConfigDefaultStylesTab::schemaChanged
void schemaChanged(const QString &schema)
Definition: kateschemaconfig.cpp:497
KateSchemaConfigHighlightTab::showEvent
virtual void showEvent(QShowEvent *event)
Definition: kateschemaconfig.cpp:851
QFont
KateSchemaConfigFontTab::readConfig
void readConfig(KConfig *config)
KateSchemaConfigHighlightTab::importHl
void importHl(const QString &fromSchemaName=QString(), QString schema=QString(), int hl=-1, KConfig *cfg=0)
Definition: kateschemaconfig.cpp:756
KateSchemaConfigColorTab::exportSchema
void exportSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:320
QMap
KateSchemaConfigDefaultStylesTab::apply
void apply()
Definition: kateschemaconfig.cpp:530
KateSchemaConfigColorTab::apply
void apply()
Definition: kateschemaconfig.cpp:329
KateSchemaConfigPage::reload
void reload()
Definition: kateschemaconfig.cpp:1155
KateSchemaConfigHighlightTab::updateColorPalette
void updateColorPalette(const QColor &textColor)
Definition: kateschemaconfig.cpp:719
kateextendedattribute.h
KateSchemaConfigPage::exportFullSchema
void exportFullSchema()
Definition: kateschemaconfig.cpp:931
katedialogs.h
KateStyleTreeWidget
QTreeWidget that automatically adds columns for KateStyleListItems and provides a popup menu and a sl...
Definition: katestyletreewidget.h:36
KateSchemaConfigHighlightTab::reload
void reload()
Definition: kateschemaconfig.cpp:728
KateSchemaConfigFontTab::exportSchema
void exportSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:451
KateSchemaConfigFontTab::reload
void reload()
Definition: kateschemaconfig.cpp:418
KateSchemaConfigColorTab::changed
void changed()
KateSchemaConfigDefaultStylesTab::~KateSchemaConfigDefaultStylesTab
~KateSchemaConfigDefaultStylesTab()
Definition: kateschemaconfig.cpp:479
KateSchemaConfigHighlightTab::schemaChanged
void schemaChanged(const QString &schema)
Definition: kateschemaconfig.cpp:657
KateSchemaConfigHighlightTab::exportHl
void exportHl(QString schema=QString(), int hl=-1, KConfig *cfg=0)
Definition: kateschemaconfig.cpp:821
KateSchemaConfigDefaultStylesTab::attributeList
KateAttributeList * attributeList(const QString &schema)
Definition: kateschemaconfig.cpp:484
KateSchemaConfigDefaultStylesTab::updateColorPalette
void updateColorPalette(const QColor &textColor)
Definition: kateschemaconfig.cpp:512
KateSchemaConfigColorTab::~KateSchemaConfigColorTab
~KateSchemaConfigColorTab()
Definition: kateschemaconfig.cpp:69
KateSchemaConfigPage::~KateSchemaConfigPage
virtual ~KateSchemaConfigPage()
Definition: kateschemaconfig.cpp:927
KateSchemaConfigPage::defaults
void defaults()
Definition: kateschemaconfig.cpp:1212
QHash
QShowEvent
KateSchemaConfigDefaultStylesTab::showEvent
virtual void showEvent(QShowEvent *event)
Definition: kateschemaconfig.cpp:549
KateSchemaConfigFontTab::KateSchemaConfigFontTab
KateSchemaConfigFontTab()
Definition: kateschemaconfig.cpp:386
QString
QList
QColor
KateSchemaConfigHighlightTab::changed
void changed()
KateSchemaConfigPage
Definition: kateschemaconfig.h:178
katecolortreewidget.h
KateSchemaConfigHighlightTab::apply
void apply()
Definition: kateschemaconfig.cpp:737
KateSchemaConfigHighlightTab::hlChanged
void hlChanged(int z)
Definition: kateschemaconfig.cpp:632
QWidget::font
const QFont & font() const
KateColorTreeWidget
Definition: katecolortreewidget.h:44
KateSchemaConfigPage::KateSchemaConfigPage
KateSchemaConfigPage(QWidget *parent)
Definition: kateschemaconfig.cpp:864
KateSchemaConfigDefaultStylesTab
Definition: kateschemaconfig.h:104
KateSchemaConfigPage::importFullSchema
void importFullSchema()
Definition: kateschemaconfig.cpp:1037
KateSchemaConfigDefaultStylesTab::KateSchemaConfigDefaultStylesTab
KateSchemaConfigDefaultStylesTab(KateSchemaConfigColorTab *colorTab)
Definition: kateschemaconfig.cpp:458
KateSchemaConfigDefaultStylesTab::importSchema
void importSchema(const QString &schemaName, const QString &schema, KConfig *cfg)
Definition: kateschemaconfig.cpp:544
KateSchemaConfigFontTab::~KateSchemaConfigFontTab
~KateSchemaConfigFontTab()
Definition: kateschemaconfig.cpp:394
QVector
KateSchemaConfigHighlightTab::loadAllHlsForSchema
bool loadAllHlsForSchema(const QString &schema)
Definition: kateschemaconfig.cpp:638
KateConfigPage
Definition: katedialogs.h:94
KateSchemaConfigFontTab::schemaChanged
void schemaChanged(const QString &newSchema)
Definition: kateschemaconfig.cpp:427
KateSchemaConfigHighlightTab
Definition: kateschemaconfig.h:135
KateSchemaConfigFontTab
Definition: kateschemaconfig.h:73
QPushButton
KateSchemaConfigColorTab::KateSchemaConfigColorTab
KateSchemaConfigColorTab()
Definition: kateschemaconfig.cpp:51
KateSchemaConfigDefaultStylesTab::exportSchema
void exportSchema(const QString &schema, KConfig *cfg)
Definition: kateschemaconfig.cpp:539
KateSchemaConfigColorTab::backgroundColor
QColor backgroundColor() const
Definition: kateschemaconfig.cpp:374
KateSchemaConfigFontTab::importSchema
void importSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:444
QWidget::event
virtual bool event(QEvent *event)
KateSchemaConfigColorTab::importSchema
void importSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:307
KateSchemaConfigHighlightTab::~KateSchemaConfigHighlightTab
~KateSchemaConfigHighlightTab()
Definition: kateschemaconfig.cpp:628
KateSchemaConfigPage::apply
void apply()
Definition: kateschemaconfig.cpp:1123
KateSchemaConfigFontTab::apply
void apply()
Definition: kateschemaconfig.cpp:406
KateSchemaConfigColorTab::reload
void reload()
Definition: kateschemaconfig.cpp:356
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal