Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
524d4453
Commit
524d4453
authored
Aug 02, 2010
by
Lasse Holmstedt
Browse files
Qml JS Inspector: Added context crumble path as a dock widget
The crumble path shows the current context of the debugger/inspector.
parent
ef57d20a
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljsdebugger/editor/editor.qrc
View file @
524d4453
...
...
@@ -9,12 +9,6 @@
<file>images/from-qml.png</file>
<file>images/to-qml.png</file>
<file>images/designmode.png</file>
<file>images/segment-end.png</file>
<file>images/segment-selected.png</file>
<file>images/segment.png</file>
<file>images/segment-hover-end.png</file>
<file>images/segment-hover.png</file>
<file>images/segment-selected-end.png</file>
<file>images/color-picker-hicontrast.png</file>
<file>images/zoom.png</file>
<file>images/color-picker-24.png</file>
...
...
src/libs/qmljsdebugger/editor/subcomponenteditortool.cpp
View file @
524d4453
...
...
@@ -122,7 +122,9 @@ void SubcomponentEditorTool::clear()
m_mask
->
setCurrentItem
(
0
);
m_animTimer
->
stop
();
m_mask
->
hide
();
m_path
.
clear
();
emit
contextPathChanged
(
m_path
);
emit
cleared
();
}
...
...
@@ -222,7 +224,11 @@ void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem)
{
connect
(
contextItem
,
SIGNAL
(
destroyed
(
QObject
*
)),
SLOT
(
contextDestroyed
(
QObject
*
)));
m_currentContext
.
push
(
contextItem
);
emit
contextPushed
(
titleForItem
(
contextItem
));
QString
title
=
titleForItem
(
contextItem
);
emit
contextPushed
(
title
);
m_path
<<
title
;
emit
contextPathChanged
(
m_path
);
}
void
SubcomponentEditorTool
::
aboutToPopContext
()
...
...
@@ -238,6 +244,7 @@ void SubcomponentEditorTool::aboutToPopContext()
QGraphicsObject
*
SubcomponentEditorTool
::
popContext
()
{
QGraphicsObject
*
popped
=
m_currentContext
.
pop
();
m_path
.
removeLast
();
emit
contextPopped
();
...
...
@@ -275,11 +282,12 @@ void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy)
// pop out the whole context - it might not be safe anymore.
while
(
m_currentContext
.
size
()
>
1
)
{
m_currentContext
.
pop
();
m_path
.
removeLast
();
emit
contextPopped
();
}
m_mask
->
setVisible
(
false
);
emit
contextPathChanged
(
m_path
);
}
QGraphicsObject
*
SubcomponentEditorTool
::
setContext
(
int
contextIndex
)
...
...
src/libs/qmljsdebugger/editor/subcomponenteditortool.h
View file @
524d4453
...
...
@@ -3,6 +3,7 @@
#include "abstractformeditortool.h"
#include <QStack>
#include <QStringList>
QT_FORWARD_DECLARE_CLASS
(
QGraphicsObject
)
QT_FORWARD_DECLARE_CLASS
(
QPoint
)
...
...
@@ -54,6 +55,7 @@ signals:
void
cleared
();
void
contextPushed
(
const
QString
&
contextTitle
);
void
contextPopped
();
void
contextPathChanged
(
const
QStringList
&
path
);
protected:
void
selectedItemsChanged
(
const
QList
<
QGraphicsItem
*>
&
itemList
);
...
...
@@ -68,6 +70,7 @@ private:
private:
QStack
<
QGraphicsObject
*>
m_currentContext
;
QStringList
m_path
;
qreal
m_animIncrement
;
SubcomponentMaskLayerItem
*
m_mask
;
...
...
src/libs/qmljsdebugger/include/qdeclarativedesigndebugserver.h
View file @
524d4453
...
...
@@ -67,11 +67,11 @@ public:
void
setAnimationSpeed
(
qreal
slowdownFactor
);
void
setCurrentTool
(
QmlViewer
::
Constants
::
DesignTool
toolId
);
void
reloaded
();
QString
idStringForObject
(
QObject
*
obj
)
const
;
public
Q_SLOTS
:
void
selectedColorChanged
(
const
QColor
&
color
);
void
contextPathUpdated
(
const
QStringList
&
contextPath
);
Q_SIGNALS:
void
currentObjectsChanged
(
const
QList
<
QObject
*>
&
objects
);
...
...
src/libs/qmljsdebugger/qdeclarativedesigndebugserver.cpp
View file @
524d4453
...
...
@@ -153,6 +153,17 @@ void QDeclarativeDesignDebugServer::selectedColorChanged(const QColor &color)
sendMessage
(
message
);
}
void
QDeclarativeDesignDebugServer
::
contextPathUpdated
(
const
QStringList
&
contextPath
)
{
QByteArray
message
;
QDataStream
ds
(
&
message
,
QIODevice
::
WriteOnly
);
ds
<<
QByteArray
(
"CONTEXT_PATH_UPDATED"
)
<<
contextPath
;
sendMessage
(
message
);
}
QString
QDeclarativeDesignDebugServer
::
idStringForObject
(
QObject
*
obj
)
const
{
int
id
=
idForObject
(
obj
);
...
...
src/libs/qmljsdebugger/qdeclarativedesignview.cpp
View file @
524d4453
...
...
@@ -104,6 +104,7 @@ QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
connect
(
data
->
subcomponentEditorTool
,
SIGNAL
(
cleared
()),
SIGNAL
(
inspectorContextCleared
()));
connect
(
data
->
subcomponentEditorTool
,
SIGNAL
(
contextPushed
(
QString
)),
SIGNAL
(
inspectorContextPushed
(
QString
)));
connect
(
data
->
subcomponentEditorTool
,
SIGNAL
(
contextPopped
()),
SIGNAL
(
inspectorContextPopped
()));
connect
(
data
->
subcomponentEditorTool
,
SIGNAL
(
contextPathChanged
(
QStringList
)),
qmlDesignDebugServer
(),
SLOT
(
contextPathUpdated
(
QStringList
)));
data
->
createToolbar
();
}
...
...
src/plugins/qmljsinspector/qmljsclientproxy.cpp
View file @
524d4453
...
...
@@ -82,6 +82,8 @@ bool ClientProxy::connectToViewer(const QString &host, quint16 port)
SIGNAL
(
designModeBehaviorChanged
(
bool
)),
this
,
SIGNAL
(
designModeBehaviorChanged
(
bool
)));
disconnect
(
m_designClient
,
SIGNAL
(
selectedColorChanged
(
QColor
)),
this
,
SIGNAL
(
selectedColorChanged
(
QColor
)));
disconnect
(
m_designClient
,
SIGNAL
(
contextPathUpdated
(
QStringList
)),
this
,
SIGNAL
(
contextPathUpdated
(
QStringList
)));
emit
aboutToDisconnect
();
...
...
@@ -227,6 +229,8 @@ void ClientProxy::connectionStateChanged()
SIGNAL
(
designModeBehaviorChanged
(
bool
)),
SIGNAL
(
designModeBehaviorChanged
(
bool
)));
connect
(
m_designClient
,
SIGNAL
(
reloaded
()),
this
,
SIGNAL
(
serverReloaded
()));
connect
(
m_designClient
,
SIGNAL
(
selectedColorChanged
(
QColor
)),
SIGNAL
(
selectedColorChanged
(
QColor
)));
connect
(
m_designClient
,
SIGNAL
(
contextPathUpdated
(
QStringList
)),
SIGNAL
(
contextPathUpdated
(
QStringList
)));
}
(
void
)
new
DebuggerClient
(
m_conn
);
...
...
src/plugins/qmljsinspector/qmljsclientproxy.h
View file @
524d4453
...
...
@@ -93,6 +93,7 @@ signals:
void
designModeBehaviorChanged
(
bool
inDesignMode
);
void
serverReloaded
();
void
selectedColorChanged
(
const
QColor
&
color
);
void
contextPathUpdated
(
const
QStringList
&
contextPath
);
public
slots
:
void
queryEngineContext
(
int
id
);
...
...
src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp
0 → 100644
View file @
524d4453
#include "qmljscontextcrumblepath.h"
#include <QMouseEvent>
#include <QDebug>
namespace
QmlJSInspector
{
namespace
Internal
{
ContextCrumblePath
::
ContextCrumblePath
(
QWidget
*
parent
)
:
CrumblePath
(
parent
)
{
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Preferred
);
}
ContextCrumblePath
::~
ContextCrumblePath
()
{
}
void
ContextCrumblePath
::
updateContextPath
(
const
QStringList
&
path
)
{
clear
();
foreach
(
const
QString
&
pathPart
,
path
)
{
pushElement
(
pathPart
);
}
}
}
// namespace Internal
}
// namespace QmlJSInspector
src/plugins/qmljsinspector/qmljscontextcrumblepath.h
0 → 100644
View file @
524d4453
#ifndef QMLJSCONTEXTCRUMBLEPATH_H
#define QMLJSCONTEXTCRUMBLEPATH_H
#include <utils/crumblepath.h>
#include <QStringList>
namespace
QmlJSInspector
{
namespace
Internal
{
class
ContextCrumblePath
:
public
Utils
::
CrumblePath
{
Q_OBJECT
public:
ContextCrumblePath
(
QWidget
*
parent
=
0
);
virtual
~
ContextCrumblePath
();
public
slots
:
void
updateContextPath
(
const
QStringList
&
path
);
};
}
// namespace Internal
}
// namespace QmlJSInspector
#endif // QMLJSCONTEXTCRUMBLEPATH_H
src/plugins/qmljsinspector/qmljsdesigndebugclient.cpp
View file @
524d4453
...
...
@@ -104,6 +104,10 @@ void QmlJSDesignDebugClient::messageReceived(const QByteArray &message)
QColor
col
;
ds
>>
col
;
emit
selectedColorChanged
(
col
);
}
else
if
(
type
==
"CONTEXT_PATH_UPDATED"
)
{
QStringList
contextPath
;
ds
>>
contextPath
;
emit
contextPathUpdated
(
contextPath
);
}
}
...
...
src/plugins/qmljsinspector/qmljsdesigndebugclient.h
View file @
524d4453
...
...
@@ -85,6 +85,7 @@ signals:
void
animationSpeedChanged
(
qreal
slowdownFactor
);
void
designModeBehaviorChanged
(
bool
inDesignMode
);
void
reloaded
();
// the server has reloaded the document
void
contextPathUpdated
(
const
QStringList
&
path
);
protected:
virtual
void
messageReceived
(
const
QByteArray
&
);
...
...
src/plugins/qmljsinspector/qmljsinspector.cpp
View file @
524d4453
...
...
@@ -32,6 +32,7 @@
#include "qmljsinspectorcontext.h"
#include "qmljslivetextpreview.h"
#include "qmljsprivateapi.h"
#include "qmljscontextcrumblepath.h"
#include <qmljseditor/qmljseditorconstants.h>
...
...
@@ -323,7 +324,7 @@ void Inspector::startQmlProjectDebugger()
void
Inspector
::
resetViews
()
{
//#warning reset the views here
m_crumblePath
->
clear
();
}
void
Inspector
::
simultaneouslyDebugQmlCppApplication
()
...
...
@@ -565,34 +566,15 @@ void Inspector::reloadQmlViewer()
void
Inspector
::
setSimpleDockWidgetArrangement
()
{
#if 0
Utils
::
FancyMainWindow
*
mainWindow
=
Debugger
::
DebuggerUISwitcher
::
instance
()
->
mainWindow
();
mainWindow
->
setTrackingEnabled
(
false
);
QList<QDockWidget *> dockWidgets = mainWindow->dockWidgets();
foreach (QDockWidget *dockWidget, dockWidgets) {
if (m_dockWidgets.contains(dockWidget)) {
dockWidget->setFloating(false);
mainWindow->removeDockWidget(dockWidget);
}
}
foreach (QDockWidget *dockWidget, dockWidgets) {
if (m_dockWidgets.contains(dockWidget)) {
mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
dockWidget->show();
}
}
mainWindow->splitDockWidget(mainWindow->toolBarDockWidget(), m_propertyWatcherDock, Qt::Vertical);
//mainWindow->tabifyDockWidget(m_frameRateDock, m_propertyWatcherDock);
mainWindow->tabifyDockWidget(m_propertyWatcherDock, m_expressionQueryDock);
mainWindow->tabifyDockWidget(m_propertyWatcherDock, m_inspectorOutputDock);
m_propertyWatcherDock->raise();
m_inspectorOutputDock->setVisible(false);
mainWindow
->
removeDockWidget
(
m_crumblePathDock
);
mainWindow
->
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
m_crumblePathDock
);
mainWindow
->
splitDockWidget
(
mainWindow
->
toolBarDockWidget
(),
m_crumblePathDock
,
Qt
::
Vertical
);
//m_crumblePathDock->setVisible(true);
mainWindow
->
setTrackingEnabled
(
true
);
#endif
}
void
Inspector
::
setSelectedItemsByObjectReference
(
QList
<
QDeclarativeDebugObjectReference
>
objectReferences
)
...
...
@@ -651,6 +633,18 @@ bool Inspector::addQuotesForData(const QVariant &value) const
return
false
;
}
void
Inspector
::
createDockWidgets
()
{
m_crumblePath
=
new
ContextCrumblePath
;
m_crumblePath
->
setWindowTitle
(
"Context Path"
);
Debugger
::
DebuggerUISwitcher
*
uiSwitcher
=
Debugger
::
DebuggerUISwitcher
::
instance
();
m_crumblePathDock
=
uiSwitcher
->
createDockWidget
(
QmlJSInspector
::
Constants
::
LANG_QML
,
m_crumblePath
,
Qt
::
BottomDockWidgetArea
);
m_crumblePathDock
->
setAllowedAreas
(
Qt
::
TopDockWidgetArea
|
Qt
::
BottomDockWidgetArea
);
m_crumblePathDock
->
setTitleBarWidget
(
new
QWidget
(
m_crumblePathDock
));
connect
(
m_clientProxy
,
SIGNAL
(
contextPathUpdated
(
QStringList
)),
m_crumblePath
,
SLOT
(
updateContextPath
(
QStringList
)));
}
bool
Inspector
::
showExperimentalWarning
()
{
return
m_showExperimentalWarning
;
...
...
src/plugins/qmljsinspector/qmljsinspector.h
View file @
524d4453
...
...
@@ -58,11 +58,14 @@ namespace QmlJS {
class
ModelManagerInterface
;
}
QT_FORWARD_DECLARE_CLASS
(
QDockWidget
)
namespace
QmlJSInspector
{
namespace
Internal
{
class
ClientProxy
;
class
InspectorContext
;
class
ContextCrumblePath
;
class
QmlJSLiveTextPreview
;
class
Inspector
:
public
QObject
...
...
@@ -96,6 +99,7 @@ public:
static
bool
showExperimentalWarning
();
static
void
setShowExperimentalWarning
(
bool
value
);
void
createDockWidgets
();
signals:
void
statusMessage
(
const
QString
&
text
);
...
...
@@ -164,6 +168,9 @@ private:
static
bool
m_showExperimentalWarning
;
bool
m_listeningToEditorManager
;
ContextCrumblePath
*
m_crumblePath
;
QDockWidget
*
m_crumblePathDock
;
// Qml/JS integration
QHash
<
QString
,
QmlJSLiveTextPreview
*>
m_textPreviews
;
QmlJS
::
Snapshot
m_loadedSnapshot
;
//the snapshot loaded by the viewer
...
...
src/plugins/qmljsinspector/qmljsinspector.pro
View file @
524d4453
...
...
@@ -18,7 +18,8 @@ qmljsinspector.h \
qmlinspectortoolbar
.
h
\
qmljslivetextpreview
.
h
\
qmljstoolbarcolorbox
.
h
\
qmljsdesigndebugclient
.
h
qmljsdesigndebugclient
.
h
\
qmljscontextcrumblepath
.
h
SOURCES
+=
\
qmljsdebuggerclient
.
cpp
\
...
...
@@ -30,6 +31,7 @@ qmlinspectortoolbar.cpp \
qmljslivetextpreview
.
cpp
\
qmljstoolbarcolorbox
.
cpp
\
qmljsdesigndebugclient
.
cpp
\
qmljscontextcrumblepath
.
cpp
include
(..
/../
libs
/
qmljsdebugclient
/
qmljsdebugclient
-
lib
.
pri
)
...
...
@@ -42,4 +44,4 @@ include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
include
(..
/../
plugins
/
coreplugin
/
coreplugin
.
pri
)
include
(..
/../
plugins
/
texteditor
/
texteditor
.
pri
)
include
(..
/../
plugins
/
debugger
/
debugger
.
pri
)
include
(..
/../
libs
/
utils
/
utils
.
pri
)
src/plugins/qmljsinspector/qmljsinspectorplugin.cpp
View file @
524d4453
...
...
@@ -132,13 +132,7 @@ bool InspectorPlugin::initialize(const QStringList &arguments, QString *errorStr
uiSwitcher
->
addLanguage
(
LANG_QML
,
Core
::
Context
(
C_INSPECTOR
));
#ifdef __GNUC__
# warning set up the QML/JS Inspector UI
#endif
#if 0
_inspector
->
createDockWidgets
();
#endif
return
true
;
}
...
...
@@ -177,6 +171,8 @@ void InspectorPlugin::extensionsInitialized()
connect
(
_clientProxy
,
SIGNAL
(
selectedColorChanged
(
QColor
)),
m_toolbar
,
SLOT
(
setSelectedColor
(
QColor
)));
connect
(
_clientProxy
,
SIGNAL
(
animationSpeedChanged
(
qreal
)),
m_toolbar
,
SLOT
(
changeAnimationSpeed
(
qreal
)));
}
void
InspectorPlugin
::
activateDebuggerForProject
(
ProjectExplorer
::
Project
*
project
,
const
QString
&
runMode
)
...
...
@@ -214,12 +210,8 @@ void InspectorPlugin::prepareDebugger(Core::IMode *mode)
void
InspectorPlugin
::
setDockWidgetArrangement
(
const
QString
&
activeLanguage
)
{
Q_UNUSED
(
activeLanguage
);
#if 0
if (activeLanguage == Qml::Constants::LANG_QML || activeLanguage.isEmpty())
m_inspector->setSimpleDockWidgetArrangement();
#endif
if
(
activeLanguage
==
QmlJSInspector
::
Constants
::
LANG_QML
||
activeLanguage
.
isEmpty
())
_inspector
->
setSimpleDockWidgetArrangement
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment