From e53916da103e801bd0aa89e75d33161fdc602d9a Mon Sep 17 00:00:00 2001 From: Koncord Date: Thu, 27 Apr 2017 11:41:35 +0800 Subject: [PATCH] [Browser] Add Rules tab to ServerInfo --- apps/browser/ServerInfoDialog.cpp | 12 ++++++++++ files/tes3mp/ui/ServerInfo.ui | 39 ++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/apps/browser/ServerInfoDialog.cpp b/apps/browser/ServerInfoDialog.cpp index eb0170c41..965cc364b 100644 --- a/apps/browser/ServerInfoDialog.cpp +++ b/apps/browser/ServerInfoDialog.cpp @@ -50,6 +50,18 @@ void ServerInfoDialog::refresh() listPlugins->addItem(QString::fromStdString(plugin.name)); } + auto iter = sd.second.rules.begin(); + for (int i = 0; iter != sd.second.rules.end(); i++, iter++) + { + if(i < 6) + continue; + QString rule = QString::fromStdString(iter->first) + " : "; + if(iter->second.type == 's') + rule += QString::fromStdString(iter->second.str); + else + rule += QString::number(iter->second.val); + listRules->addItem(rule); + } lblPlayers->setText(QString::number(sd.second.players.size()) + " / " + QString::number(sd.second.GetMaxPlayers())); } diff --git a/files/tes3mp/ui/ServerInfo.ui b/files/tes3mp/ui/ServerInfo.ui index 3ecae318b..5f08324be 100644 --- a/files/tes3mp/ui/ServerInfo.ui +++ b/files/tes3mp/ui/ServerInfo.ui @@ -13,7 +13,7 @@ Connect - + @@ -143,17 +143,34 @@ - - - Plugins: - - - - - - - QAbstractItemView::NoSelection + + + 0 + + + Plugins + + + + + + QAbstractItemView::NoSelection + + + + + + + + Rules + + + + + + +