OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / components / integration / designdocumentcontroller.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 (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef DesignDocumentController_h
34 #define DesignDocumentController_h
35
36 #include "rewriterview.h"
37
38 #include <QtCore/QObject>
39 #include <QtCore/QString>
40
41 QT_BEGIN_NAMESPACE
42 class QUndoStack;
43 class QWidget;
44 class QIODevice;
45 class QProcess;
46 class QPlainTextEdit;
47 class QDeclarativeError;
48 QT_END_NAMESPACE
49
50 namespace QmlDesigner {
51
52 class Model;
53 class ModelNode;
54 class TextModifier;
55 class QmlObjectNode;
56 class RewriterView;
57 class ItemLibraryView;
58 class NavigatorView;
59 class AllPropertiesBox;
60 class StatesEditorView;
61 class FormEditorView;
62
63 class DesignDocumentController: public QObject
64 {
65     Q_OBJECT
66
67 public:
68     DesignDocumentController(QObject *parent);
69     ~DesignDocumentController();
70
71     QString displayName() const;
72     QString fileName() const;
73     void setFileName(const QString &fileName);
74
75     QList<RewriterView::Error> loadMaster(QPlainTextEdit *edit);
76     QList<RewriterView::Error> loadMaster(const QByteArray &qml);
77     void loadCurrentModel();
78     void close();
79
80     bool isDirty() const;
81     bool isUndoAvailable() const;
82     bool isRedoAvailable() const;
83
84     Model *model() const;
85     Model *masterModel() const;
86
87     RewriterView *rewriterView() const;
88
89     bool isModelSyncBlocked() const;
90     void blockModelSync(bool block);
91
92     QString contextHelpId() const;
93     QList<RewriterView::Error> qmlErrors() const;
94
95     void setItemLibraryView(ItemLibraryView* itemLibraryView);
96     void setNavigator(NavigatorView* navigatorView);
97     void setAllPropertiesBox(AllPropertiesBox* allPropertiesBox);
98     void setStatesEditorView(StatesEditorView* statesEditorView);
99     void setFormEditorView(FormEditorView *formEditorView);
100     void setNodeInstanceView(NodeInstanceView *nodeInstanceView);
101
102 signals:
103     void displayNameChanged(const QString &newFileName);
104     void dirtyStateChanged(bool newState);
105
106     void undoAvailable(bool isAvailable);
107     void redoAvailable(bool isAvailable);
108     void designDocumentClosed();
109     void qmlErrorsChanged(const QList<RewriterView::Error> &errors);
110
111     void fileToOpen(const QString &path);
112
113 public slots:
114     bool save(QWidget *parent = 0);
115     void saveAs(QWidget *parent = 0);
116     void deleteSelected();
117     void copySelected();
118     void cutSelected();
119     void paste();
120     void selectAll();
121     void undo();
122     void redo();
123
124 #ifdef ENABLE_TEXT_VIEW
125     void showText();
126     void showForm();
127 #endif // ENABLE_TEXT_VIEW
128
129 private slots:
130     void doRealSaveAs(const QString &fileName);
131     void showError(const QString &message, QWidget *parent = 0) const;
132     void changeCurrentModelTo(const ModelNode &node);
133
134 private:
135     void detachNodeInstanceView();
136     void attachNodeInstanceView();
137     QWidget *centralWidget() const;
138     class DesignDocumentControllerPrivate *m_d;
139     bool save(QIODevice *device, QString *errorMessage);
140 };
141
142 } // namespace QmlDesigner
143
144 #endif // DesignDocumentController_h