OSDN Git Service

f4737413c593449cc3725662f237adbd3e4f28e9
[qt-creator-jp/qt-creator-jp.git] / src / plugins / genericprojectmanager / genericprojectfileseditor.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef GENERICPROJECTFILESEDITOR_H
35 #define GENERICPROJECTFILESEDITOR_H
36
37 #include <texteditor/basetexteditor.h>
38 #include <texteditor/basetextdocument.h>
39
40 #include <coreplugin/editormanager/ieditorfactory.h>
41
42 namespace TextEditor {
43 class TextEditorActionHandler;
44 }
45
46 namespace GenericProjectManager {
47 namespace Internal {
48
49 class Manager;
50 class ProjectFilesEditor;
51 class ProjectFilesEditorWidget;
52 class ProjectFilesDocument;
53 class ProjectFilesFactory;
54
55 class ProjectFilesFactory: public Core::IEditorFactory
56 {
57     Q_OBJECT
58
59 public:
60     ProjectFilesFactory(Manager *manager, TextEditor::TextEditorActionHandler *handler);
61     virtual ~ProjectFilesFactory();
62
63     Manager *manager() const;
64
65     virtual Core::IEditor *createEditor(QWidget *parent);
66
67     virtual QStringList mimeTypes() const;
68     virtual QString id() const;
69     virtual QString displayName() const;
70     virtual Core::IFile *open(const QString &fileName);
71
72 private:
73     Manager *m_manager;
74     TextEditor::TextEditorActionHandler *m_actionHandler;
75     QStringList m_mimeTypes;
76 };
77
78 class ProjectFilesEditor : public TextEditor::BaseTextEditor
79 {
80     Q_OBJECT
81
82 public:
83     ProjectFilesEditor(ProjectFilesEditorWidget *editorWidget);
84     virtual ~ProjectFilesEditor();
85
86     virtual Core::Context context() const;
87     virtual QString id() const;
88
89     virtual bool duplicateSupported() const;
90     virtual Core::IEditor *duplicate(QWidget *parent);
91
92     virtual bool isTemporary() const { return false; }
93
94 private:
95     Core::Context m_context;
96 };
97
98 class ProjectFilesEditorWidget : public TextEditor::BaseTextEditorWidget
99 {
100     Q_OBJECT
101
102 public:
103     ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory,
104                        TextEditor::TextEditorActionHandler *handler);
105     virtual ~ProjectFilesEditorWidget();
106
107     ProjectFilesFactory *factory() const;
108     TextEditor::TextEditorActionHandler *actionHandler() const;
109
110     virtual TextEditor::BaseTextEditor *createEditor();
111
112 private:
113     ProjectFilesFactory *m_factory;
114     TextEditor::TextEditorActionHandler *m_actionHandler;
115 };
116
117 class ProjectFilesDocument: public TextEditor::BaseTextDocument
118 {
119     Q_OBJECT
120
121 public:
122     ProjectFilesDocument(Manager *manager);
123     virtual ~ProjectFilesDocument();
124
125     virtual bool save(const QString &name);
126
127 private:
128     Manager *m_manager;
129 };
130
131 } // namespace Internal
132 } // namespace GenericProjectManager
133
134 #endif // GENERICPROJECTFILESEDITOR_H