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

Kate

  • sources
  • kde-4.12
  • 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()
QColor
KateSchemaConfigHighlightTab::KateSchemaConfigHighlightTab
KateSchemaConfigHighlightTab(KateSchemaConfigDefaultStylesTab *page, KateSchemaConfigColorTab *colorTab)
Definition: kateschemaconfig.cpp:583
KateSchemaConfigDefaultStylesTab::reload
void reload()
Definition: kateschemaconfig.cpp:542
KateSchemaConfigColorTab
Definition: kateschemaconfig.h:39
KateSchemaConfigPage::reset
void reset()
Definition: kateschemaconfig.cpp:1228
KateSchemaConfigColorTab::selectionColor
QColor selectionColor() const
Definition: kateschemaconfig.cpp:400
KateSchemaConfigDefaultStylesTab::changed
void changed()
KateSchemaConfigColorTab::schemaChanged
void schemaChanged(const QString &newSchema)
Definition: kateschemaconfig.cpp:273
KateSchemaConfigHighlightTab::hlsForSchema
QList< int > hlsForSchema(const QString &schema)
Definition: kateschemaconfig.cpp:772
KateSchemaConfigDefaultStylesTab::schemaChanged
void schemaChanged(const QString &schema)
Definition: kateschemaconfig.cpp:518
KateSchemaConfigHighlightTab::showEvent
virtual void showEvent(QShowEvent *event)
Definition: kateschemaconfig.cpp:872
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:777
KateSchemaConfigColorTab::exportSchema
void exportSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:341
kconfig.h
QWidget
KateSchemaConfigDefaultStylesTab::apply
void apply()
Definition: kateschemaconfig.cpp:551
KateSchemaConfigColorTab::apply
void apply()
Definition: kateschemaconfig.cpp:350
QPushButton
KateSchemaConfigPage::reload
void reload()
Definition: kateschemaconfig.cpp:1176
KateSchemaConfigHighlightTab::updateColorPalette
void updateColorPalette(const QColor &textColor)
Definition: kateschemaconfig.cpp:740
kateextendedattribute.h
KateSchemaConfigPage::exportFullSchema
void exportFullSchema()
Definition: kateschemaconfig.cpp:952
QString
QHash
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:749
KateSchemaConfigFontTab::exportSchema
void exportSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:472
config
KSharedConfigPtr config()
KateSchemaConfigFontTab::reload
void reload()
Definition: kateschemaconfig.cpp:439
KateSchemaConfigColorTab::changed
void changed()
KateSchemaConfigDefaultStylesTab::~KateSchemaConfigDefaultStylesTab
~KateSchemaConfigDefaultStylesTab()
Definition: kateschemaconfig.cpp:500
KateSchemaConfigHighlightTab::schemaChanged
void schemaChanged(const QString &schema)
Definition: kateschemaconfig.cpp:678
KateSchemaConfigHighlightTab::exportHl
void exportHl(QString schema=QString(), int hl=-1, KConfig *cfg=0)
Definition: kateschemaconfig.cpp:842
KateSchemaConfigDefaultStylesTab::attributeList
KateAttributeList * attributeList(const QString &schema)
Definition: kateschemaconfig.cpp:505
KateSchemaConfigDefaultStylesTab::updateColorPalette
void updateColorPalette(const QColor &textColor)
Definition: kateschemaconfig.cpp:533
KateSchemaConfigColorTab::~KateSchemaConfigColorTab
~KateSchemaConfigColorTab()
Definition: kateschemaconfig.cpp:68
KateSchemaConfigPage::~KateSchemaConfigPage
virtual ~KateSchemaConfigPage()
Definition: kateschemaconfig.cpp:948
KateSchemaConfigPage::defaults
void defaults()
Definition: kateschemaconfig.cpp:1233
KateSchemaConfigDefaultStylesTab::showEvent
virtual void showEvent(QShowEvent *event)
Definition: kateschemaconfig.cpp:570
KateSchemaConfigFontTab::KateSchemaConfigFontTab
KateSchemaConfigFontTab()
Definition: kateschemaconfig.cpp:407
KateSchemaConfigHighlightTab::changed
void changed()
KateSchemaConfigPage
Definition: kateschemaconfig.h:178
katecolortreewidget.h
KateSchemaConfigHighlightTab::apply
void apply()
Definition: kateschemaconfig.cpp:758
KateSchemaConfigHighlightTab::hlChanged
void hlChanged(int z)
Definition: kateschemaconfig.cpp:653
KateColorTreeWidget
Definition: katecolortreewidget.h:44
KateSchemaConfigPage::KateSchemaConfigPage
KateSchemaConfigPage(QWidget *parent)
Definition: kateschemaconfig.cpp:885
KConfigGroup
KateSchemaConfigDefaultStylesTab
Definition: kateschemaconfig.h:104
QFont
KConfig
KateSchemaConfigPage::importFullSchema
void importFullSchema()
Definition: kateschemaconfig.cpp:1058
KateSchemaConfigDefaultStylesTab::KateSchemaConfigDefaultStylesTab
KateSchemaConfigDefaultStylesTab(KateSchemaConfigColorTab *colorTab)
Definition: kateschemaconfig.cpp:479
KateSchemaConfigDefaultStylesTab::importSchema
void importSchema(const QString &schemaName, const QString &schema, KConfig *cfg)
Definition: kateschemaconfig.cpp:565
KFontChooser
KateSchemaConfigFontTab::~KateSchemaConfigFontTab
~KateSchemaConfigFontTab()
Definition: kateschemaconfig.cpp:415
KateSchemaConfigHighlightTab::loadAllHlsForSchema
bool loadAllHlsForSchema(const QString &schema)
Definition: kateschemaconfig.cpp:659
KateConfigPage
Definition: katedialogs.h:92
KateSchemaConfigFontTab::schemaChanged
void schemaChanged(const QString &newSchema)
Definition: kateschemaconfig.cpp:448
KComboBox
KateSchemaConfigHighlightTab
Definition: kateschemaconfig.h:135
KateSchemaConfigFontTab
Definition: kateschemaconfig.h:73
KateSchemaConfigColorTab::KateSchemaConfigColorTab
KateSchemaConfigColorTab()
Definition: kateschemaconfig.cpp:50
KateSchemaConfigDefaultStylesTab::exportSchema
void exportSchema(const QString &schema, KConfig *cfg)
Definition: kateschemaconfig.cpp:560
KateSchemaConfigColorTab::backgroundColor
QColor backgroundColor() const
Definition: kateschemaconfig.cpp:395
KateSchemaConfigFontTab::importSchema
void importSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:465
KateSchemaConfigColorTab::importSchema
void importSchema(KConfigGroup &config)
Definition: kateschemaconfig.cpp:328
KFontChooser::font
QFont font() const
KateSchemaConfigHighlightTab::~KateSchemaConfigHighlightTab
~KateSchemaConfigHighlightTab()
Definition: kateschemaconfig.cpp:649
KateSchemaConfigPage::apply
void apply()
Definition: kateschemaconfig.cpp:1144
QMap
KateSchemaConfigFontTab::apply
void apply()
Definition: kateschemaconfig.cpp:427
QList
KateSchemaConfigColorTab::reload
void reload()
Definition: kateschemaconfig.cpp:377
KTabWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:52 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
  • Applications
  •   Libraries
  •     libkonq
  • 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