Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
226a82d3
Commit
226a82d3
authored
Sep 30, 2010
by
Kai Koehne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlDebugger: Log status of different services
Reviewed-by: Christiaan Janssen
parent
8ad34357
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
102 additions
and
23 deletions
+102
-23
src/plugins/debugger/qml/qmladapter.cpp
src/plugins/debugger/qml/qmladapter.cpp
+35
-0
src/plugins/debugger/qml/qmladapter.h
src/plugins/debugger/qml/qmladapter.h
+5
-0
src/plugins/debugger/qml/qmldebuggerclient.cpp
src/plugins/debugger/qml/qmldebuggerclient.cpp
+5
-0
src/plugins/debugger/qml/qmldebuggerclient.h
src/plugins/debugger/qml/qmldebuggerclient.h
+2
-0
src/plugins/debugger/qml/qmlengine.cpp
src/plugins/debugger/qml/qmlengine.cpp
+7
-0
src/plugins/debugger/qml/qmlengine.h
src/plugins/debugger/qml/qmlengine.h
+1
-0
src/plugins/qmljsinspector/qmljsclientproxy.cpp
src/plugins/qmljsinspector/qmljsclientproxy.cpp
+38
-22
src/plugins/qmljsinspector/qmljsclientproxy.h
src/plugins/qmljsinspector/qmljsclientproxy.h
+1
-1
src/plugins/qmljsinspector/qmljsobserverclient.cpp
src/plugins/qmljsinspector/qmljsobserverclient.cpp
+5
-0
src/plugins/qmljsinspector/qmljsobserverclient.h
src/plugins/qmljsinspector/qmljsobserverclient.h
+3
-0
No files found.
src/plugins/debugger/qml/qmladapter.cpp
View file @
226a82d3
...
...
@@ -143,6 +143,16 @@ void QmlAdapter::connectionErrorOccurred(QAbstractSocket::SocketError socketErro
emit
connectionError
(
socketError
);
}
void
QmlAdapter
::
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
status
)
{
QString
serviceName
;
if
(
QDeclarativeDebugClient
*
client
=
qobject_cast
<
QDeclarativeDebugClient
*>
(
sender
()))
{
serviceName
=
client
->
name
();
}
logServiceStatusChange
(
serviceName
,
status
);
}
void
QmlAdapter
::
connectionStateChanged
()
{
switch
(
d
->
m_conn
->
state
())
{
...
...
@@ -165,6 +175,7 @@ void QmlAdapter::connectionStateChanged()
if
(
!
d
->
m_mainClient
)
{
d
->
m_mainClient
=
new
QDeclarativeEngineDebug
(
d
->
m_conn
,
this
);
logServiceStatusChange
(
QLatin1String
(
"QmlObserver"
),
static_cast
<
QDeclarativeDebugClient
::
Status
>
(
d
->
m_mainClient
->
status
()));
}
createDebuggerClient
();
...
...
@@ -185,11 +196,15 @@ void QmlAdapter::createDebuggerClient()
{
d
->
m_qmlClient
=
new
Internal
::
QmlDebuggerClient
(
d
->
m_conn
);
connect
(
d
->
m_qmlClient
,
SIGNAL
(
newStatus
(
QDeclarativeDebugClient
::
Status
)),
this
,
SLOT
(
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
)));
connect
(
d
->
m_engine
.
data
(),
SIGNAL
(
sendMessage
(
QByteArray
)),
d
->
m_qmlClient
,
SLOT
(
slotSendMessage
(
QByteArray
)));
connect
(
d
->
m_qmlClient
,
SIGNAL
(
messageWasReceived
(
QByteArray
)),
d
->
m_engine
.
data
(),
SLOT
(
messageReceived
(
QByteArray
)));
logServiceStatusChange
(
d
->
m_qmlClient
->
name
(),
d
->
m_qmlClient
->
status
());
//engine->startSuccessful(); // FIXME: AAA: port to new debugger states
}
...
...
@@ -237,4 +252,24 @@ void QmlAdapter::setConnectionAttemptInterval(int interval)
d
->
m_connectionTimer
->
setInterval
(
interval
);
}
void
QmlAdapter
::
logServiceStatusChange
(
const
QString
&
service
,
QDeclarativeDebugClient
::
Status
newStatus
)
{
switch
(
newStatus
)
{
case
QDeclarativeDebugClient
::
Unavailable
:
{
showConnectionErrorMessage
(
tr
(
"Error: Cannot connect to debug service '%1'. Debugging functionality will be limited."
).
arg
(
service
));
emit
serviceConnectionError
(
service
);
break
;
}
case
QDeclarativeDebugClient
::
Enabled
:
{
showConnectionStatusMessage
(
tr
(
"Connected to debug service '%1'."
).
arg
(
service
));
break
;
}
case
QDeclarativeDebugClient
::
NotConnected
:
{
showConnectionStatusMessage
(
tr
(
"Not connected to debug service '%1'."
).
arg
(
service
));
break
;
}
}
}
}
// namespace Debugger
src/plugins/debugger/qml/qmladapter.h
View file @
226a82d3
...
...
@@ -36,6 +36,7 @@
#include "debugger_global.h"
#include <QtNetwork/QAbstractSocket>
#include "qmldebuggerclient.h"
namespace
QmlJsDebugClient
{
class
QDeclarativeEngineDebug
;
...
...
@@ -72,15 +73,19 @@ public:
void
setMaxConnectionAttempts
(
int
maxAttempts
);
void
setConnectionAttemptInterval
(
int
interval
);
void
logServiceStatusChange
(
const
QString
&
service
,
QDeclarativeDebugClient
::
Status
newStatus
);
signals:
void
aboutToDisconnect
();
void
connected
();
void
disconnected
();
void
connectionStartupFailed
();
void
connectionError
(
QAbstractSocket
::
SocketError
socketError
);
void
serviceConnectionError
(
const
QString
serviceName
);
private
slots
:
void
connectionErrorOccurred
(
QAbstractSocket
::
SocketError
socketError
);
void
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
status
);
void
connectionStateChanged
();
void
pollInferior
();
...
...
src/plugins/debugger/qml/qmldebuggerclient.cpp
View file @
226a82d3
...
...
@@ -43,6 +43,11 @@ QmlDebuggerClient::~QmlDebuggerClient()
{
}
void
QmlDebuggerClient
::
statusChanged
(
Status
status
)
{
emit
newStatus
(
status
);
}
void
QmlDebuggerClient
::
messageReceived
(
const
QByteArray
&
data
)
{
emit
messageWasReceived
(
data
);
...
...
src/plugins/debugger/qml/qmldebuggerclient.h
View file @
226a82d3
...
...
@@ -44,12 +44,14 @@ public:
virtual
~
QmlDebuggerClient
();
signals:
void
newStatus
(
QDeclarativeDebugClient
::
Status
status
);
void
messageWasReceived
(
const
QByteArray
&
data
);
private
Q_SLOTS
:
void
slotSendMessage
(
const
QByteArray
&
message
);
protected:
virtual
void
statusChanged
(
Status
status
);
virtual
void
messageReceived
(
const
QByteArray
&
data
);
};
...
...
src/plugins/debugger/qml/qmlengine.cpp
View file @
226a82d3
...
...
@@ -218,6 +218,12 @@ void QmlEngine::connectionError(QAbstractSocket::SocketError socketError)
plugin
()
->
showMessage
(
tr
(
"QML Debugger: Remote host closed connection."
),
StatusBar
);
}
void
QmlEngine
::
serviceConnectionError
(
const
QString
&
serviceName
)
{
plugin
()
->
showMessage
(
tr
(
"QML Debugger: Couldn't connect to service '%1'."
).
arg
(
serviceName
),
StatusBar
);
}
void
QmlEngine
::
runEngine
()
{
QTC_ASSERT
(
state
()
==
EngineRunRequested
,
qDebug
()
<<
state
());
...
...
@@ -327,6 +333,7 @@ void QmlEngine::setupEngine()
d
->
m_adapter
->
setConnectionAttemptInterval
(
ConnectionAttemptDefaultInterval
);
connect
(
d
->
m_adapter
,
SIGNAL
(
connectionError
(
QAbstractSocket
::
SocketError
)),
SLOT
(
connectionError
(
QAbstractSocket
::
SocketError
)));
connect
(
d
->
m_adapter
,
SIGNAL
(
serviceConnectionError
(
QString
)),
SLOT
(
serviceConnectionError
(
QString
)));
connect
(
d
->
m_adapter
,
SIGNAL
(
connected
()),
SLOT
(
connectionEstablished
()));
connect
(
d
->
m_adapter
,
SIGNAL
(
connectionStartupFailed
()),
SLOT
(
connectionStartupFailed
()));
...
...
src/plugins/debugger/qml/qmlengine.h
View file @
226a82d3
...
...
@@ -117,6 +117,7 @@ private slots:
void
connectionEstablished
();
void
connectionStartupFailed
();
void
connectionError
(
QAbstractSocket
::
SocketError
error
);
void
serviceConnectionError
(
const
QString
&
service
);
private:
void
expandObject
(
const
QByteArray
&
iname
,
quint64
objectId
);
...
...
src/plugins/qmljsinspector/qmljsclientproxy.cpp
View file @
226a82d3
...
...
@@ -65,8 +65,14 @@ ClientProxy::ClientProxy(Debugger::QmlAdapter *adapter, QObject *parent)
void
ClientProxy
::
connectToServer
()
{
m_designClient
=
new
QmlJSObserverClient
(
m_adapter
->
connection
(),
this
);
emit
connected
();
if
(
m_designClient
->
status
()
==
QDeclarativeDebugClient
::
Enabled
)
emit
connected
();
m_adapter
->
logServiceStatusChange
(
m_designClient
->
name
(),
m_designClient
->
status
());
connect
(
m_designClient
,
SIGNAL
(
connectedStatusChanged
(
QDeclarativeDebugClient
::
Status
)),
this
,
SLOT
(
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
)));
connect
(
m_designClient
,
SIGNAL
(
currentObjectsChanged
(
QList
<
int
>
)),
SLOT
(
onCurrentObjectsChanged
(
QList
<
int
>
)));
connect
(
m_designClient
,
SIGNAL
(
colorPickerActivated
()),
...
...
@@ -90,9 +96,24 @@ void ClientProxy::connectToServer()
reloadEngines
();
}
void
ClientProxy
::
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
status
)
{
QString
serviceName
;
if
(
QDeclarativeDebugClient
*
client
=
qobject_cast
<
QDeclarativeDebugClient
*>
(
sender
()))
{
serviceName
=
client
->
name
();
}
m_adapter
->
logServiceStatusChange
(
serviceName
,
status
);
if
(
status
==
QDeclarativeDebugClient
::
Enabled
)
emit
connected
();
}
void
ClientProxy
::
disconnectFromServer
()
{
if
(
m_designClient
)
{
disconnect
(
m_designClient
,
SIGNAL
(
connectedStatusChanged
(
QDeclarativeDebugClient
::
Status
)),
this
,
SLOT
(
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
)));
disconnect
(
m_designClient
,
SIGNAL
(
currentObjectsChanged
(
QList
<
int
>
)),
this
,
SLOT
(
onCurrentObjectsChanged
(
QList
<
int
>
)));
disconnect
(
m_designClient
,
SIGNAL
(
colorPickerActivated
()),
...
...
@@ -164,7 +185,7 @@ void ClientProxy::onCurrentObjectsChanged(const QList< int >& debugIds, bool req
void
ClientProxy
::
setSelectedItemsByObjectId
(
const
QList
<
QDeclarativeDebugObjectReference
>
&
objectRefs
)
{
if
(
isConnected
()
&&
m_designClient
)
if
(
isConnected
())
m_designClient
->
setSelectedItemsByObjectId
(
objectRefs
);
}
...
...
@@ -285,7 +306,7 @@ QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectD
void
ClientProxy
::
clearComponentCache
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
clearComponentCache
();
}
...
...
@@ -365,7 +386,7 @@ void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state)
buildDebugIdHashRecursive
(
it
);
emit
objectTreeUpdated
();
if
(
is
DesignClient
Connected
())
{
if
(
isConnected
())
{
if
(
!
m_designClient
->
selectedItemIds
().
isEmpty
())
onCurrentObjectsChanged
(
m_designClient
->
selectedItemIds
(),
false
);
...
...
@@ -410,76 +431,70 @@ void ClientProxy::buildDebugIdHashRecursive(const QDeclarativeDebugObjectReferen
void
ClientProxy
::
reloadQmlViewer
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
reloadViewer
();
}
void
ClientProxy
::
setDesignModeBehavior
(
bool
inDesignMode
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
setDesignModeBehavior
(
inDesignMode
);
}
void
ClientProxy
::
setAnimationSpeed
(
qreal
slowdownFactor
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
setAnimationSpeed
(
slowdownFactor
);
}
void
ClientProxy
::
changeToColorPickerTool
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
changeToColorPickerTool
();
}
void
ClientProxy
::
changeToZoomTool
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
changeToZoomTool
();
}
void
ClientProxy
::
changeToSelectTool
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
changeToSelectTool
();
}
void
ClientProxy
::
changeToSelectMarqueeTool
()
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
changeToSelectMarqueeTool
();
}
void
ClientProxy
::
createQmlObject
(
const
QString
&
qmlText
,
int
parentDebugId
,
const
QStringList
&
imports
,
const
QString
&
filename
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
createQmlObject
(
qmlText
,
parentDebugId
,
imports
,
filename
);
}
void
ClientProxy
::
destroyQmlObject
(
int
debugId
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
destroyQmlObject
(
debugId
);
}
void
ClientProxy
::
reparentQmlObject
(
int
debugId
,
int
newParent
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
reparentQmlObject
(
debugId
,
newParent
);
}
void
ClientProxy
::
setContextPathIndex
(
int
contextIndex
)
{
if
(
is
DesignClient
Connected
())
if
(
isConnected
())
m_designClient
->
setContextPathIndex
(
contextIndex
);
}
bool
ClientProxy
::
isDesignClientConnected
()
const
{
return
(
m_designClient
&&
m_adapter
->
isConnected
());
}
void
ClientProxy
::
reloadEngines
()
{
if
(
m_engineQuery
)
{
...
...
@@ -518,7 +533,8 @@ Debugger::QmlAdapter *ClientProxy::qmlAdapter() const
bool
ClientProxy
::
isConnected
()
const
{
return
m_adapter
->
isConnected
();
return
m_designClient
&&
m_designClient
->
status
()
==
QDeclarativeDebugClient
::
Enabled
&&
m_client
&&
m_client
->
status
()
==
QDeclarativeEngineDebug
::
Enabled
;
}
void
ClientProxy
::
newObjects
()
...
...
src/plugins/qmljsinspector/qmljsclientproxy.h
View file @
226a82d3
...
...
@@ -125,6 +125,7 @@ public slots:
private
slots
:
void
disconnectFromServer
();
void
connectToServer
();
void
clientStatusChanged
(
QDeclarativeDebugClient
::
Status
status
);
void
contextChanged
();
...
...
@@ -135,7 +136,6 @@ private slots:
void
newObjects
();
private:
bool
isDesignClientConnected
()
const
;
void
reloadEngines
();
QList
<
QDeclarativeDebugObjectReference
>
objectReferences
(
const
QDeclarativeDebugObjectReference
&
objectRef
)
const
;
...
...
src/plugins/qmljsinspector/qmljsobserverclient.cpp
View file @
226a82d3
...
...
@@ -55,6 +55,11 @@ QmlJSObserverClient::QmlJSObserverClient(QDeclarativeDebugConnection *client,
{
}
void
QmlJSObserverClient
::
statusChanged
(
Status
status
)
{
emit
connectedStatusChanged
(
status
);
}
void
QmlJSObserverClient
::
messageReceived
(
const
QByteArray
&
message
)
{
QDataStream
ds
(
message
);
...
...
src/plugins/qmljsinspector/qmljsobserverclient.h
View file @
226a82d3
...
...
@@ -80,6 +80,8 @@ public:
void
clearComponentCache
();
signals:
void
connectedStatusChanged
(
QDeclarativeDebugClient
::
Status
status
);
void
currentObjectsChanged
(
const
QList
<
int
>
&
debugIds
);
void
selectedColorChanged
(
const
QColor
&
color
);
void
colorPickerActivated
();
...
...
@@ -92,6 +94,7 @@ signals:
void
contextPathUpdated
(
const
QStringList
&
path
);
protected:
virtual
void
statusChanged
(
Status
);
virtual
void
messageReceived
(
const
QByteArray
&
);
private:
...
...
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