QCodeEdit  2.2
qeditorfactory.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
4 **
5 ** This file is part of the Edyuk project <http://edyuk.org>
6 **
7 ** This file may be used under the terms of the GNU General Public License
8 ** version 3 as published by the Free Software Foundation and appearing in the
9 ** file GPL.txt included in the packaging of this file.
10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 **
14 ****************************************************************************/
15 
16 #ifndef _QEDITOR_FACTORY_H_
17 #define _QEDITOR_FACTORY_H_
18 
19 #include "qce-config.h"
20 
26 #ifdef _QSAFE_SHARED_SETTINGS_
27 
28 #ifndef _QMDI_
29  #define Q_EDITOR_FACTORY_BASE QObject
30  #define Q_EDITOR_FACTORY_EMIT(client)
31 #else
32  #include "qmdiclientfactory.h"
33 
34  #define Q_EDITOR_FACTORY_BASE qmdiClientFactory
35  #define Q_EDITOR_FACTORY_EMIT(client) emit clientCreated(client);
36 #endif
37 
38 #include "qsettingsclient.h"
39 
40 #include <QStringList>
41 
42 class QEditor;
43 class QCodeEdit;
44 class QFormatScheme;
45 class QLanguageFactory;
48 class QEditorConfiguration;
49 
50 class QCE_EXPORT QEditorFactory : public Q_EDITOR_FACTORY_BASE, public QSettingsClient
51 {
52  Q_OBJECT
53 
54  public:
55  QEditorFactory(QSettingsServer *s);
56  virtual ~QEditorFactory();
57 
58  inline QFormatScheme* defaultFormatScheme() const
59  { return m_defaultScheme; }
60 
61  inline QLanguageFactory* languageFactory() const
62  { return m_languageFactory; }
63 
64  virtual qmdiClient* createClient(const QString& filename) const;
65 
66  QCodeEdit* editor( const QString& file,
67  const QString& layout = QString()) const;
68 
69  QCodeEdit* editor( const QString& file,
71  QFormatScheme *s = 0,
72  QCodeCompletionEngine *e = 0,
73  const QString& layout = QString()) const;
74 
75  QString defaultLayout() const;
76  QString layout(const QString& alias) const;
77  void registerLayout(const QString& alias, const QString& layout);
78 
79  QSettingsClient settings(const QString& alias);
80 
81  signals:
82  void fileSaved(const QString& f);
83 
84  private slots:
85  void saved(QEditor *e, const QString& f);
86  void loaded(QEditor *e, const QString& f);
87 
88  private:
89  QEditorConfiguration *m_config;
90 
91  QFormatScheme *m_defaultScheme;
92  QLanguageFactory *m_languageFactory;
93 };
94 
95 #endif // _QSAFE_SHARED_SETTINGS_
96 
97 #endif // ! _QEDITOR_FACTORY_H_