Core: Namespace NetPlay utilities under the NetPlay namespace

Previously there was only one function under the NetPlay namespace,
which is kind of silly considering we have all of these other types
and functions existing outside of the namespace.

This moves the rest of them into the namespace.

This gets some general names, like Player, for example, out of the global namespace.
This commit is contained in:
Lioncash
2018-07-06 19:39:42 -04:00
parent 3d1a7737d8
commit 675260b0f7
17 changed files with 119 additions and 97 deletions

View File

@ -285,7 +285,7 @@ void NetPlayDialog::OnStart()
return;
}
NetSettings settings;
NetPlay::NetSettings settings;
// Copy all relevant settings
SConfig& instance = SConfig::GetInstance();
@ -379,7 +379,8 @@ void NetPlayDialog::UpdateGUI()
{tr("Player"), tr("Game Status"), tr("Ping"), tr("Mapping"), tr("Revision")});
m_players_list->setRowCount(player_count);
const auto get_mapping_string = [](const Player* player, const PadMappingArray& array) {
const auto get_mapping_string = [](const NetPlay::Player* player,
const NetPlay::PadMappingArray& array) {
std::string str;
for (size_t i = 0; i < array.size(); i++)
{
@ -392,8 +393,10 @@ void NetPlayDialog::UpdateGUI()
return '|' + str + '|';
};
static const std::map<PlayerGameStatus, QString> player_status{
{PlayerGameStatus::Ok, tr("OK")}, {PlayerGameStatus::NotFound, tr("Not Found")}};
static const std::map<NetPlay::PlayerGameStatus, QString> player_status{
{NetPlay::PlayerGameStatus::Ok, tr("OK")},
{NetPlay::PlayerGameStatus::NotFound, tr("Not Found")},
};
for (int i = 0; i < player_count; i++)
{

View File

@ -11,7 +11,6 @@
class MD5Dialog;
class GameListModel;
class NetPlayServer;
class PadMappingDialog;
class QCheckBox;
class QComboBox;
@ -26,7 +25,7 @@ class QTableWidget;
class QTextEdit;
class QToolButton;
class NetPlayDialog : public QDialog, public NetPlayUI
class NetPlayDialog : public QDialog, public NetPlay::NetPlayUI
{
Q_OBJECT
public:

View File

@ -94,12 +94,13 @@ int PadMappingDialog::exec()
return QDialog::exec();
}
PadMappingArray PadMappingDialog::GetGCPadArray()
NetPlay::PadMappingArray PadMappingDialog::GetGCPadArray()
{
return m_pad_mapping;
}
PadMappingArray PadMappingDialog::GetWiimoteArray()
NetPlay::PadMappingArray PadMappingDialog::GetWiimoteArray()
{
return m_wii_mapping;
}

View File

@ -8,12 +8,15 @@
#include "Core/NetPlayProto.h"
class NetPlayClient;
class Player;
class QGridLayout;
class QComboBox;
class QDialogButtonBox;
namespace NetPlay
{
class Player;
}
class PadMappingDialog : public QDialog
{
Q_OBJECT
@ -22,8 +25,8 @@ public:
int exec() override;
PadMappingArray GetGCPadArray();
PadMappingArray GetWiimoteArray();
NetPlay::PadMappingArray GetGCPadArray();
NetPlay::PadMappingArray GetWiimoteArray();
private:
void CreateWidgets();
@ -31,12 +34,12 @@ private:
void OnMappingChanged();
PadMappingArray m_pad_mapping;
PadMappingArray m_wii_mapping;
NetPlay::PadMappingArray m_pad_mapping;
NetPlay::PadMappingArray m_wii_mapping;
QGridLayout* m_main_layout;
std::array<QComboBox*, 4> m_gc_boxes;
std::array<QComboBox*, 4> m_wii_boxes;
std::vector<const Player*> m_players;
std::vector<const NetPlay::Player*> m_players;
QDialogButtonBox* m_button_box;
};