Commit b7751043 authored by Ulf Hermann's avatar Ulf Hermann

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: default avatarKai Koehne <kai.koehne@digia.com>
parent ba5c136a
......@@ -329,11 +329,15 @@ QString QmlDebugClient::name() const
return d->name;
}
float QmlDebugClient::serviceVersion() const
int QmlDebugClient::remoteVersion() const
{
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))
return d->connection->d->serverPlugins.value(d->name);
return static_cast<int>(d->connection->d->serverPlugins.value(d->name));
return -1;
}
......
......@@ -78,7 +78,7 @@ public:
~QmlDebugClient();
QString name() const;
float serviceVersion() const;
int remoteVersion() const;
State state() const;
virtual void sendMessage(const QByteArray &);
......
......@@ -119,7 +119,7 @@ void QmlAdapter::clientStateChanged(QmlDebugClient::State state)
float version = 0;
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
serviceName = client->name();
version = client->serviceVersion();
version = client->remoteVersion();
}
logServiceStateChange(serviceName, version, state);
......
......@@ -190,7 +190,7 @@ void QmlInspectorAdapter::clientStateChanged(QmlDebugClient::State state)
float version = 0;
if (QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender())) {
serviceName = client->name();
version = client->serviceVersion();
version = client->remoteVersion();
}
m_debugAdapter->logServiceStateChange(serviceName, version, state);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment