1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
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.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef DesignDocumentController_h
34 #define DesignDocumentController_h
36 #include "rewriterview.h"
38 #include <QtCore/QObject>
39 #include <QtCore/QString>
47 class QDeclarativeError;
50 namespace QmlDesigner {
57 class ItemLibraryView;
59 class AllPropertiesBox;
60 class StatesEditorView;
63 class DesignDocumentController: public QObject
68 DesignDocumentController(QObject *parent);
69 ~DesignDocumentController();
71 QString displayName() const;
72 QString fileName() const;
73 void setFileName(const QString &fileName);
75 QList<RewriterView::Error> loadMaster(QPlainTextEdit *edit);
76 QList<RewriterView::Error> loadMaster(const QByteArray &qml);
77 void loadCurrentModel();
81 bool isUndoAvailable() const;
82 bool isRedoAvailable() const;
85 Model *masterModel() const;
87 RewriterView *rewriterView() const;
89 bool isModelSyncBlocked() const;
90 void blockModelSync(bool block);
92 QString contextHelpId() const;
93 QList<RewriterView::Error> qmlErrors() const;
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);
103 void displayNameChanged(const QString &newFileName);
104 void dirtyStateChanged(bool newState);
106 void undoAvailable(bool isAvailable);
107 void redoAvailable(bool isAvailable);
108 void designDocumentClosed();
109 void qmlErrorsChanged(const QList<RewriterView::Error> &errors);
111 void fileToOpen(const QString &path);
114 bool save(QWidget *parent = 0);
115 void saveAs(QWidget *parent = 0);
116 void deleteSelected();
124 #ifdef ENABLE_TEXT_VIEW
127 #endif // ENABLE_TEXT_VIEW
130 void doRealSaveAs(const QString &fileName);
131 void showError(const QString &message, QWidget *parent = 0) const;
132 void changeCurrentModelTo(const ModelNode &node);
135 void detachNodeInstanceView();
136 void attachNodeInstanceView();
137 QWidget *centralWidget() const;
138 class DesignDocumentControllerPrivate *m_d;
139 bool save(QIODevice *device, QString *errorMessage);
142 } // namespace QmlDesigner
144 #endif // DesignDocumentController_h