/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #ifndef DESIGNMODEWIDGET_H #define DESIGNMODEWIDGET_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QStackedWidget; class QTabWidget; class QVBoxLayout; class QToolButton; QT_END_NAMESPACE namespace Core { class SideBar; class SideBarItem; class OpenEditorsModel; class EditorToolBar; class OutputPanePlaceHolder; } namespace QmlDesigner { class ItemLibraryWidget; namespace Internal { class DesignMode; class DocumentWidget; class DesignModeWidget; class DocumentWarningWidget : public Utils::FakeToolTip { Q_OBJECT Q_DISABLE_COPY(DocumentWarningWidget) public: explicit DocumentWarningWidget(DesignModeWidget *parent = 0); void setError(const RewriterView::Error &error); private slots: void goToError(); private: QLabel *m_errorMessage; QLabel *m_goToError; RewriterView::Error m_error; DesignModeWidget *m_designModeWidget; }; class DesignModeWidget : public QWidget { Q_OBJECT Q_DISABLE_COPY(DesignModeWidget) public: explicit DesignModeWidget(QWidget *parent = 0); ~DesignModeWidget(); void showEditor(Core::IEditor *editor); void closeEditors(const QList editors); QString contextHelpId() const; QAction *undoAction() const; QAction *redoAction() const; QAction *deleteAction() const; QAction *cutAction() const; QAction *copyAction() const; QAction *pasteAction() const; QAction *selectAllAction() const; QAction *hideSidebarsAction() const; QAction *toggleLeftSidebarAction() const; QAction *toggleRightSidebarAction() const; QAction *restoreDefaultViewAction() const; void readSettings(); void saveSettings(); void setAutoSynchronization(bool sync); TextEditor::ITextEditor *textEditor() const {return m_textEditor; } private slots: void undo(); void redo(); void deleteSelected(); void cutSelected(); void copySelected(); void paste(); void selectAll(); void closeCurrentEditor(); void toggleSidebars(); void toggleLeftSidebar(); void toggleRightSidebar(); void restoreDefaultView(); void undoAvailable(bool isAvailable); void redoAvailable(bool isAvailable); void enable(); void disable(const QList &errors); void updateErrorStatus(const QList &errors); void updateAvailableSidebarItemsLeft(); void updateAvailableSidebarItemsRight(); void deleteSidebarWidgets(); protected: void resizeEvent(QResizeEvent *event); private: DesignDocumentController *currentDesignDocumentController() const {return m_currentDesignDocumentController.data(); } void setCurrentDocument(DesignDocumentController *newDesignDocumentController); //QStackedWidget *m_documentWidgetStack; QHash > m_documentHash; QWeakPointer m_currentDesignDocumentController; QWeakPointer m_currentTextEdit; QAction *m_undoAction; QAction *m_redoAction; QAction *m_deleteAction; QAction *m_cutAction; QAction *m_copyAction; QAction *m_pasteAction; QAction *m_selectAllAction; QAction *m_hideSidebarsAction; QAction *m_restoreDefaultViewAction; QAction *m_toggleLeftSidebarAction; QAction *m_toggleRightSidebarAction; QWeakPointer m_itemLibraryView; QWeakPointer m_navigator; QWeakPointer m_allPropertiesBox; QWeakPointer m_statesEditorView; QWeakPointer m_formEditorView; QWeakPointer m_nodeInstanceView; bool m_syncWithTextEdit; void setup(); bool isInNodeDefinition(int nodeOffset, int nodeLength, int cursorPos) const; QmlDesigner::ModelNode nodeForPosition(int cursorPos) const; TextEditor::ITextEditor *m_textEditor; QSplitter *m_mainSplitter; Core::SideBar *m_leftSideBar; Core::SideBar *m_rightSideBar; Core::EditorToolBar *m_fakeToolBar; Core::OutputPanePlaceHolder *m_outputPanePlaceholder; Core::MiniSplitter *m_outputPlaceholderSplitter; QList m_sideBarItems; bool m_isDisabled; bool m_showSidebars; enum InitializeStatus { NotInitialized, Initializing, Initialized }; InitializeStatus m_initStatus; DocumentWarningWidget *m_warningWidget; }; } // namespace Internal } // namespace Designer #endif // DESIGNMODEWIDGET_H