forked from mirror/openmw-tes3mp
[Browser] Add version column
This commit is contained in:
parent
ea9c31a8f7
commit
0e92f43822
3 changed files with 16 additions and 0 deletions
|
@ -78,6 +78,8 @@ void NetController::setData(QString address, QJsonObject server, ServerModel *mo
|
||||||
mi = model->index(0, ServerData::MODNAME);
|
mi = model->index(0, ServerData::MODNAME);
|
||||||
model->setData(mi, server["modname"].toString());
|
model->setData(mi, server["modname"].toString());
|
||||||
|
|
||||||
|
mi = model->index(0, ServerData::VERSION);
|
||||||
|
model->setData(mi, server["version"].toString());
|
||||||
mi = model->index(0, ServerData::PING);
|
mi = model->index(0, ServerData::PING);
|
||||||
|
|
||||||
QStringList addr = address.split(":");
|
QStringList addr = address.split(":");
|
||||||
|
@ -149,6 +151,7 @@ bool NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index)
|
||||||
qDebug() << server["modname"].toString();
|
qDebug() << server["modname"].toString();
|
||||||
qDebug() << server["players"].toInt();
|
qDebug() << server["players"].toInt();
|
||||||
qDebug() << server["max_players"].toInt();
|
qDebug() << server["max_players"].toInt();
|
||||||
|
qDebug() << server["version"].toString();
|
||||||
|
|
||||||
QVector<ServerData>::Iterator value = std::find_if(model->myData.begin(), model->myData.end(), pattern(iter.key()));
|
QVector<ServerData>::Iterator value = std::find_if(model->myData.begin(), model->myData.end(), pattern(iter.key()));
|
||||||
if(value == model->myData.end())
|
if(value == model->myData.end())
|
||||||
|
@ -209,6 +212,7 @@ void NetController::updateInfo()
|
||||||
qDebug() << map["modname"].toString();
|
qDebug() << map["modname"].toString();
|
||||||
qDebug() << map["players"].toInt();
|
qDebug() << map["players"].toInt();
|
||||||
qDebug() << map["max_players"].toInt();
|
qDebug() << map["max_players"].toInt();
|
||||||
|
qDebug() << map["version"].toString();
|
||||||
|
|
||||||
sd->hostName = map["hostname"].toString();
|
sd->hostName = map["hostname"].toString();
|
||||||
sd->modName = map["modname"].toString();
|
sd->modName = map["modname"].toString();
|
||||||
|
|
|
@ -33,6 +33,9 @@ QVariant ServerModel::data(const QModelIndex &index, int role) const
|
||||||
case ServerData::ADDR:
|
case ServerData::ADDR:
|
||||||
var = sd.addr;
|
var = sd.addr;
|
||||||
break;
|
break;
|
||||||
|
case ServerData::VERSION:
|
||||||
|
var = sd.version;
|
||||||
|
break;
|
||||||
case ServerData::PLAYERS:
|
case ServerData::PLAYERS:
|
||||||
var = sd.players;
|
var = sd.players;
|
||||||
break;
|
break;
|
||||||
|
@ -75,6 +78,9 @@ QVariant ServerModel::headerData(int section, Qt::Orientation orientation, int r
|
||||||
case ServerData::ADDR:
|
case ServerData::ADDR:
|
||||||
var = "Address";
|
var = "Address";
|
||||||
break;
|
break;
|
||||||
|
case ServerData::VERSION:
|
||||||
|
var = "Version";
|
||||||
|
break;
|
||||||
case ServerData::HOSTNAME:
|
case ServerData::HOSTNAME:
|
||||||
var = "Host name";
|
var = "Host name";
|
||||||
break;
|
break;
|
||||||
|
@ -120,6 +126,10 @@ bool ServerModel::setData(const QModelIndex &index, const QVariant &value, int r
|
||||||
sd.addr = value.toString();
|
sd.addr = value.toString();
|
||||||
ok = !sd.addr.isEmpty();
|
ok = !sd.addr.isEmpty();
|
||||||
break;
|
break;
|
||||||
|
case ServerData::VERSION:
|
||||||
|
sd.version = value.toString();
|
||||||
|
ok = !sd.addr.isEmpty();
|
||||||
|
break;
|
||||||
case ServerData::PLAYERS:
|
case ServerData::PLAYERS:
|
||||||
sd.players = value.toInt(&ok);
|
sd.players = value.toInt(&ok);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,6 +13,7 @@ struct ServerData
|
||||||
int ping;
|
int ping;
|
||||||
QString hostName;
|
QString hostName;
|
||||||
QString modName;
|
QString modName;
|
||||||
|
QString version;
|
||||||
enum IDS
|
enum IDS
|
||||||
{
|
{
|
||||||
ADDR,
|
ADDR,
|
||||||
|
@ -21,6 +22,7 @@ struct ServerData
|
||||||
MAX_PLAYERS,
|
MAX_PLAYERS,
|
||||||
MODNAME,
|
MODNAME,
|
||||||
PING,
|
PING,
|
||||||
|
VERSION,
|
||||||
LAST
|
LAST
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue