2009-03-20 14:57:12 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2009-03-16 11:08:07 +01:00
|
|
|
#ifndef GENERICPROJECTFILESEDITOR_H
|
|
|
|
|
#define GENERICPROJECTFILESEDITOR_H
|
|
|
|
|
|
|
|
|
|
#include <texteditor/basetexteditor.h>
|
|
|
|
|
#include <texteditor/basetextdocument.h>
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
|
|
|
|
|
2010-04-26 14:02:09 +02:00
|
|
|
namespace TextEditor {
|
|
|
|
|
class TextEditorActionHandler;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-16 11:08:07 +01:00
|
|
|
namespace GenericProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class Manager;
|
|
|
|
|
class ProjectFilesEditor;
|
2011-02-21 16:02:26 +01:00
|
|
|
class ProjectFilesEditorWidget;
|
2009-03-16 11:08:07 +01:00
|
|
|
class ProjectFilesDocument;
|
|
|
|
|
class ProjectFilesFactory;
|
|
|
|
|
|
|
|
|
|
class ProjectFilesFactory: public Core::IEditorFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ProjectFilesFactory(Manager *manager, TextEditor::TextEditorActionHandler *handler);
|
2010-01-29 21:33:57 +01:00
|
|
|
|
2009-03-16 11:08:07 +01:00
|
|
|
Manager *manager() const;
|
|
|
|
|
|
|
|
|
|
virtual Core::IEditor *createEditor(QWidget *parent);
|
|
|
|
|
|
|
|
|
|
virtual QStringList mimeTypes() const;
|
2010-01-07 18:17:24 +01:00
|
|
|
virtual QString id() const;
|
|
|
|
|
virtual QString displayName() const;
|
2009-03-16 11:08:07 +01:00
|
|
|
virtual Core::IFile *open(const QString &fileName);
|
|
|
|
|
|
|
|
|
|
private:
|
2009-03-18 12:18:59 +01:00
|
|
|
Manager *m_manager;
|
|
|
|
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
|
|
|
|
QStringList m_mimeTypes;
|
2009-03-16 11:08:07 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-21 16:02:26 +01:00
|
|
|
class ProjectFilesEditor : public TextEditor::BaseTextEditor
|
2009-03-16 11:08:07 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-02-21 16:02:26 +01:00
|
|
|
ProjectFilesEditor(ProjectFilesEditorWidget *editorWidget);
|
2009-03-16 11:08:07 +01:00
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
virtual QString id() const;
|
2009-03-16 11:08:07 +01:00
|
|
|
virtual bool duplicateSupported() const;
|
|
|
|
|
virtual Core::IEditor *duplicate(QWidget *parent);
|
2009-06-04 12:02:19 +02:00
|
|
|
virtual bool isTemporary() const { return false; }
|
2009-03-16 11:08:07 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-21 16:02:26 +01:00
|
|
|
class ProjectFilesEditorWidget : public TextEditor::BaseTextEditorWidget
|
2009-03-16 11:08:07 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-02-21 16:02:26 +01:00
|
|
|
ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory,
|
2009-03-16 11:08:07 +01:00
|
|
|
TextEditor::TextEditorActionHandler *handler);
|
2011-02-21 16:02:26 +01:00
|
|
|
virtual ~ProjectFilesEditorWidget();
|
2009-03-16 11:08:07 +01:00
|
|
|
|
|
|
|
|
ProjectFilesFactory *factory() const;
|
|
|
|
|
TextEditor::TextEditorActionHandler *actionHandler() const;
|
|
|
|
|
|
2011-02-21 16:02:26 +01:00
|
|
|
virtual TextEditor::BaseTextEditor *createEditor();
|
2009-03-16 11:08:07 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-03-18 12:18:59 +01:00
|
|
|
ProjectFilesFactory *m_factory;
|
|
|
|
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
2009-03-16 11:08:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ProjectFilesDocument: public TextEditor::BaseTextDocument
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ProjectFilesDocument(Manager *manager);
|
|
|
|
|
virtual ~ProjectFilesDocument();
|
|
|
|
|
|
|
|
|
|
virtual bool save(const QString &name);
|
|
|
|
|
|
|
|
|
|
private:
|
2009-03-18 12:18:59 +01:00
|
|
|
Manager *m_manager;
|
2009-03-16 11:08:07 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-04 09:52:39 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace GenericProjectManager
|
2009-03-16 11:08:07 +01:00
|
|
|
|
|
|
|
|
#endif // GENERICPROJECTFILESEDITOR_H
|