OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / include / model.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 DESIGNERMODEL_H
35 #define DESIGNERMODEL_H
36
37 #include <corelib_global.h>
38 #include <QtCore/QObject>
39 #include <QtCore/QMimeData>
40 #include <QtCore/QPair>
41 #include <QtDeclarative/QDeclarativeError>
42
43 #include <import.h>
44
45 QT_BEGIN_NAMESPACE
46 class QUrl;
47 QT_END_NAMESPACE
48
49 namespace QmlDesigner {
50
51 namespace Internal {
52     class ModelPrivate;
53 }
54
55 class AnchorLine;
56 class ModelNode;
57 class NodeState;
58 class AbstractView;
59 class WidgetQueryView;
60 class NodeStateChangeSet;
61 class MetaInfo;
62 class NodeMetaInfo;
63 class ModelState;
64 class NodeAnchors;
65 class AbstractProperty;
66 class RewriterView;
67
68 typedef QList<QPair<QString, QVariant> > PropertyListType;
69
70 class CORESHARED_EXPORT Model : public QObject
71 {
72     friend class QmlDesigner::ModelNode;
73     friend class QmlDesigner::NodeState;
74     friend class QmlDesigner::ModelState;
75     friend class QmlDesigner::NodeAnchors;
76     friend class QmlDesigner::AbstractProperty;
77     friend class QmlDesigner::AbstractView;
78     friend class Internal::ModelPrivate;
79
80     Q_DISABLE_COPY(Model)
81     Q_OBJECT
82 public:
83     enum ViewNotification { NotifyView, DoNotNotifyView };
84
85     virtual ~Model();
86
87     static Model *create(QString type, int major = 4, int minor = 7);
88
89     Model *masterModel() const;
90     void setMasterModel(Model *model);
91
92     QUrl fileUrl() const;
93     void setFileUrl(const QUrl &url);
94
95     const MetaInfo metaInfo() const;
96     MetaInfo metaInfo();
97     NodeMetaInfo metaInfo(const QString &typeName, int majorVersion = -1, int minorVersion = -1);
98     void setMetaInfo(const MetaInfo &metaInfo);
99
100     void attachView(AbstractView *view);
101     void detachView(AbstractView *view, ViewNotification emitDetachNotify = NotifyView);
102
103     // Editing sub-components:
104
105     // Imports:
106     QList<Import> imports() const;
107     void addImport(const Import &import);
108     void removeImport(const Import &import);
109
110     RewriterView *rewriterView() const;
111
112 protected:
113     Model();
114
115 public:
116     Internal::ModelPrivate *m_d;
117 };
118
119 }
120
121 #endif // DESIGNERMODEL_H