diff --git a/src/plugins/qmldesigner/application.cpp b/src/plugins/qmldesigner/application.cpp deleted file mode 100644 index 4a82bcfcfca..00000000000 --- 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 -#include - - -#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 3821f8b999f..00000000000 --- 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 - -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 336357f752c..617fc3363da 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 #include #include #include @@ -94,7 +93,7 @@ public: QWeakPointer itemLibraryView; QWeakPointer navigator; - QWeakPointer allPropertiesBox; + QWeakPointer propertyEditorView; QWeakPointer statesEditorView; QWeakPointer stackedWidget; QWeakPointer 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 ad1f2b8a4d7..047bdb63263 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 1639b392fce..00000000000 --- 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 - -#include - -#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 ae00c165ae1..00000000000 --- 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 - -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 9c27096d406..bff196f50b2 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 d12cbfe5e0f..42b1d71858c 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 &selectedNodeList, const QList &lastSelectedNodeList); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 134ace28645..4dfc8bce75a 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 95abaddc309..572ca373e1b 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 851682fbe01..a7743cf56b4 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -40,7 +40,6 @@ #include -#include #include #include #include @@ -48,6 +47,7 @@ #include #include #include +#include #include #include @@ -182,7 +182,7 @@ private: QWeakPointer m_itemLibraryView; QWeakPointer m_navigatorView; - QWeakPointer m_allPropertiesBox; + QWeakPointer m_propertyEditorView; QWeakPointer m_statesEditorView; QWeakPointer m_formEditorView; QWeakPointer m_nodeInstanceView; diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro index ad7cf4efbf9..a1959f4db7c 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 \