Skip to content

Commit

Permalink
Merge pull request #2289 from lioncash/netplay
Browse files Browse the repository at this point in the history
DolphinWX: Break the netplay UI controls into separate classes.
  • Loading branch information
skidau committed Apr 16, 2015
2 parents f059309 + bd28d26 commit 7063886
Show file tree
Hide file tree
Showing 14 changed files with 1,284 additions and 1,167 deletions.
5 changes: 4 additions & 1 deletion Source/Core/DolphinWX/CMakeLists.txt
Expand Up @@ -32,6 +32,10 @@ set(GUI_SRCS
Debugger/RegisterWindow.cpp
Debugger/WatchView.cpp
Debugger/WatchWindow.cpp
NetPlay/ChangeGameDialog.cpp
NetPlay/NetPlaySetupFrame.cpp
NetPlay/NetWindow.cpp
NetPlay/PadMapDialog.cpp
FifoPlayerDlg.cpp
Frame.cpp
FrameAui.cpp
Expand All @@ -46,7 +50,6 @@ set(GUI_SRCS
LogWindow.cpp
Main.cpp
MemcardManager.cpp
NetWindow.cpp
PatchAddEdit.cpp
PostProcessingConfigDiag.cpp
SoftwareVideoConfigDialog.cpp
Expand Down
10 changes: 8 additions & 2 deletions Source/Core/DolphinWX/DolphinWX.vcxproj
Expand Up @@ -80,6 +80,9 @@
<ClCompile Include="Debugger\RegisterWindow.cpp" />
<ClCompile Include="Debugger\WatchView.cpp" />
<ClCompile Include="Debugger\WatchWindow.cpp" />
<ClCompile Include="NetPlay\ChangeGameDialog.cpp" />
<ClCompile Include="NetPlay\NetPlaySetupFrame.cpp" />
<ClCompile Include="NetPlay\NetWindow.cpp" />
<ClCompile Include="FifoPlayerDlg.cpp" />
<ClCompile Include="Frame.cpp" />
<ClCompile Include="FrameAui.cpp" />
Expand All @@ -97,7 +100,7 @@
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="MemcardManager.cpp" />
<ClCompile Include="NetWindow.cpp" />
<ClCompile Include="NetPlay\PadMapDialog.cpp" />
<ClCompile Include="PatchAddEdit.cpp" />
<ClCompile Include="SoftwareVideoConfigDialog.cpp" />
<ClCompile Include="TASInputDlg.cpp" />
Expand All @@ -115,6 +118,9 @@
<ClInclude Include="Config\InterfaceConfigPane.h" />
<ClInclude Include="Config\PathConfigPane.h" />
<ClInclude Include="Config\WiiConfigPane.h" />
<ClInclude Include="NetPlay\ChangeGameDialog.h" />
<ClInclude Include="NetPlay\NetPlaySetupFrame.h" />
<ClInclude Include="NetPlay\PadMapDialog.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="AboutDolphin.h" />
<ClInclude Include="ARCodeAddEdit.h" />
Expand All @@ -140,6 +146,7 @@
<ClInclude Include="Debugger\RegisterWindow.h" />
<ClInclude Include="Debugger\WatchView.h" />
<ClInclude Include="Debugger\WatchWindow.h" />
<ClInclude Include="NetPlay\NetWindow.h" />
<ClInclude Include="FifoPlayerDlg.h" />
<ClInclude Include="Frame.h" />
<ClInclude Include="GameListCtrl.h" />
Expand All @@ -152,7 +159,6 @@
<ClInclude Include="LogWindow.h" />
<ClInclude Include="Main.h" />
<ClInclude Include="MemcardManager.h" />
<ClInclude Include="NetWindow.h" />
<ClInclude Include="PatchAddEdit.h" />
<ClInclude Include="SoftwareVideoConfigDialog.h" />
<ClInclude Include="TASInputDlg.h" />
Expand Down
30 changes: 24 additions & 6 deletions Source/Core/DolphinWX/DolphinWX.vcxproj.filters
Expand Up @@ -97,15 +97,15 @@
<ClCompile Include="Debugger\WatchWindow.cpp">
<Filter>GUI\Debugger</Filter>
</ClCompile>
<ClCompile Include="NetPlay\NetWindow.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiagBitmaps.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="NetWindow.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="Debugger\DebuggerPanel.cpp">
<Filter>GUI\Video</Filter>
</ClCompile>
Expand Down Expand Up @@ -190,6 +190,15 @@
<ClCompile Include="Config\AdvancedConfigPane.cpp">
<Filter>GUI\Config</Filter>
</ClCompile>
<ClCompile Include="NetPlay\NetPlaySetupFrame.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="NetPlay\ChangeGameDialog.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="NetPlay\PadMapDialog.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Main.h" />
Expand Down Expand Up @@ -255,12 +264,12 @@
<ClInclude Include="Debugger\WatchWindow.h">
<Filter>GUI\Debugger</Filter>
</ClInclude>
<ClInclude Include="NetPlay\NetWindow.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="InputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="NetWindow.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="Debugger\DebuggerPanel.h">
<Filter>GUI\Video</Filter>
</ClInclude>
Expand Down Expand Up @@ -345,6 +354,15 @@
<ClInclude Include="Config\AdvancedConfigPane.h">
<Filter>GUI\Config</Filter>
</ClInclude>
<ClInclude Include="NetPlay\NetPlaySetupFrame.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="NetPlay\ChangeGameDialog.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="NetPlay\PadMapDialog.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinWX/Frame.h
Expand Up @@ -38,7 +38,7 @@ class CCodeWindow;
class CLogWindow;
class FifoPlayerDlg;
class LogConfigWindow;
class NetPlaySetupDiag;
class NetPlaySetupFrame;
class TASInputDlg;
class wxCheatsWindow;

Expand Down Expand Up @@ -98,7 +98,7 @@ class CFrame : public CRenderFrame

// These have to be public
CCodeWindow* g_pCodeWindow;
NetPlaySetupDiag* g_NetPlaySetupDiag;
NetPlaySetupFrame* g_NetPlaySetupDiag;
wxCheatsWindow* g_CheatsWindow;
TASInputDlg* g_TASInputDlg[8];

Expand Down
13 changes: 8 additions & 5 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -75,7 +75,6 @@
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/LogWindow.h"
#include "DolphinWX/MemcardManager.h"
#include "DolphinWX/NetWindow.h"
#include "DolphinWX/TASInputDlg.h"
#include "DolphinWX/WXInputBase.h"
#include "DolphinWX/WxUtils.h"
Expand All @@ -84,6 +83,8 @@
#include "DolphinWX/Debugger/BreakpointWindow.h"
#include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Debugger/WatchWindow.h"
#include "DolphinWX/NetPlay/NetPlaySetupFrame.h"
#include "DolphinWX/NetPlay/NetWindow.h"

#include "InputCommon/ControllerInterface/ControllerInterface.h"

Expand Down Expand Up @@ -1213,7 +1214,9 @@ void CFrame::DoStop()
DoRecordingSave();
if (Movie::IsMovieActive())
Movie::EndPlayInput(false);
NetPlay::StopGame();

if (NetPlayDialog::GetNetPlayClient())
NetPlayDialog::GetNetPlayClient()->Stop();

BootManager::Stop();
UpdateGUI();
Expand Down Expand Up @@ -1450,10 +1453,10 @@ void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event))
{
if (!g_NetPlaySetupDiag)
{
if (NetPlayDiag::GetInstance() != nullptr)
NetPlayDiag::GetInstance()->Raise();
if (NetPlayDialog::GetInstance() != nullptr)
NetPlayDialog::GetInstance()->Raise();
else
g_NetPlaySetupDiag = new NetPlaySetupDiag(this, m_GameListCtrl);
g_NetPlaySetupDiag = new NetPlaySetupFrame(this, m_GameListCtrl);
}
else
{
Expand Down
37 changes: 37 additions & 0 deletions Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp
@@ -0,0 +1,37 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/sizer.h>

#include "DolphinWX/NetPlay/ChangeGameDialog.h"
#include "DolphinWX/NetPlay/NetWindow.h"

ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list, wxString& game_name)
: wxDialog(parent, wxID_ANY, _("Change Game"))
, m_game_name(game_name)
{
m_game_lbox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT);
m_game_lbox->Bind(wxEVT_LISTBOX_DCLICK, &ChangeGameDialog::OnPick, this);

NetPlayDialog::FillWithGameNames(m_game_lbox, *game_list);

wxButton* const ok_btn = new wxButton(this, wxID_OK, _("Change"));
ok_btn->Bind(wxEVT_BUTTON, &ChangeGameDialog::OnPick, this);

wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
szr->Add(m_game_lbox, 1, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 5);
szr->Add(ok_btn, 0, wxALL | wxALIGN_RIGHT, 5);

SetSizerAndFit(szr);
SetFocus();
}

void ChangeGameDialog::OnPick(wxCommandEvent& event)
{
// return the selected game name
m_game_name = m_game_lbox->GetStringSelection();
EndModal(wxID_OK);
}
22 changes: 22 additions & 0 deletions Source/Core/DolphinWX/NetPlay/ChangeGameDialog.h
@@ -0,0 +1,22 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#pragma once

#include <wx/dialog.h>

class CGameListCtrl;
class wxListBox;

class ChangeGameDialog final : public wxDialog
{
public:
ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list, wxString& game_name);

private:
void OnPick(wxCommandEvent& event);

wxListBox* m_game_lbox;
wxString& m_game_name;
};

0 comments on commit 7063886

Please sign in to comment.