forked from qt-creator/qt-creator
QmlDebugClient: rename serviceVersion to remoteVersion and return int
The name change is in preparation for the upcoming unification of the debug server and client APIs. Expressing versions as floats is pretty useless as we cannot properly compare them. Besides, so far we're using exactly 3 different versions: -1 (a.k.a. invalid), 1, and 2. Change-Id: Ie4012d09362009b08a1263b15bc552731a1f255e Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -329,11 +329,15 @@ QString QmlDebugClient::name() const
|
|||||||
return d->name;
|
return d->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
float QmlDebugClient::serviceVersion() const
|
int QmlDebugClient::remoteVersion() const
|
||||||
{
|
{
|
||||||
Q_D(const QmlDebugClient);
|
Q_D(const QmlDebugClient);
|
||||||
|
// 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
|
||||||
|
// exactly up to about 2^24, so the cast shouldn't be a problem for any realistic version
|
||||||
|
// numbers.
|
||||||
if (d->connection && d->connection->d->serverPlugins.contains(d->name))
|
if (d->connection && d->connection->d->serverPlugins.contains(d->name))
|
||||||
return d->connection->d->serverPlugins.value(d->name);
|
return static_cast<int>(d->connection->d->serverPlugins.value(d->name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
~QmlDebugClient();
|
~QmlDebugClient();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
float serviceVersion() const;
|
int remoteVersion() const;
|
||||||
State state() const;
|
State state() const;
|
||||||
|
|
||||||
virtual void sendMessage(const QByteArray &);
|
virtual void sendMessage(const QByteArray &);
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ void QmlAdapter::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->serviceVersion();
|
version = client->remoteVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
logServiceStateChange(serviceName, version, state);
|
logServiceStateChange(serviceName, version, state);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void QmlInspectorAdapter::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->serviceVersion();
|
version = client->remoteVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_debugAdapter->logServiceStateChange(serviceName, version, state);
|
m_debugAdapter->logServiceStateChange(serviceName, version, state);
|
||||||
|
|||||||
Reference in New Issue
Block a user