Commit cbc51121 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Kai Koehne

QmlDesigner.propertyEditor: remove AllPropertiesBox

This class is not needed anymore and is just confusing.

Change-Id: I6ee3d4090b13d2682ff2f7b3d82ebfe1410a1344
Reviewed-on: http://codereview.qt.nokia.com/37Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 61afe9d3
/**************************************************************************
**
** 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();
}
/**************************************************************************
**
** 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
......@@ -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);
......
......@@ -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);
......
/**************************************************************************
**
** 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);
}
}
/**************************************************************************
**
** 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
......@@ -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;
......
......@@ -86,7 +86,7 @@ public:
void setQmlDir(const QString &qmlDirPath);
QWidget* createPropertiesPage();
QWidget *widget();
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList);
......
......@@ -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 \
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment