Kate
kateschema.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KATE_SCHEMA_H__
00021 #define __KATE_SCHEMA_H__
00022
00023 #include "katehighlight.h"
00024 #include "katedialogs.h"
00025
00026 #include <QtCore/QStringList>
00027 #include <QtCore/QMap>
00028 #include <QtGui/QFont>
00029
00030 #include <kconfig.h>
00031 #include <kaction.h>
00032
00033 class KateView;
00034 class KateStyleTreeWidget;
00035
00036
00037 class QAction;
00038 class QActionGroup;
00039 class QComboBox;
00040
00041 namespace Ui { class SchemaConfigColorTab; }
00042
00043 class KateSchemaManager
00044 {
00045 public:
00046 KateSchemaManager ();
00047 ~KateSchemaManager ();
00048
00052 void update (bool readfromfile = true);
00053
00057 KConfigGroup schema (uint number);
00058
00059 void addSchema (const QString &t);
00060
00061 void removeSchema (uint number);
00062
00066 bool validSchema (uint number);
00067 bool validSchema (const QString &name);
00068
00072 uint number (const QString &name);
00073
00077 QString name (uint number);
00078
00082 const QStringList &list () { return m_schemas; }
00083
00084 static QString normalSchema ();
00085 static QString printingSchema ();
00086
00087 private:
00088 KConfig m_config;
00089 QStringList m_schemas;
00090 };
00091
00092
00093 class KateViewSchemaAction : public KActionMenu
00094 {
00095 Q_OBJECT
00096
00097 public:
00098 KateViewSchemaAction(const QString& text, QObject *parent)
00099 : KActionMenu(text, parent) { init(); }
00100
00101 void updateMenu (KateView *view);
00102
00103 private:
00104 void init();
00105
00106 QPointer<KateView> m_view;
00107 QStringList names;
00108 QActionGroup *m_group;
00109 int last;
00110
00111 public Q_SLOTS:
00112 void slotAboutToShow();
00113
00114 private Q_SLOTS:
00115 void setSchema();
00116 };
00117
00118
00119
00120
00121
00122 class KateSchemaConfigColorTab : public QWidget
00123 {
00124 Q_OBJECT
00125
00126 public:
00127 KateSchemaConfigColorTab();
00128 ~KateSchemaConfigColorTab();
00129
00130 private:
00131
00132 class SchemaColors {
00133 public:
00134 QColor back, selected, current, bracket, wwmarker, iconborder, tmarker, linenumber;
00135 QMap<int, QColor> markerColors;
00136 QMap<int, QColor> templateColors;
00137 };
00138
00139
00140 QMap<int,SchemaColors> m_schemas;
00141
00142 int m_schema;
00143
00144 Ui::SchemaConfigColorTab* ui;
00145
00146 public Q_SLOTS:
00147 void apply();
00148 void schemaChanged( int newSchema );
00149
00150 Q_SIGNALS:
00151 void changed();
00152
00153 protected Q_SLOTS:
00154 void slotMarkerColorChanged(const QColor&);
00155 void slotComboBoxChanged(int index);
00156 };
00157
00158 typedef QMap<int,QFont> FontMap;
00159
00160 class KateSchemaConfigFontTab : public QWidget
00161 {
00162 Q_OBJECT
00163
00164 public:
00165 KateSchemaConfigFontTab();
00166 ~KateSchemaConfigFontTab();
00167
00168 public:
00169 void readConfig (KConfig *config);
00170
00171 public Q_SLOTS:
00172 void apply();
00173 void schemaChanged( int newSchema );
00174
00175 Q_SIGNALS:
00176 void changed();
00177
00178 private:
00179 class KFontChooser *m_fontchooser;
00180 FontMap m_fonts;
00181 int m_schema;
00182
00183 private Q_SLOTS:
00184 void slotFontSelected( const QFont &font );
00185 };
00186
00187 class KateSchemaConfigFontColorTab : public QWidget
00188 {
00189 Q_OBJECT
00190
00191 public:
00192 KateSchemaConfigFontColorTab();
00193 ~KateSchemaConfigFontColorTab();
00194
00195 Q_SIGNALS:
00196 void changed();
00197
00198 public:
00199 void schemaChanged (uint schema);
00200 void reload ();
00201 void apply ();
00202
00203 KateAttributeList *attributeList (uint schema);
00204
00205 private:
00206 KateStyleTreeWidget* m_defaultStyles;
00207 QHash<int,KateAttributeList*> m_defaultStyleLists;
00208 };
00209
00210 class KateSchemaConfigHighlightTab : public QWidget
00211 {
00212 Q_OBJECT
00213
00214 public:
00215 explicit KateSchemaConfigHighlightTab(KateSchemaConfigFontColorTab *page = 0, uint hl = 0 );
00216 ~KateSchemaConfigHighlightTab();
00217
00218 void schemaChanged (int schema);
00219 void reload ();
00220 void apply ();
00221
00222 Q_SIGNALS:
00223 void changed();
00224
00225 protected Q_SLOTS:
00226 void hlChanged(int z);
00227
00228 private:
00229 KateSchemaConfigFontColorTab *m_defaults;
00230
00231 QComboBox *hlCombo;
00232 KateStyleTreeWidget *m_styles;
00233
00234 int m_schema;
00235 int m_hl;
00236
00237 QHash<int, QHash<int, QList<KateExtendedAttribute::Ptr> > > m_hlDict;
00238 };
00239
00240 class KateSchemaConfigPage : public KateConfigPage
00241 {
00242 Q_OBJECT
00243
00244 public:
00245 explicit KateSchemaConfigPage ( QWidget *parent, class KateDocument *doc=0 );
00246 ~KateSchemaConfigPage ();
00247
00248 public Q_SLOTS:
00249 void apply();
00250 void reload();
00251 void reset();
00252 void defaults();
00253
00254 private Q_SLOTS:
00255 void update ();
00256 void deleteSchema ();
00257 void newSchema ();
00258 void schemaChanged (int schema);
00259
00260 void newCurrentPage(int);
00261
00262 private:
00263 int m_lastSchema;
00264 int m_defaultSchema;
00265
00266 class QTabWidget *m_tabWidget;
00267 class QPushButton *btndel;
00268 class QComboBox *defaultSchemaCombo;
00269 class QComboBox *schemaCombo;
00270 KateSchemaConfigColorTab *m_colorTab;
00271 KateSchemaConfigFontTab *m_fontTab;
00272 KateSchemaConfigFontColorTab *m_fontColorTab;
00273 KateSchemaConfigHighlightTab *m_highlightTab;
00274 };
00275
00276 #endif
00277
00278