summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/qmljsdebugger/editor/editor.pri3
-rw-r--r--src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp31
-rw-r--r--src/libs/qmljsdebugger/editor/subcomponenteditortool.h12
-rw-r--r--src/libs/qmljsdebugger/include/qdeclarativedesignview.h7
-rw-r--r--src/libs/qmljsdebugger/qdeclarativedesignview.cpp18
-rw-r--r--src/libs/qmljsdebugger/qdeclarativedesignview_p.h1
-rw-r--r--src/libs/qmljsdebugger/qmljsdebugger-lib.pri1
-rw-r--r--src/libs/utils/crumblepath.cpp (renamed from src/libs/qmljsdebugger/editor/crumblepath.cpp)2
-rw-r--r--src/libs/utils/crumblepath.h (renamed from src/libs/qmljsdebugger/include/crumblepath.h)8
-rw-r--r--src/libs/utils/utils.pro6
-rw-r--r--src/tools/qml/qmlobserver/qmlobserver.pro7
-rw-r--r--src/tools/qml/qmlobserver/qmlruntime.cpp12
-rw-r--r--src/tools/qml/qmlobserver/qmlruntime.h4
13 files changed, 54 insertions, 58 deletions
diff --git a/src/libs/qmljsdebugger/editor/editor.pri b/src/libs/qmljsdebugger/editor/editor.pri
index e66576150b..150ca7dd08 100644
--- a/src/libs/qmljsdebugger/editor/editor.pri
+++ b/src/libs/qmljsdebugger/editor/editor.pri
@@ -30,8 +30,7 @@ SOURCES += \
$$PWD/zoomtool.cpp \
$$PWD/colorpickertool.cpp \
$$PWD/qmltoolbar.cpp \
- $$PWD/toolbarcolorbox.cpp \
- $$PWD/crumblepath.cpp
+ $$PWD/toolbarcolorbox.cpp
RESOURCES += $$PWD/editor.qrc
diff --git a/src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp b/src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp
index ed24b2f5d4..03ffbff20d 100644
--- a/src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp
+++ b/src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp
@@ -2,7 +2,6 @@
#include "qdeclarativedesignview.h"
#include "subcomponentmasklayeritem.h"
#include "layeritem.h"
-#include "crumblepath.h"
#include <QGraphicsItem>
#include <QGraphicsObject>
@@ -20,8 +19,7 @@ const qreal MaxOpacity = 0.5f;
SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeDesignView *view)
: AbstractFormEditorTool(view),
m_animIncrement(0.05f),
- m_animTimer(new QTimer(this)),
- m_crumblePathWidget(0)
+ m_animTimer(new QTimer(this))
{
m_mask = new SubcomponentMaskLayerItem(view, view->manipulatorLayer());
connect(m_animTimer, SIGNAL(timeout()), SLOT(animate()));
@@ -125,8 +123,7 @@ void SubcomponentEditorTool::clear()
m_animTimer->stop();
m_mask->hide();
- if (m_crumblePathWidget)
- m_crumblePathWidget->clear();
+ emit cleared();
}
void SubcomponentEditorTool::graphicsObjectsChanged(const QList<QGraphicsObject*> &/*itemList*/)
@@ -230,8 +227,7 @@ void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem)
{
connect(contextItem, SIGNAL(destroyed(QObject*)), SLOT(contextDestroyed(QObject*)));
m_currentContext.push(contextItem);
- if (m_crumblePathWidget)
- m_crumblePathWidget->pushElement(titleForItem(contextItem));
+ emit contextPushed(titleForItem(contextItem));
}
void SubcomponentEditorTool::aboutToPopContext()
@@ -248,8 +244,7 @@ QGraphicsObject *SubcomponentEditorTool::popContext()
{
QGraphicsObject *popped = m_currentContext.pop();
- if (m_crumblePathWidget)
- m_crumblePathWidget->popElement();
+ emit contextPopped();
disconnect(popped, SIGNAL(xChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(yChanged()), this, SLOT(refresh()));
@@ -285,24 +280,13 @@ void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy)
// pop out the whole context - it might not be safe anymore.
while (m_currentContext.size() > 1) {
m_currentContext.pop();
- if (m_crumblePathWidget)
- m_crumblePathWidget->popElement();
+ emit contextPopped();
}
m_mask->setVisible(false);
}
-void SubcomponentEditorTool::setCrumblePathWidget(CrumblePath *pathWidget)
-{
- m_crumblePathWidget = pathWidget;
-
- if (m_crumblePathWidget) {
- connect(m_crumblePathWidget, SIGNAL(elementClicked(int)), SLOT(setContext(int)));
- connect(m_crumblePathWidget, SIGNAL(elementContextMenuRequested(int)), SLOT(openContextMenuForContext(int)));
- }
-}
-
void SubcomponentEditorTool::setContext(int contextIndex)
{
Q_ASSERT(contextIndex >= 0);
@@ -317,10 +301,5 @@ void SubcomponentEditorTool::setContext(int contextIndex)
}
}
-void SubcomponentEditorTool::openContextMenuForContext(int /*contextIndex*/)
-{
-
-}
-
} // namespace QmlViewer
diff --git a/src/libs/qmljsdebugger/editor/subcomponenteditortool.h b/src/libs/qmljsdebugger/editor/subcomponenteditortool.h
index 8584bb02d6..d914cd6abe 100644
--- a/src/libs/qmljsdebugger/editor/subcomponenteditortool.h
+++ b/src/libs/qmljsdebugger/editor/subcomponenteditortool.h
@@ -10,7 +10,6 @@ QT_FORWARD_DECLARE_CLASS(QTimer)
namespace QmlViewer {
-class CrumblePath;
class SubcomponentMaskLayerItem;
class SubcomponentEditorTool : public AbstractFormEditorTool
@@ -49,10 +48,14 @@ public:
QGraphicsObject *popContext();
QGraphicsObject *currentRootItem() const;
- void setCrumblePathWidget(CrumblePath *pathWidget);
+public slots:
+ void setContext(int contextIndex);
signals:
void exitContextRequested();
+ void cleared();
+ void contextPushed(const QString &contextTitle);
+ void contextPopped();
protected:
void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
@@ -61,8 +64,6 @@ private slots:
void animate();
void contextDestroyed(QObject *context);
void refresh();
- void setContext(int contextIndex);
- void openContextMenuForContext(int contextIndex);
private:
void aboutToPopContext();
@@ -73,9 +74,6 @@ private:
qreal m_animIncrement;
SubcomponentMaskLayerItem *m_mask;
QTimer *m_animTimer;
-
- CrumblePath *m_crumblePathWidget;
-
};
} // namespace QmlViewer
diff --git a/src/libs/qmljsdebugger/include/qdeclarativedesignview.h b/src/libs/qmljsdebugger/include/qdeclarativedesignview.h
index 30c216205b..e6a12643fc 100644
--- a/src/libs/qmljsdebugger/include/qdeclarativedesignview.h
+++ b/src/libs/qmljsdebugger/include/qdeclarativedesignview.h
@@ -75,7 +75,6 @@ public:
QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const;
QGraphicsItem *currentRootItem() const;
- CrumblePath *crumblePathWidget() const;
QToolBar *toolbar() const;
static QString idStringForObject(QObject *obj);
QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace);
@@ -92,6 +91,8 @@ public Q_SLOTS:
void continueExecution(qreal slowdownFactor = 1.0f);
void pauseExecution();
+ void setInspectorContext(int contextIndex);
+
Q_SIGNALS:
void designModeBehaviorChanged(bool inDesignMode);
void reloadRequested();
@@ -104,6 +105,10 @@ Q_SIGNALS:
void executionStarted(qreal slowdownFactor);
void executionPaused();
+ void inspectorContextCleared();
+ void inspectorContextPushed(const QString &contextTitle);
+ void inspectorContextPopped();
+
protected:
void leaveEvent(QEvent *);
void mousePressEvent(QMouseEvent *event);
diff --git a/src/libs/qmljsdebugger/qdeclarativedesignview.cpp b/src/libs/qmljsdebugger/qdeclarativedesignview.cpp
index d92aa08a52..efba89596b 100644
--- a/src/libs/qmljsdebugger/qdeclarativedesignview.cpp
+++ b/src/libs/qmljsdebugger/qdeclarativedesignview.cpp
@@ -8,7 +8,6 @@
#include "boundingrecthighlighter.h"
#include "subcomponenteditortool.h"
#include "qmltoolbar.h"
-#include "crumblepath.h"
#include <QDeclarativeItem>
#include <QDeclarativeEngine>
@@ -44,15 +43,12 @@ QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
{
data = new QDeclarativeDesignViewPrivate;
- data->crumblePath = new CrumblePath(0);
-
data->manipulatorLayer = new LayerItem(scene());
data->selectionTool = new SelectionTool(this);
data->zoomTool = new ZoomTool(this);
data->colorPickerTool = new ColorPickerTool(this);
data->boundingRectHighlighter = new BoundingRectHighlighter(this);
data->subcomponentEditorTool = new SubcomponentEditorTool(this);
- data->subcomponentEditorTool->setCrumblePathWidget(data->crumblePath);
data->currentTool = data->selectionTool;
setMouseTracking(true);
@@ -77,6 +73,10 @@ QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
qmlDesignDebugServer(), SLOT(selectedColorChanged(QColor)));
+ connect(data->subcomponentEditorTool, SIGNAL(cleared()), SIGNAL(inspectorContextCleared()));
+ connect(data->subcomponentEditorTool, SIGNAL(contextPushed(QString)), SIGNAL(inspectorContextPushed(QString)));
+ connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), SIGNAL(inspectorContextPopped()));
+
createToolbar();
}
@@ -84,6 +84,11 @@ QDeclarativeDesignView::~QDeclarativeDesignView()
{
}
+void QDeclarativeDesignView::setInspectorContext(int contextIndex)
+{
+ data->subcomponentEditorTool->setContext(contextIndex);
+}
+
void QDeclarativeDesignView::reloadView()
{
data->subcomponentEditorTool->clear();
@@ -593,11 +598,6 @@ QRectF QDeclarativeDesignView::adjustToScreenBoundaries(const QRectF &boundingRe
return boundingRect;
}
-CrumblePath *QDeclarativeDesignView::crumblePathWidget() const
-{
- return data->crumblePath;
-}
-
QToolBar *QDeclarativeDesignView::toolbar() const
{
return data->toolbar;
diff --git a/src/libs/qmljsdebugger/qdeclarativedesignview_p.h b/src/libs/qmljsdebugger/qdeclarativedesignview_p.h
index 6405525a8c..2a4095fbc4 100644
--- a/src/libs/qmljsdebugger/qdeclarativedesignview_p.h
+++ b/src/libs/qmljsdebugger/qdeclarativedesignview_p.h
@@ -73,7 +73,6 @@ public:
qreal slowdownFactor;
QmlToolbar *toolbar;
- CrumblePath *crumblePath;
};
diff --git a/src/libs/qmljsdebugger/qmljsdebugger-lib.pri b/src/libs/qmljsdebugger/qmljsdebugger-lib.pri
index d366798fdb..1449acb0b0 100644
--- a/src/libs/qmljsdebugger/qmljsdebugger-lib.pri
+++ b/src/libs/qmljsdebugger/qmljsdebugger-lib.pri
@@ -19,7 +19,6 @@ HEADERS += \
include/jsdebuggeragent.h \
include/qdeclarativedesignview.h \
include/qdeclarativedesigndebugserver.h \
- include/crumblepath.h \
include/qmlviewerconstants.h \
include/qmljsdebugger_global.h \
qdeclarativedesignview_p.h
diff --git a/src/libs/qmljsdebugger/editor/crumblepath.cpp b/src/libs/utils/crumblepath.cpp
index 00666cf5d2..1d5369229c 100644
--- a/src/libs/qmljsdebugger/editor/crumblepath.cpp
+++ b/src/libs/utils/crumblepath.cpp
@@ -34,7 +34,7 @@
#include <QStyle>
#include <QResizeEvent>
-namespace QmlViewer {
+namespace Utils {
static const int ArrowBorderSize = 12;
diff --git a/src/libs/qmljsdebugger/include/crumblepath.h b/src/libs/utils/crumblepath.h
index cd1f09f3b3..5a78a96e99 100644
--- a/src/libs/qmljsdebugger/include/crumblepath.h
+++ b/src/libs/utils/crumblepath.h
@@ -32,20 +32,22 @@
#include <QWidget>
#include <QList>
-#include "qmljsdebugger_global.h"
+#include "utils_global.h"
QT_FORWARD_DECLARE_CLASS(QResizeEvent);
-namespace QmlViewer {
+namespace Utils {
class CrumblePathButton;
-class QMLJSDEBUGGER_EXPORT CrumblePath : public QWidget
+class QTCREATOR_UTILS_EXPORT CrumblePath : public QWidget
{
Q_OBJECT
public:
explicit CrumblePath(QWidget *parent = 0);
~CrumblePath();
+
+public slots:
void pushElement(const QString &title);
void popElement();
void clear();
diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro
index 582286884c..3f35bf4634 100644
--- a/src/libs/utils/utils.pro
+++ b/src/libs/utils/utils.pro
@@ -42,7 +42,8 @@ SOURCES += reloadpromptutils.cpp \
filterlineedit.cpp \
faketooltip.cpp \
htmldocextractor.cpp \
- navigationtreeview.cpp
+ navigationtreeview.cpp \
+ crumblepath.cpp
win32 {
SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \
@@ -97,7 +98,8 @@ HEADERS += utils_global.h \
filterlineedit.h \
faketooltip.h \
htmldocextractor.h \
- navigationtreeview.h
+ navigationtreeview.h \
+ crumblepath.h
FORMS += filewizardpage.ui \
projectintropage.ui \
newclasswidget.ui \
diff --git a/src/tools/qml/qmlobserver/qmlobserver.pro b/src/tools/qml/qmlobserver/qmlobserver.pro
index 501776fc6c..919a1a028f 100644
--- a/src/tools/qml/qmlobserver/qmlobserver.pro
+++ b/src/tools/qml/qmlobserver/qmlobserver.pro
@@ -8,8 +8,10 @@ SOURCES += main.cpp
# hack to get qtLibraryTarget macro working
TEMPLATE +=lib
include(../../../libs/qmljsdebugger/qmljsdebugger.pri)
+include(../../../libs/utils/utils.pri)
mac {
- libraryTarget = $$qtLibraryTarget(QmlJSDebugger)
+ qmljsLibraryTarget = $$qtLibraryTarget(QmlJSDebugger)
+ utilsLibraryTarget = $$qtLibraryTarget(Utils)
}
TEMPLATE -=lib
@@ -22,7 +24,8 @@ mac {
QMAKE_INFO_PLIST=Info_mac.plist
TARGET=QMLObserver
ICON=qml.icns
- QMAKE_POST_LINK=install_name_tool -change @executable_path/../PlugIns/lib$${libraryTarget}.1.dylib @executable_path/../../../../PlugIns/lib$${libraryTarget}.1.dylib \'$$DESTDIR/$${TARGET}.app/Contents/MacOS/$$TARGET\'
+ QMAKE_POST_LINK=install_name_tool -change @executable_path/../PlugIns/lib$${qmljsLibraryTarget}.1.dylib @executable_path/../../../../PlugIns/lib$${qmljsLibraryTarget}.1.dylib \'$$DESTDIR/$${TARGET}.app/Contents/MacOS/$$TARGET\' \
+ && install_name_tool -change @executable_path/../PlugIns/lib$${utilsLibraryTarget}.1.dylib @executable_path/../../../../PlugIns/lib$${utilsLibraryTarget}.1.dylib \'$$DESTDIR/$${TARGET}.app/Contents/MacOS/$$TARGET\'
} else {
TARGET=qmlobserver
}
diff --git a/src/tools/qml/qmlobserver/qmlruntime.cpp b/src/tools/qml/qmlobserver/qmlruntime.cpp
index af65ceeac7..422b89f531 100644
--- a/src/tools/qml/qmlobserver/qmlruntime.cpp
+++ b/src/tools/qml/qmlobserver/qmlruntime.cpp
@@ -55,7 +55,7 @@
#endif
#include <qdeclarativedesignview.h>
-#include <crumblepath.h>
+#include <utils/crumblepath.h>
#include "qmlruntime.h"
#include <qdeclarativecontext.h>
@@ -551,6 +551,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
, tester(0)
, useQmlFileBrowser(true)
, m_centralWidget(0)
+ , m_crumblePathWidget(0)
, translator(0)
{
QDeclarativeViewer::registerTypes();
@@ -590,18 +591,19 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
canvas->toolbar()->setFloatable(false);
canvas->toolbar()->setMovable(false);
+ m_crumblePathWidget = new Utils::CrumblePath(this);
m_centralWidget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(m_centralWidget);
layout->setMargin(0);
layout->setSpacing(0);
- layout->addWidget(canvas->crumblePathWidget());
+ layout->addWidget(m_crumblePathWidget);
#ifndef Q_WS_MAC
QFile file(":/toolbarstyle.css");
file.open(QFile::ReadOnly);
QString toolbarStylesheet = QLatin1String(file.readAll());
canvas->toolbar()->setStyleSheet(toolbarStylesheet);
- canvas->crumblePathWidget()->setStyleSheet("QWidget { border-bottom: 1px solid black; }");
+ m_crumblePathWidget->setStyleSheet("QWidget { border-bottom: 1px solid black; }");
#endif
layout->addWidget(canvas);
@@ -615,6 +617,10 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
QObject::connect(canvas, SIGNAL(reloadRequested()), this, SLOT(reload()));
QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
+ QObject::connect(canvas, SIGNAL(inspectorContextCleared()), m_crumblePathWidget, SLOT(clear()));
+ QObject::connect(canvas, SIGNAL(inspectorContextPushed(QString)), m_crumblePathWidget, SLOT(pushElement(QString)));
+ QObject::connect(canvas, SIGNAL(inspectorContextPopped()), m_crumblePathWidget, SLOT(popElement()));
+ QObject::connect(m_crumblePathWidget, SIGNAL(elementClicked(int)), canvas, SLOT(setInspectorContext(int)));
QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit()));
QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
diff --git a/src/tools/qml/qmlobserver/qmlruntime.h b/src/tools/qml/qmlobserver/qmlruntime.h
index b63a17f4bb..e330fa1185 100644
--- a/src/tools/qml/qmlobserver/qmlruntime.h
+++ b/src/tools/qml/qmlobserver/qmlruntime.h
@@ -52,6 +52,9 @@
namespace QmlViewer {
class QDeclarativeDesignView;
}
+namespace Utils {
+ class CrumblePath;
+}
QT_BEGIN_NAMESPACE
@@ -202,6 +205,7 @@ private:
bool useQmlFileBrowser;
QWidget *m_centralWidget;
+ Utils::CrumblePath *m_crumblePathWidget;
QTranslator *translator;
void loadTranslationFile(const QString& directory);