23 #include "serversummary.h"
25 #include "serverapi/server.h"
27 ServerSummary::ServerSummary(
const Server *server)
29 setAddress(server->
address().toString());
30 setPort(server->
port());
32 setName(server->
name());
35 ServerSummary ServerSummary::deserializeQVariant(
const QVariant &v)
37 QVariantMap m = v.toMap();
39 o.setAddress(m[
"address"].toString());
40 o.setGame(m[
"game"].toString());
41 o.setName(m[
"name"].toString());
42 o.setPort(m[
"port"].toUInt());
43 o.setTime(m[
"time"].toDateTime());
47 QVariant ServerSummary::serializeQVariant()
const
50 m.insert(
"address", d.address);
51 m.insert(
"game", d.game);
52 m.insert(
"name", d.name);
53 m.insert(
"port", d.port);
54 m.insert(
"time", d.time);
60 if (!isValid() || !other.isValid())
65 const float MAX_SIMILARITY = 3.0f;
67 if (address() == other.address() && port() == other.port() && game() == other.game())
71 if (name() == other.name())
75 return similarity / MAX_SIMILARITY;