From 7edf08feff5ff9eadac3078aa3058de506df68e4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 13 Apr 2011 21:29:26 +0200 Subject: [PATCH] remove dead files --- .../formeditor/formeditormainview.cpp | 404 ------------------ .../formeditor/formeditormainview.h | 126 ------ .../formeditor/formeditormainwidget.cpp | 159 ------- .../formeditor/formeditormainwidget.h | 77 ---- 4 files changed, 766 deletions(-) delete mode 100644 src/plugins/qmldesigner/components/formeditor/formeditormainview.cpp delete mode 100644 src/plugins/qmldesigner/components/formeditor/formeditormainview.h delete mode 100644 src/plugins/qmldesigner/components/formeditor/formeditormainwidget.cpp delete mode 100644 src/plugins/qmldesigner/components/formeditor/formeditormainwidget.h diff --git a/src/plugins/qmldesigner/components/formeditor/formeditormainview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditormainview.cpp deleted file mode 100644 index 62270e49032..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/formeditormainview.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/************************************************************************** -** -** 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. -** -**************************************************************************/ - -#include "formeditormainview.h" - -#include "formeditorview.h" -#include "formeditorwidget.h" -#include -#include - -#include "zoomaction.h" - -namespace QmlDesigner { - - -FormEditorMainView::FormEditorMainView() - : m_formMainEditorWidget(new FormEditorMainWidget(this)) -{ - QPixmapCache::setCacheLimit(1024 * 100); -} - -FormEditorMainView::~FormEditorMainView() -{ - resetViews(); - - if (m_formMainEditorWidget) - m_formMainEditorWidget->deleteLater(); -} - -void FormEditorMainView::modelAttached(Model *model) -{ - AbstractView::modelAttached(model); - - setupSubViews(); - - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->modelAttached(model); - } - - m_formMainEditorWidget->setModel(model); -} - -void FormEditorMainView::createSubView(const QmlModelState &state) -{ - FormEditorView *subView = new FormEditorView(this); - subView->setCurrentState(state); - m_formEditorViewList.append(subView); - - m_formMainEditorWidget->addWidget(subView->widget()); - m_subWindowMap.insert(state, subView->widget()); - - subView->setZoomLevel(zoomAction()->zoomLevel()); - connect(zoomAction(), SIGNAL(zoomLevelChanged(double)), subView, SLOT(setZoomLevel(double))); -} - -void FormEditorMainView::removeSubView(const ModelState &state) -{ - QWidget *subWindow = m_subWindowMap.take(state).data(); - Q_ASSERT(subWindow); - if (subWindow == m_formMainEditorWidget->currentWidget()) - setCurrentState(); - delete subWindow; - - FormEditorView *editorView = 0; - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view->modelState() == state) { - editorView = view.data(); - break; - } - } - Q_ASSERT(editorView); - m_formEditorViewList.removeOne(editorView); - delete editorView; -} - -static bool modelStateLessThan(const ModelState &firstState, const ModelState &secondState) - { - if (firstState.isBaseState()) - return false; - - return firstState.name().toLower() > secondState.name().toLower(); - } - -void FormEditorMainView::setupSubViews() -{ - foreach(const QWeakPointer &view, m_formEditorViewList) - delete view.data(); - m_formEditorViewList.clear(); - - foreach(const QWeakPointer &view, m_subWindowMap.values()) - delete view.data(); - m_subWindowMap.clear(); - - QList invertedStates(model()->modelStates()); - qSort(invertedStates.begin(), invertedStates.end(), modelStateLessThan); - foreach(const ModelState &state, invertedStates) - createSubView(state); -} - -void FormEditorMainView::resetViews() -{ - m_subWindowMap.clear(); - foreach(const QWeakPointer &view, m_formEditorViewList) - delete view.data(); - m_formEditorViewList.clear(); -} - -void FormEditorMainView::nodeCreated(const ModelNode &createdNode) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeCreated(createdNode); - } -} - -void FormEditorMainView::modelAboutToBeDetached(Model *model) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->modelAboutToBeDetached(model); - } - - resetViews(); - - m_formMainEditorWidget->setModel(0); - - AbstractView::modelAboutToBeDetached(model); -} - -void FormEditorMainView::nodeAboutToBeRemoved(const ModelNode &removedNode) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeAboutToBeRemoved(removedNode); - } -} - -void FormEditorMainView::propertiesAdded(const NodeState &state, const QList& propertyList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->propertiesAdded(state, propertyList); - } -} - -void FormEditorMainView::propertiesAboutToBeRemoved(const NodeState &state, const QList& propertyList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->propertiesAboutToBeRemoved(state, propertyList); - } -} - -void FormEditorMainView::propertyValuesChanged(const NodeState &state, const QList& propertyList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->propertyValuesChanged(state, propertyList); - } -} - -void FormEditorMainView::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeIdChanged(node, newId, oldId); - } -} - -void FormEditorMainView::nodeReparented(const ModelNode &node, const ModelNode &oldParent, const ModelNode &newParent) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeReparented(node, oldParent, newParent); - } -} - -FormEditorMainWidget *FormEditorMainView::widget() const -{ - return m_formMainEditorWidget.data(); -} - -NodeInstanceView *FormEditorMainView::nodeInstanceView(const ModelState &modelState) const -{ - foreach (const QWeakPointer &view, m_formEditorViewList) { - if (view->modelState() == modelState) - return view->nodeInstanceView(); - } - - return 0; -} - -void FormEditorMainView::selectedNodesChanged(const QList &selectedNodeList, - const QList &lastSelectedNodeList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->selectedNodesChanged(selectedNodeList, lastSelectedNodeList); - } -} - -void FormEditorMainView::modelStateAboutToBeRemoved(const ModelState &modelState) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->modelStateAboutToBeRemoved(modelState); - } - - removeSubView(modelState); -} - -void FormEditorMainView::modelStateAdded(const ModelState &modelState) -{ - createSubView(modelState); - m_formEditorViewList.last()->modelAttached(model()); - - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->modelStateAdded(modelState); - } -} - -void FormEditorMainView::nodeStatesAboutToBeRemoved(const QList &nodeStateList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeStatesAboutToBeRemoved(nodeStateList); - } -} - -void FormEditorMainView::nodeStatesAdded(const QList &nodeStateList) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeStatesAdded(nodeStateList); - } -} - -void FormEditorMainView::setCurrentState(const QmlModelState &state) -{ - Q_ASSERT(m_subWindowMap.contains(state)); - m_formMainEditorWidget->setCurrentWidget(m_subWindowMap.value(state).data()); - emit stateChanged(state); -} - -ModelState FormEditorMainView::currentState() const -{ - QWidget *currentWidget = m_formMainEditorWidget->currentWidget(); - QMapIterator > iter(m_subWindowMap); - while (iter.hasNext()) { - iter.next(); - if (iter.value().data() == currentWidget) { - return iter.key(); - } - } - Q_ASSERT_X(0, Q_FUNC_INFO, "cannot find current state"); - return ModelState(); -} - -FormEditorMainView::EditorTool FormEditorMainView::currentTool() const -{ - return m_currentTool; -} - -void FormEditorMainView::setCurrentTool(FormEditorMainView::EditorTool tool) -{ - if (m_currentTool == tool) - return; - m_currentTool = tool; - switch (tool) { - case MoveTool: { - foreach(const QWeakPointer &view, m_formEditorViewList) - view->changeToMoveTool(); - break; - } - case DragTool: { - foreach(const QWeakPointer &view, m_formEditorViewList) - view->changeToDragTool(); - break; - } - case SelectTool: { - foreach(const QWeakPointer &view, m_formEditorViewList) - view->changeToSelectionTool(); - break; - } - case ResizeTool: { - foreach(const QWeakPointer &view, m_formEditorViewList) - view->changeToResizeTool(); - break; - } - case AnchorTool: { - foreach(const QWeakPointer &view, m_formEditorViewList) - view->changeToAnchorTool(); - break; - } - default: Q_ASSERT(0); - } - emit toolChanged(m_currentTool); -} - -void FormEditorMainView::changeToDragTool() -{ - setCurrentTool(DragTool); -} - - -void FormEditorMainView::changeToMoveTool() -{ - setCurrentTool(MoveTool); -} - -void FormEditorMainView::changeToMoveTool(const QPointF &/*beginPoint*/) -{ - setCurrentTool(MoveTool); -} - -void FormEditorMainView::changeToSelectionTool() -{ - setCurrentTool(SelectTool); -} - -void FormEditorMainView::changeToResizeTool() -{ - setCurrentTool(ResizeTool); -} - -void FormEditorMainView::changeToAnchorTool() -{ - setCurrentTool(AnchorTool); -} - -void FormEditorMainView::changeToTransformTools() -{ - foreach(const QWeakPointer &view, m_formEditorViewList) - if (view) - view->changeToTransformTools(); -} - -void FormEditorMainView::anchorsChanged(const NodeState &nodeState) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->anchorsChanged(nodeState); - } -} - - -void FormEditorMainView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->auxiliaryDataChanged(node, name, data); - } -} - -void FormEditorMainView::nodeSlidedToIndex(const ModelNode &node, int newIndex, int oldIndex) -{ - foreach(const QWeakPointer &view, m_formEditorViewList) { - if (view) - view->nodeSlidedToIndex(node, newIndex, oldIndex); - } -} - -ComponentAction *FormEditorMainView::componentAction() const -{ - return m_formMainEditorWidget->componentAction(); -} - -ZoomAction *FormEditorMainView::zoomAction() const -{ - return m_formMainEditorWidget->zoomAction(); -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/formeditormainview.h b/src/plugins/qmldesigner/components/formeditor/formeditormainview.h deleted file mode 100644 index 75189d572f8..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/formeditormainview.h +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** -** -** 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 FORMEDITORMAINVIEW_H -#define FORMEDITORMAINVIEW_H - -#include - -#include -#include -#include - - -namespace QmlDesigner { -class AbstractFormEditorTool; - -class FormEditorMainView : public ForwardView -{ - Q_OBJECT - -public: - FormEditorMainView(); - ~FormEditorMainView(); - - // AbstractView - void modelAttached(Model *model); - void modelAboutToBeDetached(Model *model); - void nodeCreated(const ModelNode &createdNode); - void nodeAboutToBeRemoved(const ModelNode &removedNode); - void nodeReparented(const ModelNode &node, const ModelNode &oldParent, const ModelNode &newParent); - void propertiesAdded(const NodeState &state, const QList& propertyList); - void propertiesAboutToBeRemoved(const NodeState &state, const QList& propertyList); - void propertyValuesChanged(const NodeState& state, const QList &propertyList); - void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId); - - void selectedNodesChanged(const QList &selectedNodeList, - const QList &lastSelectedNodeList); - - void modelStateAboutToBeRemoved(const ModelState &modelState); - void modelStateAdded(const ModelState &modelState); - - void nodeStatesAboutToBeRemoved(const QList &nodeStateList); - void nodeStatesAdded(const QList &nodeStateList); - - void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data); - // FormEditorMainView - FormEditorMainWidget *widget() const; - NodeInstanceView *nodeInstanceView(const ModelState &modelState) const; - - void setCurrentState(const ModelState &state); - ModelState currentState() const; - - enum EditorTool { - MoveTool, - DragTool, - SelectTool, - ResizeTool, - AnchorTool - }; - - EditorTool currentTool() const; - void setCurrentTool(EditorTool tool); - - void changeToMoveTool(); - void changeToMoveTool(const QPointF &beginPoint); - void changeToDragTool(); - void changeToSelectionTool(); - void changeToResizeTool(); - void changeToTransformTools(); - void changeToAnchorTool(); - - void anchorsChanged(const NodeState &nodeState); - void nodeSlidedToIndex(const ModelNode &node, int newIndex, int oldIndex); - - ComponentAction *componentAction() const; - ZoomAction *zoomAction() const; - -signals: - void stateChanged(const ModelState &state); - void toolChanged(EditorTool tool); - -protected: - void setupSubViews(); - void createSubView(const QmlModelState &state); - void removeSubView(const QmlModelState &state); - void resetViews(); - -private: - QWeakPointer m_formMainEditorWidget; - QList > m_formEditorViewList; - QMap > m_subWindowMap; - EditorTool m_currentTool; -}; - -} // namespace QmlDesigner - -#endif // FORMEDITORMAINVIEW_H diff --git a/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.cpp deleted file mode 100644 index 5fe253d65b7..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************** -** -** 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. -** -**************************************************************************/ - -#include "formeditormainwidget.h" - -#include -#include -#include -#include -#include -#include -#include "toolbox.h" -#include "componentaction.h" -#include "zoomaction.h" -#include -#include - -namespace QmlDesigner { - -FormEditorMainWidget::FormEditorMainWidget(FormEditorMainView *mainView) - : QWidget(), - m_formEditorMainView(mainView), - m_stackedWidget(new QStackedWidget(this)) -{ - QFile file(":/qmldesigner/formeditorstylesheet.css"); - file.open(QFile::ReadOnly); - QString styleSheet = QLatin1String(file.readAll()); - setStyleSheet(styleSheet); - - QVBoxLayout *fillLayout = new QVBoxLayout(this); - fillLayout->setMargin(0); - fillLayout->setSpacing(0); - setLayout(fillLayout); - - QActionGroup *toolActionGroup = new QActionGroup(this); - - QAction *transformToolAction = toolActionGroup->addAction("Transform Tool (Press Key Q)"); - transformToolAction->setShortcut(Qt::Key_Q); - transformToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); - transformToolAction->setCheckable(true); - transformToolAction->setChecked(true); - transformToolAction->setIcon(QPixmap(":/icon/tool/transform.png")); - connect(transformToolAction, SIGNAL(triggered(bool)), SLOT(changeTransformTool(bool))); - - QAction *anchorToolAction = toolActionGroup->addAction("Anchor Tool (Press Key W)"); - anchorToolAction->setShortcut(Qt::Key_W); - anchorToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); - anchorToolAction->setCheckable(true); - anchorToolAction->setIcon(QPixmap(":/icon/tool/anchor.png")); - connect(anchorToolAction, SIGNAL(triggered(bool)), SLOT(changeAnchorTool(bool))); - - addActions(toolActionGroup->actions()); - - - m_componentAction = new ComponentAction(toolActionGroup); - addAction(m_componentAction.data()); - - m_zoomAction = new ZoomAction(toolActionGroup); - addAction(m_zoomAction.data()); - - ToolBox *toolBox = new ToolBox(this); - toolBox->setActions(actions()); - fillLayout->addWidget(toolBox); - - fillLayout->addWidget(m_stackedWidget.data()); -} - -void FormEditorMainWidget::addWidget(QWidget *widget) -{ - m_stackedWidget->addWidget(widget); -} - -QWidget *FormEditorMainWidget::currentWidget() const -{ - return m_stackedWidget->currentWidget(); -} - -void FormEditorMainWidget::setCurrentWidget(QWidget *widget) -{ - m_stackedWidget->setCurrentWidget(widget); -} - -void FormEditorMainWidget::setModel(Model *model) -{ - m_componentAction->setDisabled(true); - - if (model) { - m_componentAction->setModel(model->masterModel()); - m_componentAction->setEnabled(true); - } -} - -void FormEditorMainWidget::changeTransformTool(bool checked) -{ - if (checked) - m_formEditorMainView->changeToTransformTools(); -} - -void FormEditorMainWidget::changeAnchorTool(bool checked) -{ - if (checked) - m_formEditorMainView->changeToAnchorTool(); -} - -ComponentAction *FormEditorMainWidget::componentAction() const -{ - return m_componentAction.data(); -} - -ZoomAction *FormEditorMainWidget::zoomAction() const -{ - return m_zoomAction.data(); -} - -void FormEditorMainWidget::wheelEvent(QWheelEvent *event) -{ - if (event->modifiers().testFlag(Qt::ControlModifier)) { - if (event->delta() > 0) { - zoomAction()->zoomIn(); - } else { - zoomAction()->zoomOut(); - } - - event->accept(); - } else { - QWidget::wheelEvent(event); - } -} - -} diff --git a/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.h deleted file mode 100644 index 5c492013025..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/formeditormainwidget.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** 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 FORMEDITORMAINWIDGET_H -#define FORMEDITORMAINWIDGET_H - -#include -#include - - - -namespace QmlDesigner { - -class Model; -class FormEditorMainView; -class ComponentAction; -class ZoomAction; - -class FormEditorMainWidget : public QWidget -{ - Q_OBJECT -public: - FormEditorMainWidget(FormEditorMainView *mainView); - - void addWidget(QWidget *widget); - QWidget *currentWidget() const; - void setCurrentWidget(QWidget *widget); - void setModel(Model *model); - - ComponentAction *componentAction() const; - ZoomAction *zoomAction() const; - -protected: - void wheelEvent(QWheelEvent *event); - -private slots: - void changeTransformTool(bool checked); - void changeAnchorTool(bool checked); - -private: - QWeakPointer m_formEditorMainView; - QWeakPointer m_stackedWidget; - QWeakPointer m_componentAction; - QWeakPointer m_zoomAction; -}; - -} -#endif // FORMEDITORMAINWIDGET_H