QCodeEdit 2.2
lib/qeditorfactory.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
00004 **
00005 ** This file is part of the Edyuk project <http://edyuk.org>
00006 ** 
00007 ** This file may be used under the terms of the GNU General Public License
00008 ** version 3 as published by the Free Software Foundation and appearing in the
00009 ** file GPL.txt included in the packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ****************************************************************************/
00015 
00016 #ifndef _QEDITOR_FACTORY_H_
00017 #define _QEDITOR_FACTORY_H_
00018 
00019 #include "qce-config.h"
00020 
00026 #ifdef _QSAFE_SHARED_SETTINGS_
00027 
00028 #ifndef _QMDI_
00029     #define Q_EDITOR_FACTORY_BASE QObject
00030     #define Q_EDITOR_FACTORY_EMIT(client)
00031 #else
00032     #include "qmdiclientfactory.h"
00033     
00034     #define Q_EDITOR_FACTORY_BASE qmdiClientFactory
00035     #define Q_EDITOR_FACTORY_EMIT(client) emit clientCreated(client);
00036 #endif
00037 
00038 #include "qsettingsclient.h"
00039 
00040 #include <QStringList>
00041 
00042 class QEditor;
00043 class QCodeEdit;
00044 class QFormatScheme;
00045 class QLanguageFactory;
00046 class QCodeCompletionEngine;
00047 class QLanguageDefinition;
00048 class QEditorConfiguration;
00049 
00050 class QCE_EXPORT QEditorFactory : public Q_EDITOR_FACTORY_BASE, public QSettingsClient
00051 {
00052     Q_OBJECT
00053     
00054     public:
00055         QEditorFactory(QSettingsServer *s);
00056         virtual ~QEditorFactory();
00057         
00058         inline QFormatScheme* defaultFormatScheme() const
00059         { return m_defaultScheme; }
00060         
00061         inline QLanguageFactory* languageFactory() const
00062         { return m_languageFactory; }
00063         
00064         virtual qmdiClient* createClient(const QString& filename) const;
00065         
00066         QCodeEdit* editor(  const QString& file,
00067                             const QString& layout = QString()) const;
00068         
00069         QCodeEdit* editor(  const QString& file,
00070                             QLanguageDefinition *l,
00071                             QFormatScheme *s = 0,
00072                             QCodeCompletionEngine *e = 0,
00073                             const QString& layout = QString()) const;
00074         
00075         QString defaultLayout() const;
00076         QString layout(const QString& alias) const;
00077         void registerLayout(const QString& alias, const QString& layout);
00078         
00079         QSettingsClient settings(const QString& alias);
00080         
00081     signals:
00082         void fileSaved(const QString& f);
00083         
00084     private slots:
00085         void saved(QEditor *e, const QString& f);
00086         void loaded(QEditor *e, const QString& f);
00087         
00088     private:
00089         QEditorConfiguration *m_config;
00090         
00091         QFormatScheme *m_defaultScheme;
00092         QLanguageFactory *m_languageFactory;
00093 };
00094 
00095 #endif // _QSAFE_SHARED_SETTINGS_
00096 
00097 #endif // ! _QEDITOR_FACTORY_H_