diff --git a/apps/browser/NetController.cpp b/apps/browser/NetController.cpp index e07f74f9f..d09d01083 100644 --- a/apps/browser/NetController.cpp +++ b/apps/browser/NetController.cpp @@ -78,6 +78,8 @@ void NetController::setData(QString address, QJsonObject server, ServerModel *mo mi = model->index(0, ServerData::MODNAME); model->setData(mi, server["modname"].toString()); + mi = model->index(0, ServerData::VERSION); + model->setData(mi, server["version"].toString()); mi = model->index(0, ServerData::PING); QStringList addr = address.split(":"); @@ -149,6 +151,7 @@ bool NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index) qDebug() << server["modname"].toString(); qDebug() << server["players"].toInt(); qDebug() << server["max_players"].toInt(); + qDebug() << server["version"].toString(); QVector::Iterator value = std::find_if(model->myData.begin(), model->myData.end(), pattern(iter.key())); if(value == model->myData.end()) @@ -209,6 +212,7 @@ void NetController::updateInfo() qDebug() << map["modname"].toString(); qDebug() << map["players"].toInt(); qDebug() << map["max_players"].toInt(); + qDebug() << map["version"].toString(); sd->hostName = map["hostname"].toString(); sd->modName = map["modname"].toString(); diff --git a/apps/browser/ServerModel.cpp b/apps/browser/ServerModel.cpp index 8739075e6..865ee3c2f 100644 --- a/apps/browser/ServerModel.cpp +++ b/apps/browser/ServerModel.cpp @@ -33,6 +33,9 @@ QVariant ServerModel::data(const QModelIndex &index, int role) const case ServerData::ADDR: var = sd.addr; break; + case ServerData::VERSION: + var = sd.version; + break; case ServerData::PLAYERS: var = sd.players; break; @@ -75,6 +78,9 @@ QVariant ServerModel::headerData(int section, Qt::Orientation orientation, int r case ServerData::ADDR: var = "Address"; break; + case ServerData::VERSION: + var = "Version"; + break; case ServerData::HOSTNAME: var = "Host name"; break; @@ -120,6 +126,10 @@ bool ServerModel::setData(const QModelIndex &index, const QVariant &value, int r sd.addr = value.toString(); ok = !sd.addr.isEmpty(); break; + case ServerData::VERSION: + sd.version = value.toString(); + ok = !sd.addr.isEmpty(); + break; case ServerData::PLAYERS: sd.players = value.toInt(&ok); break; diff --git a/apps/browser/ServerModel.hpp b/apps/browser/ServerModel.hpp index bd9ffbb19..55e78b0b0 100644 --- a/apps/browser/ServerModel.hpp +++ b/apps/browser/ServerModel.hpp @@ -13,6 +13,7 @@ struct ServerData int ping; QString hostName; QString modName; + QString version; enum IDS { ADDR, @@ -21,6 +22,7 @@ struct ServerData MAX_PLAYERS, MODNAME, PING, + VERSION, LAST }; };