OSDN Git Service

Implement adding new project into opened subdirs project
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmlprojectmanager / qmlprojectnodes.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** Commercial Usage
10 **
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
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 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
27 **
28 **************************************************************************/
29
30 #ifndef QMLPROJECTNODES_H
31 #define QMLPROJECTNODES_H
32
33 #include <projectexplorer/projectnodes.h>
34
35 #include <QStringList>
36 #include <QHash>
37
38 namespace Core {
39 class IFile;
40 }
41
42 namespace QmlProjectManager {
43
44 class QmlProject;
45
46 namespace Internal {
47
48 class QmlProjectNode : public ProjectExplorer::ProjectNode
49 {
50 public:
51     QmlProjectNode(QmlProject *project, Core::IFile *projectFile);
52     virtual ~QmlProjectNode();
53
54     Core::IFile *projectFile() const;
55     QString projectFilePath() const;
56
57     virtual bool hasBuildTargets() const;
58
59     virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
60
61     virtual bool canAddSubProject(const QString &proFilePath) const;
62
63     virtual bool addSubProjects(const QStringList &proFilePaths);
64     virtual bool removeSubProjects(const QStringList &proFilePaths);
65
66     virtual bool addFiles(const ProjectExplorer::FileType fileType,
67                           const QStringList &filePaths,
68                           QStringList *notAdded = 0);
69
70     virtual bool removeFiles(const ProjectExplorer::FileType fileType,
71                              const QStringList &filePaths,
72                              QStringList *notRemoved = 0);
73
74     virtual bool deleteFiles(const ProjectExplorer::FileType fileType,
75                              const QStringList &filePaths);
76
77     virtual bool renameFile(const ProjectExplorer::FileType fileType,
78                              const QString &filePath,
79                              const QString &newFilePath);
80
81
82     void refresh();
83
84 private:
85     FolderNode *findOrCreateFolderByName(const QString &filePath);
86     FolderNode *findOrCreateFolderByName(const QStringList &components, int end);
87
88 private:
89     QmlProject *m_project;
90     Core::IFile *m_projectFile;
91     QHash<QString, FolderNode *> m_folderByName;
92 };
93
94 } // namespace Internal
95 } // namespace QmlProjectManager
96
97 #endif // QMLPROJECTNODES_H