forked from qt-creator/qt-creator
QmlDebug: Rename some members of QmlDebugConnection
This is to adopt the naming to the code in src/qmldebug in qtdeclarative. Once we can require a version of Qt that has qmldebug for building QtCreator we can then remove our own version of this code. Change-Id: I573f0703871b5812789c5c7a6287567d5c2875e6 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -232,7 +232,7 @@ void DeclarativeToolsClient::reload(const QHash<QString,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(changesHash);
|
Q_UNUSED(changesHash);
|
||||||
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -248,7 +248,7 @@ void DeclarativeToolsClient::reload(const QHash<QString,
|
|||||||
|
|
||||||
void DeclarativeToolsClient::setDesignModeBehavior(bool inDesignMode)
|
void DeclarativeToolsClient::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -265,7 +265,7 @@ void DeclarativeToolsClient::setDesignModeBehavior(bool inDesignMode)
|
|||||||
|
|
||||||
void DeclarativeToolsClient::changeToSelectTool()
|
void DeclarativeToolsClient::changeToSelectTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -283,7 +283,7 @@ void DeclarativeToolsClient::changeToSelectTool()
|
|||||||
|
|
||||||
void DeclarativeToolsClient::changeToSelectMarqueeTool()
|
void DeclarativeToolsClient::changeToSelectMarqueeTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -301,7 +301,7 @@ void DeclarativeToolsClient::changeToSelectMarqueeTool()
|
|||||||
|
|
||||||
void DeclarativeToolsClient::changeToZoomTool()
|
void DeclarativeToolsClient::changeToZoomTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -319,7 +319,7 @@ void DeclarativeToolsClient::changeToZoomTool()
|
|||||||
|
|
||||||
void DeclarativeToolsClient::showAppOnTop(bool showOnTop)
|
void DeclarativeToolsClient::showAppOnTop(bool showOnTop)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c)
|
|||||||
|
|
||||||
void QmlDebugConnectionPrivate::advertisePlugins()
|
void QmlDebugConnectionPrivate::advertisePlugins()
|
||||||
{
|
{
|
||||||
if (!q->isOpen())
|
if (!gotHello)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPacket pack(currentDataStreamVersion);
|
QPacket pack(currentDataStreamVersion);
|
||||||
@@ -113,7 +113,7 @@ void QmlDebugConnectionPrivate::disconnected()
|
|||||||
QHash<QString, QmlDebugClient*>::iterator iter = plugins.begin();
|
QHash<QString, QmlDebugClient*>::iterator iter = plugins.begin();
|
||||||
for (; iter != plugins.end(); ++iter)
|
for (; iter != plugins.end(); ++iter)
|
||||||
iter.value()->stateChanged(QmlDebugClient::NotConnected);
|
iter.value()->stateChanged(QmlDebugClient::NotConnected);
|
||||||
emit q->closed();
|
emit q->disconnected();
|
||||||
}
|
}
|
||||||
delete protocol;
|
delete protocol;
|
||||||
protocol = 0;
|
protocol = 0;
|
||||||
@@ -191,7 +191,7 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
newState = QmlDebugClient::Enabled;
|
newState = QmlDebugClient::Enabled;
|
||||||
iter.value()->stateChanged(newState);
|
iter.value()->stateChanged(newState);
|
||||||
}
|
}
|
||||||
emit q->opened();
|
emit q->connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (protocol && protocol->packetsAvailable()) {
|
while (protocol && protocol->packetsAvailable()) {
|
||||||
@@ -292,7 +292,7 @@ QmlDebugConnection::~QmlDebugConnection()
|
|||||||
iter.value()->d_func()->connection = 0;
|
iter.value()->d_func()->connection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlDebugConnection::isOpen() const
|
bool QmlDebugConnection::isConnected() const
|
||||||
{
|
{
|
||||||
// gotHello can only be set if the connection is open.
|
// gotHello can only be set if the connection is open.
|
||||||
return d->gotHello;
|
return d->gotHello;
|
||||||
@@ -300,7 +300,7 @@ bool QmlDebugConnection::isOpen() const
|
|||||||
|
|
||||||
bool QmlDebugConnection::isConnecting() const
|
bool QmlDebugConnection::isConnecting() const
|
||||||
{
|
{
|
||||||
return !isOpen() && d->device;
|
return !isConnected() && d->device;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDebugConnection::close()
|
void QmlDebugConnection::close()
|
||||||
@@ -309,6 +309,11 @@ void QmlDebugConnection::close()
|
|||||||
d->device->close(); // will trigger disconnected() at some point.
|
d->device->close(); // will trigger disconnected() at some point.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float QmlDebugConnection::serviceVersion(const QString &serviceName) const
|
||||||
|
{
|
||||||
|
return d->serverPlugins.value(serviceName, -1);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlDebugConnectionPrivate::flush()
|
void QmlDebugConnectionPrivate::flush()
|
||||||
{
|
{
|
||||||
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(device);
|
QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(device);
|
||||||
@@ -387,22 +392,22 @@ QString QmlDebugClient::name() const
|
|||||||
return d->name;
|
return d->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlDebugClient::remoteVersion() const
|
float QmlDebugClient::serviceVersion() const
|
||||||
{
|
{
|
||||||
Q_D(const QmlDebugClient);
|
Q_D(const QmlDebugClient);
|
||||||
// The version is internally saved as float for compatibility reasons. Exposing that to clients
|
// The version is internally saved as float for compatibility reasons. Exposing that to clients
|
||||||
// is a bad idea because floats cannot be properly compared. IEEE 754 floats represent integers
|
// is a bad idea because floats cannot be properly compared. IEEE 754 floats represent integers
|
||||||
// exactly up to about 2^24, so the cast shouldn't be a problem for any realistic version
|
// exactly up to about 2^24, so the cast shouldn't be a problem for any realistic version
|
||||||
// numbers.
|
// numbers.
|
||||||
if (d->connection && d->connection->d->serverPlugins.contains(d->name))
|
if (d->connection)
|
||||||
return static_cast<int>(d->connection->d->serverPlugins.value(d->name));
|
return d->connection->serviceVersion(d->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDebugClient::State QmlDebugClient::state() const
|
QmlDebugClient::State QmlDebugClient::state() const
|
||||||
{
|
{
|
||||||
Q_D(const QmlDebugClient);
|
Q_D(const QmlDebugClient);
|
||||||
if (!d->connection || !d->connection->isOpen())
|
if (!d->connection || !d->connection->isConnected())
|
||||||
return NotConnected;
|
return NotConnected;
|
||||||
|
|
||||||
if (d->connection->d->serverPlugins.contains(d->name))
|
if (d->connection->d->serverPlugins.contains(d->name))
|
||||||
|
|||||||
@@ -59,14 +59,15 @@ public:
|
|||||||
int currentDataStreamVersion() const;
|
int currentDataStreamVersion() const;
|
||||||
void setMaximumDataStreamVersion(int maximumVersion);
|
void setMaximumDataStreamVersion(int maximumVersion);
|
||||||
|
|
||||||
bool isOpen() const;
|
bool isConnected() const;
|
||||||
bool isConnecting() const;
|
bool isConnecting() const;
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
float serviceVersion(const QString &serviceName) const;
|
||||||
signals:
|
signals:
|
||||||
void opened();
|
void connected();
|
||||||
|
void disconnected();
|
||||||
void error(QDebugSupport::Error);
|
void error(QDebugSupport::Error);
|
||||||
void closed();
|
|
||||||
void stateMessage(const QString &message);
|
void stateMessage(const QString &message);
|
||||||
void errorMessage(const QString &message);
|
void errorMessage(const QString &message);
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ public:
|
|||||||
~QmlDebugClient();
|
~QmlDebugClient();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
int remoteVersion() const;
|
float serviceVersion() const;
|
||||||
State state() const;
|
State state() const;
|
||||||
QmlDebugConnection *connection() const;
|
QmlDebugConnection *connection() const;
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void QmlToolsClient::setObjectIdList(
|
|||||||
|
|
||||||
void QmlToolsClient::reload(const QHash<QString, QByteArray> &changesHash)
|
void QmlToolsClient::reload(const QHash<QString, QByteArray> &changesHash)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_reloadQueryId = m_requestId;
|
m_reloadQueryId = m_requestId;
|
||||||
@@ -123,7 +123,7 @@ void QmlToolsClient::reload(const QHash<QString, QByteArray> &changesHash)
|
|||||||
|
|
||||||
void QmlToolsClient::setDesignModeBehavior(bool inDesignMode)
|
void QmlToolsClient::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
@@ -156,7 +156,7 @@ void QmlToolsClient::changeToZoomTool()
|
|||||||
|
|
||||||
void QmlToolsClient::showAppOnTop(bool showOnTop)
|
void QmlToolsClient::showAppOnTop(bool showOnTop)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
|
|||||||
@@ -297,11 +297,11 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
|||||||
this, &QmlEngine::showConnectionErrorMessage);
|
this, &QmlEngine::showConnectionErrorMessage);
|
||||||
connect(d->connection, &QmlDebugConnection::error,
|
connect(d->connection, &QmlDebugConnection::error,
|
||||||
this, &QmlEngine::connectionErrorOccurred);
|
this, &QmlEngine::connectionErrorOccurred);
|
||||||
connect(d->connection, &QmlDebugConnection::opened,
|
connect(d->connection, &QmlDebugConnection::connected,
|
||||||
&d->connectionTimer, &QTimer::stop);
|
&d->connectionTimer, &QTimer::stop);
|
||||||
connect(d->connection, &QmlDebugConnection::opened,
|
connect(d->connection, &QmlDebugConnection::connected,
|
||||||
this, &QmlEngine::connectionEstablished);
|
this, &QmlEngine::connectionEstablished);
|
||||||
connect(d->connection, &QmlDebugConnection::closed,
|
connect(d->connection, &QmlDebugConnection::disconnected,
|
||||||
this, &QmlEngine::disconnected);
|
this, &QmlEngine::disconnected);
|
||||||
|
|
||||||
d->msgClient = new QDebugMessageClient(d->connection);
|
d->msgClient = new QDebugMessageClient(d->connection);
|
||||||
@@ -398,7 +398,7 @@ void QmlEngine::beginConnection(quint16 port)
|
|||||||
if (runParameters().qmlServerPort > 0)
|
if (runParameters().qmlServerPort > 0)
|
||||||
port = runParameters().qmlServerPort;
|
port = runParameters().qmlServerPort;
|
||||||
|
|
||||||
if (!d->connection || d->connection->isOpen())
|
if (!d->connection || d->connection->isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->connection->connectToHost(host, port);
|
d->connection->connectToHost(host, port);
|
||||||
@@ -1236,7 +1236,7 @@ void QmlEngine::clientStateChanged(QmlDebugClient::State state)
|
|||||||
float version = 0;
|
float version = 0;
|
||||||
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
|
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
|
||||||
serviceName = client->name();
|
serviceName = client->name();
|
||||||
version = client->remoteVersion();
|
version = client->serviceVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
logServiceStateChange(serviceName, version, state);
|
logServiceStateChange(serviceName, version, state);
|
||||||
@@ -1252,7 +1252,7 @@ void QmlEngine::checkConnectionState()
|
|||||||
|
|
||||||
bool QmlEngine::isConnected() const
|
bool QmlEngine::isConnected() const
|
||||||
{
|
{
|
||||||
return d->connection->isOpen();
|
return d->connection->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::showConnectionStateMessage(const QString &message)
|
void QmlEngine::showConnectionStateMessage(const QString &message)
|
||||||
|
|||||||
@@ -714,7 +714,7 @@ void QmlInspectorAgent::clientStateChanged(QmlDebugClient::State state)
|
|||||||
float version = 0;
|
float version = 0;
|
||||||
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
|
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
|
||||||
serviceName = client->name();
|
serviceName = client->name();
|
||||||
version = client->remoteVersion();
|
version = client->serviceVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_qmlEngine->logServiceStateChange(serviceName, version, state);
|
m_qmlEngine->logServiceStateChange(serviceName, version, state);
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ void QmlProfilerClientManager::connectClient(quint16 port)
|
|||||||
this, &QmlProfilerClientManager::logState);
|
this, &QmlProfilerClientManager::logState);
|
||||||
connect(d->connection, &QmlDebugConnection::errorMessage,
|
connect(d->connection, &QmlDebugConnection::errorMessage,
|
||||||
this, &QmlProfilerClientManager::logState);
|
this, &QmlProfilerClientManager::logState);
|
||||||
connect(d->connection, &QmlDebugConnection::opened,
|
connect(d->connection, &QmlDebugConnection::connected,
|
||||||
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
|
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
|
||||||
connect(d->connection, &QmlDebugConnection::closed,
|
connect(d->connection, &QmlDebugConnection::disconnected,
|
||||||
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
|
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
|
||||||
connect(d->connection, &QmlDebugConnection::error,
|
connect(d->connection, &QmlDebugConnection::error,
|
||||||
this, &QmlProfilerClientManager::qmlDebugConnectionError);
|
this, &QmlProfilerClientManager::qmlDebugConnectionError);
|
||||||
@@ -208,7 +208,7 @@ void QmlProfilerClientManager::disconnectClientSignals()
|
|||||||
|
|
||||||
void QmlProfilerClientManager::connectToClient()
|
void QmlProfilerClientManager::connectToClient()
|
||||||
{
|
{
|
||||||
if (!d->connection || d->connection->isOpen() || d->connection->isConnecting())
|
if (!d->connection || d->connection->isConnected() || d->connection->isConnecting())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
||||||
@@ -216,7 +216,7 @@ void QmlProfilerClientManager::connectToClient()
|
|||||||
|
|
||||||
bool QmlProfilerClientManager::isConnected() const
|
bool QmlProfilerClientManager::isConnected() const
|
||||||
{
|
{
|
||||||
return d->connection && d->connection->isOpen();
|
return d->connection && d->connection->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerClientManager::disconnectClient()
|
void QmlProfilerClientManager::disconnectClient()
|
||||||
@@ -233,7 +233,7 @@ void QmlProfilerClientManager::tryToConnect()
|
|||||||
{
|
{
|
||||||
++d->connectionAttempts;
|
++d->connectionAttempts;
|
||||||
|
|
||||||
if (d->connection && d->connection->isOpen()) {
|
if (d->connection && d->connection->isConnected()) {
|
||||||
d->connectionTimer.stop();
|
d->connectionTimer.stop();
|
||||||
d->connectionAttempts = 0;
|
d->connectionAttempts = 0;
|
||||||
} else if (d->connectionAttempts == 50) {
|
} else if (d->connectionAttempts == 50) {
|
||||||
@@ -276,7 +276,7 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed()
|
|||||||
void QmlProfilerClientManager::qmlDebugConnectionError(QDebugSupport::Error error)
|
void QmlProfilerClientManager::qmlDebugConnectionError(QDebugSupport::Error error)
|
||||||
{
|
{
|
||||||
logState(tr("Debug connection error %1").arg(error));
|
logState(tr("Debug connection error %1").arg(error));
|
||||||
if (d->connection->isOpen()) {
|
if (d->connection->isConnected()) {
|
||||||
disconnectClient();
|
disconnectClient();
|
||||||
emit connectionClosed();
|
emit connectionClosed();
|
||||||
} else {
|
} else {
|
||||||
@@ -295,7 +295,7 @@ void QmlProfilerClientManager::logState(const QString &msg)
|
|||||||
void QmlProfilerClientManager::retryMessageBoxFinished(int result)
|
void QmlProfilerClientManager::retryMessageBoxFinished(int result)
|
||||||
{
|
{
|
||||||
if (d->connection) {
|
if (d->connection) {
|
||||||
QTC_ASSERT(!d->connection->isOpen(), return);
|
QTC_ASSERT(!d->connection->isConnected(), return);
|
||||||
if (d->connection->isConnecting())
|
if (d->connection->isConnecting())
|
||||||
d->connection->disconnect();
|
d->connection->disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user