mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[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);
|
||||
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<ServerData>::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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue