summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorLasse Holmstedt <lasse.holmstedt@nokia.com>2010-07-30 16:09:17 +0200
committerLasse Holmstedt <lasse.holmstedt@nokia.com>2010-07-30 16:09:29 +0200
commit8918cff941a9a75d2444e9803ac9b16ef3630b65 (patch)
tree94c232756e99dc2762e29e66ce4a9b7b8ae0b8c2 /src/libs
parentf4b1c441aae6ba1d433c29229dac6eda2ff60b76 (diff)
downloadqt-creator-8918cff941a9a75d2444e9803ac9b16ef3630b65.tar.gz
Moved CrumblePath to Utils
This widget has little to do with the QML debugging library, and will be reused inside the QML JS Inspector UI as well.
Diffstat (limited to 'src/libs')
-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
10 files changed, 36 insertions, 53 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 \