Merge pull request #1528 from lioncash/netplay

Small Netplay dialog cleanups.
This commit is contained in:
Lioncash 2014-11-11 21:19:24 -05:00
commit 5a89ba20d7
2 changed files with 9 additions and 15 deletions

View file

@ -47,13 +47,8 @@
#include "DolphinWX/NetWindow.h" #include "DolphinWX/NetWindow.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#define NETPLAY_TITLEBAR "Dolphin NetPlay"
#define INITIAL_PAD_BUFFER_SIZE 5 #define INITIAL_PAD_BUFFER_SIZE 5
BEGIN_EVENT_TABLE(NetPlayDiag, wxFrame)
EVT_COMMAND(wxID_ANY, wxEVT_THREAD, NetPlayDiag::OnThread)
END_EVENT_TABLE()
static NetPlayServer* netplay_server = nullptr; static NetPlayServer* netplay_server = nullptr;
static NetPlayClient* netplay_client = nullptr; static NetPlayClient* netplay_client = nullptr;
NetPlayDiag *NetPlayDiag::npd = nullptr; NetPlayDiag *NetPlayDiag::npd = nullptr;
@ -78,7 +73,7 @@ static void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_li
} }
NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list) NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list)
: wxFrame(parent, wxID_ANY, NETPLAY_TITLEBAR) : wxFrame(parent, wxID_ANY, _("Dolphin NetPlay Setup"))
, m_game_list(game_list) , m_game_list(game_list)
{ {
IniFile inifile; IniFile inifile;
@ -305,11 +300,13 @@ void NetPlaySetupDiag::OnQuit(wxCommandEvent&)
NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list, NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list,
const std::string& game, const bool is_hosting) const std::string& game, const bool is_hosting)
: wxFrame(parent, wxID_ANY, NETPLAY_TITLEBAR) : wxFrame(parent, wxID_ANY, _("Dolphin NetPlay"))
, m_selected_game(game) , m_selected_game(game)
, m_start_btn(nullptr) , m_start_btn(nullptr)
, m_game_list(game_list) , m_game_list(game_list)
{ {
Bind(wxEVT_THREAD, &NetPlayDiag::OnThread, this);
wxPanel* const panel = new wxPanel(this); wxPanel* const panel = new wxPanel(this);
// top crap // top crap
@ -428,9 +425,6 @@ void NetPlayDiag::OnChat(wxCommandEvent&)
if (!text.empty()) if (!text.empty())
{ {
if (text.length() > 2000)
text.erase(2000);
netplay_client->SendChatMessage(WxStrToStr(text)); netplay_client->SendChatMessage(WxStrToStr(text));
m_chat_text->AppendText(text.Prepend(" >> ").Append('\n')); m_chat_text->AppendText(text.Prepend(" >> ").Append('\n'));
m_chat_msg_text->Clear(); m_chat_msg_text->Clear();
@ -535,7 +529,7 @@ void NetPlayDiag::OnQuit(wxCommandEvent&)
} }
// update gui // update gui
void NetPlayDiag::OnThread(wxCommandEvent& event) void NetPlayDiag::OnThread(wxThreadEvent& event)
{ {
// player list // player list
m_playerids.clear(); m_playerids.clear();
@ -583,7 +577,9 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
// update selected game :/ // update selected game :/
{ {
m_selected_game.assign(WxStrToStr(event.GetString())); m_selected_game.assign(WxStrToStr(event.GetString()));
m_game_btn->SetLabel(event.GetString().Prepend(_(" Game : ")));
wxString button_label = event.GetString();
m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));
} }
break; break;
case NP_GUI_EVT_START_GAME : case NP_GUI_EVT_START_GAME :

View file

@ -82,11 +82,9 @@ public:
bool IsRecording() override; bool IsRecording() override;
private: private:
DECLARE_EVENT_TABLE()
void OnChat(wxCommandEvent& event); void OnChat(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnThread(wxCommandEvent& event); void OnThread(wxThreadEvent& event);
void OnChangeGame(wxCommandEvent& event); void OnChangeGame(wxCommandEvent& event);
void OnAdjustBuffer(wxCommandEvent& event); void OnAdjustBuffer(wxCommandEvent& event);
void OnConfigPads(wxCommandEvent& event); void OnConfigPads(wxCommandEvent& event);