diff options
author | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2011-05-20 14:32:43 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-05-20 15:04:45 +0200 |
commit | cbc511213bc3ba2fc19b854f505da5d6c2f296ed (patch) | |
tree | ded5e0f01fb4c0fb97abf1920baf4bcaa4766a1d | |
parent | 61afe9d36582665822baefe2c87f5975e05036da (diff) | |
download | qt-creator-cbc511213bc3ba2fc19b854f505da5d6c2f296ed.tar.gz |
QmlDesigner.propertyEditor: remove AllPropertiesBox
This class is not needed anymore and is just confusing.
Change-Id: I6ee3d4090b13d2682ff2f7b3d82ebfe1410a1344
Reviewed-on: http://codereview.qt.nokia.com/37
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
12 files changed, 31 insertions, 277 deletions
diff --git a/src/plugins/qmldesigner/application.cpp b/src/plugins/qmldesigner/application.cpp deleted file mode 100644 index 4a82bcfcfc..0000000000 --- a/src/plugins/qmldesigner/application.cpp +++ /dev/null @@ -1,49 +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 info@qt.nokia.com. -** -**************************************************************************/ - -#include "application.h" -#include <QtCore/QCoreApplication> -#include <QtCore/QFileInfo> - - -#ifdef Q_OS_MAC -# define SHARE_PATH "/../Resources/qmldesigner" -#else -# define SHARE_PATH "/../share/qtcreator/qmldesigner" -#endif - -QString Application::sharedDirPath() -{ - QString appPath = QCoreApplication::applicationDirPath(); - - return QFileInfo(appPath + SHARE_PATH).absoluteFilePath(); -} diff --git a/src/plugins/qmldesigner/application.h b/src/plugins/qmldesigner/application.h deleted file mode 100644 index 3821f8b999..0000000000 --- a/src/plugins/qmldesigner/application.h +++ /dev/null @@ -1,43 +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 info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef APPLICATION_H -#define APPLICATION_H - -#include <QtCore/QString> - -class Application { -public: - static QString sharedDirPath(); -}; - -#endif // APPLICATION_H diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index 336357f752..617fc3363d 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -37,7 +37,6 @@ #include "subcomponentmanager.h" #include "model/viewlogger.h" -#include <allpropertiesbox.h> #include <itemlibraryview.h> #include <itemlibrarywidget.h> #include <navigatorview.h> @@ -94,7 +93,7 @@ public: QWeakPointer<ItemLibraryView> itemLibraryView; QWeakPointer<NavigatorView> navigator; - QWeakPointer<AllPropertiesBox> allPropertiesBox; + QWeakPointer<PropertyEditor> propertyEditorView; QWeakPointer<StatesEditorView> statesEditorView; QWeakPointer<QStackedWidget> stackedWidget; QWeakPointer<NodeInstanceView> nodeInstanceView; @@ -213,8 +212,8 @@ void DesignDocumentController::blockModelSync(bool block) if (state.isValid() && m_d->statesEditorView) m_d->statesEditorView->setCurrentState(state); attachNodeInstanceView(); - if (m_d->allPropertiesBox->view()) - m_d->allPropertiesBox->view()->resetView(); + if (m_d->propertyEditorView) + m_d->propertyEditorView->resetView(); } } } @@ -237,9 +236,9 @@ void DesignDocumentController::setNavigator(NavigatorView* navigatorView) m_d->navigator = navigatorView; } -void DesignDocumentController::setAllPropertiesBox(AllPropertiesBox* allPropertiesBox) +void DesignDocumentController::setPropertyEditorView(PropertyEditor *propertyEditor) { - m_d->allPropertiesBox = allPropertiesBox; + m_d->propertyEditorView = propertyEditor; } void DesignDocumentController::setStatesEditorView(StatesEditorView* statesEditorView) @@ -414,7 +413,7 @@ void DesignDocumentController::loadCurrentModel() // Will call setCurrentState (formEditorView etc has to be constructed first) m_d->model->attachView(m_d->statesEditorView.data()); - m_d->allPropertiesBox->setModel(m_d->model.data()); + m_d->model->attachView(m_d->propertyEditorView.data()); m_d->documentLoaded = true; Q_ASSERT(m_d->masterModel); diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h index ad1f2b8a4d..047bdb6326 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h @@ -56,7 +56,7 @@ class QmlObjectNode; class RewriterView; class ItemLibraryView; class NavigatorView; -class AllPropertiesBox; +class PropertyEditor; class StatesEditorView; class FormEditorView; @@ -94,7 +94,7 @@ public: void setItemLibraryView(ItemLibraryView* itemLibraryView); void setNavigator(NavigatorView* navigatorView); - void setAllPropertiesBox(AllPropertiesBox* allPropertiesBox); + void setPropertyEditorView(PropertyEditor *propertyEditor); void setStatesEditorView(StatesEditorView* statesEditorView); void setFormEditorView(FormEditorView *formEditorView); void setNodeInstanceView(NodeInstanceView *nodeInstanceView); diff --git a/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.cpp b/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.cpp deleted file mode 100644 index 1639b392fc..0000000000 --- a/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.cpp +++ /dev/null @@ -1,93 +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 info@qt.nokia.com. -** -**************************************************************************/ - -#include <QtGui/QBoxLayout> - -#include <model.h> - -#include "application.h" -#include "allpropertiesbox.h" -#include "propertyeditor.h" - -namespace QmlDesigner { - -class AllPropertiesBoxPrivate -{ - friend class AllPropertiesBox; - -private: - PropertyEditor* propertiesEditor; -}; - -AllPropertiesBox::AllPropertiesBox(QWidget* parent): - QStackedWidget(parent), - m_d(new AllPropertiesBoxPrivate) -{ - m_d->propertiesEditor = new PropertyEditor(this); - m_d->propertiesEditor->setQmlDir(Application::sharedDirPath() + QLatin1String("/propertyeditor")); - - m_newLookIndex = addWidget(m_d->propertiesEditor->createPropertiesPage()); - - setCurrentIndex(m_newLookIndex); - - setWindowTitle(tr("Properties", "Title of properties view.")); -} - -AllPropertiesBox::~AllPropertiesBox() -{ - delete m_d; -} - -void AllPropertiesBox::setModel(Model* model) -{ - if (model) - model->attachView(m_d->propertiesEditor); - else if (m_d->propertiesEditor->model()) - m_d->propertiesEditor->model()->detachView(m_d->propertiesEditor); -} - -PropertyEditor* AllPropertiesBox::view() const -{ - return m_d->propertiesEditor; -} - -void AllPropertiesBox::showNewLook() -{ - setCurrentIndex(m_newLookIndex); -} - -void AllPropertiesBox::showTraditional() -{ - setCurrentIndex(m_traditionalIndex); -} - -} diff --git a/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.h b/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.h deleted file mode 100644 index ae00c165ae..0000000000 --- a/src/plugins/qmldesigner/components/propertyeditor/allpropertiesbox.h +++ /dev/null @@ -1,71 +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 info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef allpropertiesbox_h -#define allpropertiesbox_h - -#include <QtGui/QStackedWidget> - -namespace QmlDesigner { - -class FormWindow; -class Model; -class ModelState; -class PropertyEditor; - -class AllPropertiesBox: public QStackedWidget -{ - Q_OBJECT - -public: - AllPropertiesBox(QWidget* parent = 0); - virtual ~AllPropertiesBox(); - - void showNewLook(); - void showTraditional(); - - void setModel(Model *model); - - PropertyEditor* view() const; - - -private: - -private: - class AllPropertiesBoxPrivate* m_d; - int m_newLookIndex; - int m_traditionalIndex; -}; - -} - -#endif // allpropertiesbox_h diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 9c27096d40..bff196f50b 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -87,6 +87,20 @@ const int collapseButtonOffset = 114; namespace QmlDesigner { +#ifdef Q_OS_MAC +# define SHARE_PATH "/../Resources/qmldesigner" +#else +# define SHARE_PATH "/../share/qtcreator/qmldesigner" +#endif + +static inline QString sharedDirPath() +{ + QString appPath = QCoreApplication::applicationDirPath(); + + return QFileInfo(appPath + SHARE_PATH).absoluteFilePath(); +} + + PropertyEditor::NodeType::NodeType(PropertyEditor *propertyEditor) : m_view(new DeclarativeWidgetView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()), m_contextObject(new PropertyEditorContextObject()) @@ -305,11 +319,12 @@ PropertyEditor::PropertyEditor(QWidget *parent) : OriginWidget::registerDeclarativeType(); GradientLineQmlAdaptor::registerDeclarativeType(); } + setQmlDir(sharedDirPath() + QLatin1String("/propertyeditor")); + m_stackedWidget->setWindowTitle(tr("Properties")); } PropertyEditor::~PropertyEditor() { - delete m_stackedWidget; qDeleteAll(m_typeHash); } @@ -912,7 +927,7 @@ void PropertyEditor::select(const ModelNode &node) delayedResetView(); } -QWidget *PropertyEditor::createPropertiesPage() +QWidget *PropertyEditor::widget() { delayedResetView(); return m_stackedWidget; diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h index d12cbfe5e0..42b1d71858 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h @@ -86,7 +86,7 @@ public: void setQmlDir(const QString &qmlDirPath); - QWidget* createPropertiesPage(); + QWidget *widget(); void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 134ace2864..4dfc8bce75 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -2,7 +2,6 @@ VPATH += $$PWD INCLUDEPATH += $$PWD SOURCES += propertyeditor.cpp \ qmlanchorbindingproxy.cpp \ - allpropertiesbox.cpp \ resetwidget.cpp \ qlayoutobject.cpp \ basiclayouts.cpp \ @@ -22,7 +21,6 @@ SOURCES += propertyeditor.cpp \ HEADERS += propertyeditor.h \ qmlanchorbindingproxy.h \ - allpropertiesbox.h \ resetwidget.h \ qlayoutobject.h \ basiclayouts.h \ diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 95abaddc30..572ca373e1 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -307,7 +307,7 @@ void DesignModeWidget::showEditor(Core::IEditor *editor) DesignDocumentController *newDocument = new DesignDocumentController(this); newDocument->setNodeInstanceView(m_nodeInstanceView.data()); - newDocument->setAllPropertiesBox(m_allPropertiesBox.data()); + newDocument->setPropertyEditorView(m_propertyEditorView.data()); newDocument->setNavigator(m_navigatorView.data()); newDocument->setStatesEditorView(m_statesEditorView.data()); newDocument->setItemLibraryView(m_itemLibraryView.data()); @@ -667,7 +667,7 @@ void DesignModeWidget::setup() connect(m_nodeInstanceView.data(), SIGNAL(qmlPuppetCrashed()), this, SLOT(qmlPuppetCrashed())); // Sidebar takes ownership m_navigatorView = new NavigatorView; - m_allPropertiesBox = new AllPropertiesBox; + m_propertyEditorView = new PropertyEditor(this); m_itemLibraryView = new ItemLibraryView(this); m_statesEditorView = new StatesEditorView(this); @@ -685,7 +685,7 @@ void DesignModeWidget::setup() Core::SideBarItem *navigatorItem = new NavigatorSideBarItem(m_navigatorView->widget(), QLatin1String(SB_NAVIGATOR)); Core::SideBarItem *libraryItem = new ItemLibrarySideBarItem(m_itemLibraryView->widget(), QLatin1String(SB_LIBRARY)); - Core::SideBarItem *propertiesItem = new Core::SideBarItem(m_allPropertiesBox.data(), QLatin1String(SB_PROPERTIES)); + Core::SideBarItem *propertiesItem = new Core::SideBarItem(m_propertyEditorView->widget(), QLatin1String(SB_PROPERTIES)); // default items m_sideBarItems << navigatorItem << libraryItem << propertiesItem; diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h index 851682fbe0..a7743cf56b 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -40,7 +40,6 @@ #include <integrationcore.h> -#include <allpropertiesbox.h> #include <designdocumentcontroller.h> #include <itemlibraryview.h> #include <navigatorwidget.h> @@ -48,6 +47,7 @@ #include <stateseditorview.h> #include <modelnode.h> #include <formeditorview.h> +#include <propertyeditor.h> #include <QWeakPointer> #include <QDeclarativeError> @@ -182,7 +182,7 @@ private: QWeakPointer<ItemLibraryView> m_itemLibraryView; QWeakPointer<NavigatorView> m_navigatorView; - QWeakPointer<AllPropertiesBox> m_allPropertiesBox; + QWeakPointer<PropertyEditor> m_propertyEditorView; QWeakPointer<StatesEditorView> m_statesEditorView; QWeakPointer<FormEditorView> m_formEditorView; QWeakPointer<NodeInstanceView> m_nodeInstanceView; diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro index ad7cf4efbf..a1959f4db7 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pro +++ b/src/plugins/qmldesigner/qmldesignerplugin.pro @@ -19,7 +19,6 @@ include(components/resources/resources.pri) HEADERS += qmldesignerconstants.h \ qmldesignerplugin.h \ designmodewidget.h \ - application.h \ designersettings.h \ settingspage.h \ designmodecontext.h \ @@ -27,7 +26,6 @@ HEADERS += qmldesignerconstants.h \ SOURCES += qmldesignerplugin.cpp \ designmodewidget.cpp \ - application.cpp \ designersettings.cpp \ settingspage.cpp \ designmodecontext.cpp \ |