From 98cdbb759b58a3565e49551a98182445a65f5a70 Mon Sep 17 00:00:00 2001 From: luxsie <877033040@qq.com> Date: Fri, 15 Aug 2014 15:02:36 +0800 Subject: [PATCH 1/4] Make Auto-Pause UI better. --- rpcs3/Gui/AutoPauseManager.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/rpcs3/Gui/AutoPauseManager.cpp b/rpcs3/Gui/AutoPauseManager.cpp index bccf730b76..540d5a0b8c 100644 --- a/rpcs3/Gui/AutoPauseManager.cpp +++ b/rpcs3/Gui/AutoPauseManager.cpp @@ -13,7 +13,8 @@ enum AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, "Auto-Pause Manager") { - SetSizeHints(wxSize(400, 300), wxDefaultSize); + //SetSizeHints(wxSize(400, 300), wxDefaultSize); + SetMinSize(wxSize(400, 360)); wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); @@ -38,11 +39,11 @@ AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) wxBoxSizer* s_action = new wxBoxSizer(wxHORIZONTAL); s_action->Add(new wxButton(this, wxID_CLEAR, wxT("Cl&ear"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); - s_action->Add(new wxButton(this, wxID_REFRESH, wxT("&Reload"), wxDefaultPosition, wxDefaultSize, 0), 1, wxALL, 5); - s_action->Add(new wxButton(this, wxID_SAVE, wxT("&Save"), wxDefaultPosition, wxDefaultSize, 0), 2, wxALL, 5); - s_action->Add(new wxButton(this, wxID_CANCEL, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0), 3, wxALL, 5); + s_action->Add(new wxButton(this, wxID_REFRESH, wxT("&Reload"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + s_action->Add(new wxButton(this, wxID_SAVE, wxT("&Save"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + s_action->Add(new wxButton(this, wxID_CANCEL, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); - s_main->Add(s_action, 2, wxALL, 5); + s_main->Add(s_action, 0, wxALL, 5); Bind(wxEVT_MENU, &AutoPauseManagerDialog::OnAdd, this, id_add); Bind(wxEVT_MENU, &AutoPauseManagerDialog::OnRemove, this, id_remove); @@ -59,7 +60,7 @@ AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) UpdateList(); SetSizerAndFit(s_main); - SetSize(wxSize(400, 360)); + //SetSize(wxSize(400, 360)); Layout(); Centre(wxBOTH); } @@ -220,7 +221,8 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry) , m_presult(entry) { m_entry = *m_presult; - SetSizeHints(wxSize(400, -1), wxDefaultSize); + //SetSizeHints(wxSize(400, -1), wxDefaultSize); + SetMinSize(wxSize(400, -1)); wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); @@ -236,14 +238,14 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry) wxBoxSizer* s_config = new wxBoxSizer(wxHORIZONTAL); m_id = new wxTextCtrl(this, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); - s_config->Add(m_id, 0, wxALL | wxEXPAND, 5); - s_config->Add(new wxButton(this, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0), 1, wxALL, 5); - s_config->Add(new wxButton(this, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0), 1, wxALL, 5); + s_config->Add(m_id, 1, wxALL | wxEXPAND, 5); + s_config->Add(new wxButton(this, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + s_config->Add(new wxButton(this, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); - s_main->Add(s_config, 1, wxEXPAND, 5); + s_main->Add(s_config, 0, wxEXPAND, 5); m_current_converted = new wxStaticText(this, wxID_ANY, wxT("Currently it gets an id of \"Unset\"."), wxDefaultPosition, wxDefaultSize, 0); - s_main->Add(m_current_converted, 2, wxALL | wxEXPAND, 5); + s_main->Add(m_current_converted, 0, wxALL, 5); m_entry_convert.clear(); m_entry_convert.str(""); @@ -256,7 +258,7 @@ AutoPauseSettingsDialog::AutoPauseSettingsDialog(wxWindow* parent, u32 *entry) Bind(wxEVT_TEXT, &AutoPauseSettingsDialog::OnUpdateValue, this, wxID_STATIC); SetSizerAndFit(s_main); - SetSize(wxSize(400, -1)); + //SetSize(wxSize(400, -1)); Layout(); Centre(wxBOTH); From 5531a615e68893aaf81cf15b6da85ac6641fe211 Mon Sep 17 00:00:00 2001 From: luxsie <877033040@qq.com> Date: Fri, 15 Aug 2014 19:44:16 +0800 Subject: [PATCH 2/4] Added Save Data Utility UI (stub). May be connected to real data after those related save data list get implemented, with those data sent to UI decided. Also removed some comments from Auto-Pause. --- rpcs3/Gui/AutoPauseManager.cpp | 3 - rpcs3/Gui/AutoPauseManager.h | 1 - rpcs3/Gui/MainFrame.cpp | 11 +- rpcs3/Gui/MainFrame.h | 1 + rpcs3/Gui/SaveDataUtility.cpp | 339 +++++++++++++++++++++++++++++++++ rpcs3/Gui/SaveDataUtility.h | 83 ++++++++ rpcs3/rpcs3.vcxproj | 2 + rpcs3/rpcs3.vcxproj.filters | 6 + 8 files changed, 441 insertions(+), 5 deletions(-) create mode 100644 rpcs3/Gui/SaveDataUtility.cpp create mode 100644 rpcs3/Gui/SaveDataUtility.h diff --git a/rpcs3/Gui/AutoPauseManager.cpp b/rpcs3/Gui/AutoPauseManager.cpp index 540d5a0b8c..19c96ee06e 100644 --- a/rpcs3/Gui/AutoPauseManager.cpp +++ b/rpcs3/Gui/AutoPauseManager.cpp @@ -13,7 +13,6 @@ enum AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, "Auto-Pause Manager") { - //SetSizeHints(wxSize(400, 300), wxDefaultSize); SetMinSize(wxSize(400, 360)); wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); @@ -52,7 +51,6 @@ AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) Bind(wxEVT_BUTTON, &AutoPauseManagerDialog::OnClear, this, wxID_CLEAR); Bind(wxEVT_BUTTON, &AutoPauseManagerDialog::OnReload, this, wxID_REFRESH); Bind(wxEVT_BUTTON, &AutoPauseManagerDialog::OnSave, this, wxID_SAVE); - //Bind(wxEVT_BUTTON, &AutoPauseManagerDialog::OnClose, this, wxID_CLOSE); Emu.Stop(); @@ -60,7 +58,6 @@ AutoPauseManagerDialog::AutoPauseManagerDialog(wxWindow* parent) UpdateList(); SetSizerAndFit(s_main); - //SetSize(wxSize(400, 360)); Layout(); Centre(wxBOTH); } diff --git a/rpcs3/Gui/AutoPauseManager.h b/rpcs3/Gui/AutoPauseManager.h index fa1aad3964..a1b8f00450 100644 --- a/rpcs3/Gui/AutoPauseManager.h +++ b/rpcs3/Gui/AutoPauseManager.h @@ -25,7 +25,6 @@ public: void OnClear(wxCommandEvent& event); void OnReload(wxCommandEvent& event); void OnSave(wxCommandEvent& event); - //void OnClose(wxCommandEvent& event); void LoadEntries(void); void SaveEntries(void); diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 3d34a85305..6a46ee08bf 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -17,6 +17,7 @@ #include "Gui/AboutDialog.h" #include "Gui/GameViewer.h" #include "Gui/AutoPauseManager.h" +#include "Gui/SaveDataUtility.h" #include #include "Loader/PKG.h" @@ -39,6 +40,7 @@ enum IDs id_config_vfs_manager, id_config_vhdd_manager, id_config_autopause_manager, + id_config_savedata_manager, id_tools_compiler, id_tools_memory_viewer, id_tools_rsx_debugger, @@ -90,7 +92,8 @@ MainFrame::MainFrame() menu_conf->Append(id_config_autopause_manager, "Auto-Pause Settings"); menu_conf->AppendSeparator(); menu_conf->Append(id_config_vfs_manager, "Virtual File System Manager"); - menu_conf->Append(id_config_vhdd_manager, "Virtual HDD Manager"); + menu_conf->Append(id_config_vhdd_manager, "Virtual HDD Manager"); + menu_conf->Append(id_config_savedata_manager, "Save Data Utility"); wxMenu* menu_tools = new wxMenu(); menubar->Append(menu_tools, "Tools"); @@ -128,6 +131,7 @@ MainFrame::MainFrame() Bind(wxEVT_MENU, &MainFrame::ConfigVFS, this, id_config_vfs_manager); Bind(wxEVT_MENU, &MainFrame::ConfigVHDD, this, id_config_vhdd_manager); Bind(wxEVT_MENU, &MainFrame::ConfigAutoPause, this, id_config_autopause_manager); + Bind(wxEVT_MENU, &MainFrame::ConfigSaveData, this, id_config_savedata_manager); Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler); Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer); @@ -620,6 +624,11 @@ void MainFrame::ConfigAutoPause(wxCommandEvent& WXUNUSED(event)) AutoPauseManagerDialog(this).ShowModal(); } +void MainFrame::ConfigSaveData(wxCommandEvent& event) +{ + SaveDataListDialog(this, true).ShowModal(); +} + void MainFrame::OpenELFCompiler(wxCommandEvent& WXUNUSED(event)) { (new CompilerELF(this)) -> Show(); diff --git a/rpcs3/Gui/MainFrame.h b/rpcs3/Gui/MainFrame.h index 5dea885e34..604e68e97c 100644 --- a/rpcs3/Gui/MainFrame.h +++ b/rpcs3/Gui/MainFrame.h @@ -39,6 +39,7 @@ private: void ConfigVFS(wxCommandEvent& event); void ConfigVHDD(wxCommandEvent& event); void ConfigAutoPause(wxCommandEvent& event); + void ConfigSaveData(wxCommandEvent& event); void OpenELFCompiler(wxCommandEvent& evt); void OpenMemoryViewer(wxCommandEvent& evt); void OpenRSXDebugger(wxCommandEvent& evt); diff --git a/rpcs3/Gui/SaveDataUtility.cpp b/rpcs3/Gui/SaveDataUtility.cpp new file mode 100644 index 0000000000..41cef9d2ba --- /dev/null +++ b/rpcs3/Gui/SaveDataUtility.cpp @@ -0,0 +1,339 @@ +#include "stdafx.h" +#include "SaveDataUtility.h" + +//Cause i can not decide what struct to be used to fill those. Just use no real data now. +//Currently variable info isn't used. it supposed to be a container for the information passed by other. +SaveDataInfoDialog::SaveDataInfoDialog(wxWindow* parent, const SaveDataInformation& info) + : wxDialog(parent, wxID_ANY, "Save Data Information") +{ + SetMinSize(wxSize(400, 300)); + + wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); + + m_list = new wxListView(this); + m_list->InsertColumn(0, "Name"); + m_list->InsertColumn(1, "Detail"); + s_main->Add(m_list, 1, wxALL | wxEXPAND, 5); + + wxBoxSizer* s_actions = new wxBoxSizer(wxHORIZONTAL); + s_actions->Add(0, 0, 1, wxEXPAND, 5); //Add a spacer to make Close on the Right-Down corner of this dialog. + s_actions->Add(new wxButton(this, wxID_CANCEL, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + s_main->Add(s_actions, 0, wxEXPAND, 5); + + SetSizerAndFit(s_main); + Layout(); + Centre(wxBOTH); + + SetSize(wxSize(400, 300)); + + UpdateData(); +} +//This is intended to write the information of save data to wxListView. +//However been not able to decide which data struct i should use, i use static content for this to make it stub. +void SaveDataInfoDialog::UpdateData() +{ + m_list->Freeze(); + m_list->DeleteAllItems(); + + m_list->InsertItem(0, 0); + m_list->SetItem(0, 0, "User ID"); + m_list->SetItem(0, 1, "00000000 (None)"); + + m_list->InsertItem(1, 1); + m_list->SetItem(1, 0, "Game Title"); + m_list->SetItem(1, 1, "Happy with rpcs3 (free)"); + + m_list->InsertItem(2, 2); + m_list->SetItem(2, 0, "Subtitle"); + m_list->SetItem(2, 1, "You devs are great"); + + m_list->InsertItem(3, 3); + m_list->SetItem(3, 0, "Detail"); + m_list->SetItem(3, 1, "Stub it first"); + + m_list->InsertItem(4, 4); + m_list->SetItem(4, 0, "Copy-Able?"); + m_list->SetItem(4, 1, "1 (Not allowed)"); + + m_list->InsertItem(5, 5); + m_list->SetItem(5, 0, "Play Time"); + m_list->SetItem(5, 1, "00:00:00"); + //Maybe there should be more details of save data. + //But i'm getting bored for assign it one by one. + + m_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); + m_list->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); + m_list->Thaw(); +} + +//This dialog represents the Menu of Save Data Utility - which pop up after when you roll to a save and press triangle. +//I've ever thought of make it a right-click menu or a show-hide panel of the main dialog. +//Well only when those function calls related get implemented we can tell what this GUI should be, seriously. +SaveDataManageDialog::SaveDataManageDialog(wxWindow* parent, unsigned int* sort_type, SaveDataEntry& save) + : wxDialog(parent, wxID_ANY, "Save Data Pop-up Menu") +{ + SetMinSize(wxSize(400, 110)); + + wxBoxSizer* s_manage = new wxBoxSizer(wxVERTICAL); + + wxBoxSizer* s_sort = new wxBoxSizer(wxHORIZONTAL); + s_sort->Add(new wxStaticText(this, wxID_ANY, wxT("Sort By"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL | wxEXPAND, 5); + + m_sort_options = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); + //You might change this - of corse we should know what to been set - maybe after functions related been implemented. + m_sort_options->Append(wxT("User Id")); + m_sort_options->Append(wxT("Game Title")); + m_sort_options->Append(wxT("Game Subtitle")); + m_sort_options->Append(wxT("Play Time")); + m_sort_options->Append(wxT("Data Size")); + m_sort_options->Append(wxT("Last Modified")); + m_sort_options->Append(wxT("Created Time")); + m_sort_options->Append(wxT("Accessed Time")); + m_sort_options->Append(wxT("Modified Time")); + m_sort_options->Append(wxT("Modify Time")); + + m_sort_type = sort_type; + if (m_sort_type != nullptr) + { + //Check sort type and set it to combo box + if ((*m_sort_type >= m_sort_options->GetCount()) + || (*m_sort_type < 0)) + { + *m_sort_type = 0; + } + } + + m_sort_options->SetSelection(*m_sort_type); + s_sort->Add(m_sort_options, 1, wxALL | wxEXPAND, 5); + + wxButton* s_sort_action = new wxButton(this, wxID_ANY, wxT("&Apply!"), wxDefaultPosition, wxDefaultSize, 0); + s_sort_action->Bind(wxEVT_BUTTON, &SaveDataManageDialog::OnApplySort, this); + s_sort->Add(s_sort_action, 0, wxALL, 5); + + s_manage->Add(s_sort, 1, wxEXPAND, 5); + + wxBoxSizer* s_actions = new wxBoxSizer(wxHORIZONTAL); + + wxButton* s_copy = new wxButton(this, wxID_ANY, wxT("&Copy"), wxDefaultPosition, wxDefaultSize, 0); + s_copy->Bind(wxEVT_BUTTON, &SaveDataManageDialog::OnCopy, this); + s_actions->Add(s_copy, 0, wxALL, 5); + + wxButton* s_delete = new wxButton(this, wxID_ANY, wxT("&Delete"), wxDefaultPosition, wxDefaultSize, 0); + s_delete->Bind(wxEVT_BUTTON, &SaveDataManageDialog::OnDelete, this); + s_actions->Add(s_delete, 0, wxALL, 5); + + wxButton* s_info = new wxButton(this, wxID_ANY, wxT("&Info"), wxDefaultPosition, wxDefaultSize, 0); + s_info->Bind(wxEVT_BUTTON, &SaveDataManageDialog::OnInfo, this); + s_actions->Add(s_info, 0, wxALL, 5); + + s_actions->Add(new wxButton(this, wxID_CANCEL, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + + s_manage->Add(s_actions, 1, wxEXPAND, 5); + + SetSizerAndFit(s_manage); + Layout(); + Center(wxBOTH); +} +//Display information about the current selected save data. +//If selected is "New Save Data" or other invalid, this dialog would be initialized with "Info" disabled or not visible. +void SaveDataManageDialog::OnInfo(wxCommandEvent& event) +{ + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataManageDialog: OnInfo called."); + SaveDataInformation info; //It should get a real one for information.. finally + SaveDataInfoDialog(this, info).ShowModal(); +} +//Copy selected save data to another. Might need a dialog but i just leave it as this. Or Modal Dialog. +void SaveDataManageDialog::OnCopy(wxCommandEvent& event) +{ + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataManageDialog: OnCopy called."); + event.Skip(); +} +//Delete selected save data, need confirm. just a stub now. +void SaveDataManageDialog::OnDelete(wxCommandEvent& event) +{ + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataManageDialog: OnDelete called."); + event.Skip(); +} +//This should return the sort setting of the save data list. Also not implemented really. +void SaveDataManageDialog::OnApplySort(wxCommandEvent& event) +{ + *m_sort_type = m_sort_options->GetSelection(); + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataManageDialog: OnApplySort called. NAME=%s", + m_sort_options->GetStringSelection().ToStdString().c_str()); + //event.Skip(); +} + +//Show up the savedata list, either to choose one to save/load or to manage saves. +//I suggest to use function callbacks to give save data list or get save data entry. (Not implemented or stubbed) +SaveDataListDialog::SaveDataListDialog(wxWindow* parent, bool enable_manage) + : wxDialog(parent, wxID_ANY, "Save Data Utility") +{ + SetMinSize(wxSize(400, 400)); + + wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); + + m_entry_convert.clear(); + m_entry_convert.str(""); + m_entry_convert << "This is only a stub now. Don't expect real effect from this." + << "Cause related functions hasn't been implemented yet."; + wxStaticText* s_description = new wxStaticText(this, wxID_ANY, m_entry_convert.str(), wxDefaultPosition, wxDefaultSize, 0); + s_description->Wrap(400); + s_main->Add(s_description, 0, wxALL, 5); + + m_list = new wxListView(this); + m_list->InsertColumn(0, "Game ID"); + m_list->InsertColumn(1, "Save ID"); + m_list->InsertColumn(2, "Detail"); + + m_list->Bind(wxEVT_LIST_ITEM_ACTIVATED, &SaveDataListDialog::OnEntryInfo, this); + m_list->Bind(wxEVT_RIGHT_DOWN, &SaveDataListDialog::OnRightClick, this); + + s_main->Add(m_list, 1, wxALL | wxEXPAND, 5); + + wxBoxSizer* s_action = new wxBoxSizer(wxHORIZONTAL); + + //If do not need manage, hide it, like just a save data picker. + if (!enable_manage) + { + wxButton *m_select = new wxButton(this, wxID_OK, wxT("&Select"), wxDefaultPosition, wxDefaultSize, 0); + m_select->Bind(wxEVT_BUTTON, &SaveDataListDialog::OnSelect, this); + s_action->Add(m_select, 0, wxALL, 5); + SetTitle("Save Data Chooser"); + } + else { + wxButton *m_manage = new wxButton(this, wxID_ANY, wxT("&Manage"), wxDefaultPosition, wxDefaultSize, 0); + m_manage->Bind(wxEVT_BUTTON, &SaveDataListDialog::OnManage, this); + s_action->Add(m_manage, 0, wxALL, 5); + } + + s_action->Add(0, 0, 1, wxEXPAND, 5); + + s_action->Add(new wxButton(this, wxID_CANCEL, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5); + + s_main->Add(s_action, 0, wxEXPAND, 5); + + Bind(wxEVT_MENU, &SaveDataListDialog::OnEntryCopy, this, id_copy); + Bind(wxEVT_MENU, &SaveDataListDialog::OnEntryRemove, this, id_remove); + Bind(wxEVT_MENU, &SaveDataListDialog::OnEntryInfo, this, id_info); + + SetSizerAndFit(s_main); + Layout(); + Centre(wxBOTH); + + LoadEntries(); + UpdateList(); +} +//After you pick a menu item from the sort sub-menu +void SaveDataListDialog::OnSort(wxCommandEvent& event) +{ + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSort called."); + int idx = event.GetSelection(); + if ((idx < m_sort_options->GetMenuItemCount()) + && (idx >= 0)) + { + m_sort_type = idx; + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSort called. Type Value:%d",m_sort_type); + } +} +//Copy a existing save, need to get more arguments. maybe a new dialog. +void SaveDataListDialog::OnEntryCopy(wxCommandEvent& event) +{ + int idx = m_list->GetFirstSelected(); + if (idx != wxNOT_FOUND) + { + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnEntryCopy called."); + //Some Operations? + UpdateList(); + } +} +//Remove a save file, need to be confirmed. +void SaveDataListDialog::OnEntryRemove(wxCommandEvent& event) +{ + int idx = m_list->GetFirstSelected(); + if (idx != wxNOT_FOUND) + { + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnEntryRemove called."); + //Some Operations? + UpdateList(); + } +} +//Display info dialog directly. +void SaveDataListDialog::OnEntryInfo(wxCommandEvent& event) +{ + int idx = m_list->GetFirstSelected(); + if (idx != wxNOT_FOUND) + { + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnEntryInfo called."); + SaveDataInformation info; //Only a stub now. + SaveDataInfoDialog(this, info).ShowModal(); + } +} +//Display info dialog directly. +void SaveDataListDialog::OnManage(wxCommandEvent& event) +{ + int idx = m_list->GetFirstSelected(); + if (idx != wxNOT_FOUND) + { + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnManage called."); + SaveDataEntry save; //Only a stub now. + SaveDataManageDialog(this, &m_sort_type, save).ShowModal(); + } +} +//When you press that select button in the Chooser mode. +void SaveDataListDialog::OnSelect(wxCommandEvent& event) +{ + int idx = m_list->GetFirstSelected(); + if (idx != wxNOT_FOUND) + { + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSelect called."); + EndModal(wxID_OK); + } +} +//Pop-up a small context-menu, being a replacement for SaveDataManageDialog +void SaveDataListDialog::OnRightClick(wxMouseEvent& event) +{ + wxMenu* menu = new wxMenu(); + int idx = m_list->GetFirstSelected(); + + //This is also a stub for the sort setting. Ids is set according to their sort-type integer. + m_sort_options = new wxMenu(); + m_sort_options->Append(0, "UserID"); + m_sort_options->Append(1, "Title"); + m_sort_options->Append(2, "Subtitle"); + //Well you can not use direct index cause you can not get its index through wxCommandEvent + m_sort_options->Bind(wxEVT_MENU, &SaveDataListDialog::OnSort, this); + + menu->AppendSubMenu(m_sort_options, "&Sort"); + menu->AppendSeparator(); + menu->Append(id_copy, "&Copy")->Enable(idx != wxNOT_FOUND); + menu->Append(id_remove, "&Remove")->Enable(idx != wxNOT_FOUND); + menu->AppendSeparator(); + menu->Append(id_info, "&Info"); + + PopupMenu(menu); +} +//This is intended to load the save data list from a way. However that is not certain for a stub. Does nothing now. +void SaveDataListDialog::LoadEntries(void) +{ + +} +//Setup some static items just for display. +void SaveDataListDialog::UpdateList(void) +{ + m_list->Freeze(); + m_list->DeleteAllItems(); + + m_list->InsertItem(0, 0); + m_list->SetItem(0, 0, "TEST00000"); + m_list->SetItem(0, 1, "00"); + m_list->SetItem(0, 2, "Final battle"); + + m_list->InsertItem(0, 0); + m_list->SetItem(0, 0, "XXXX99876"); + m_list->SetItem(0, 1, "30"); + m_list->SetItem(0, 2, "This is a fake game"); + + m_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); + m_list->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); + m_list->Thaw(); +} \ No newline at end of file diff --git a/rpcs3/Gui/SaveDataUtility.h b/rpcs3/Gui/SaveDataUtility.h new file mode 100644 index 0000000000..c04fa8f910 --- /dev/null +++ b/rpcs3/Gui/SaveDataUtility.h @@ -0,0 +1,83 @@ +#pragma once +#include "stdafx.h" +#include +#include +#include "Utilities/Log.h" +#include "Utilities/rFile.h" + +//TODO: Implement function calls related to Save Data List. +//Those function calls may be needed to use this GUI. +//Currently this is only a stub. + +//A stub for the struct sent to SaveDataInfoDialog. +struct SaveDataInformation +{ + +}; +//A stub for the sorting. +enum +{ + SAVE_DATA_LIST_SORT_BY_USERID +}; +//A stub for a single entry of save data. used to make a save data list or do management. +struct SaveDataEntry +{ + +}; + +enum +{ + id_copy, + id_remove, + id_info +}; + +//Used to display the information of a savedata. +//Not sure about what information should be displayed. +class SaveDataInfoDialog :public wxDialog +{ + wxListView* m_list; + + void UpdateData(); +public: + SaveDataInfoDialog(wxWindow* parent, const SaveDataInformation& info); +}; + +//Simple way to show up the sort menu and other operations +//Like what you get when press Triangle on SaveData. +class SaveDataManageDialog :public wxDialog +{ + wxComboBox* m_sort_options; + unsigned int* m_sort_type; + + void OnInfo(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnApplySort(wxCommandEvent& event); +public: + SaveDataManageDialog(wxWindow* parent, unsigned int* sort_type, SaveDataEntry& save); +}; + +//Display a list of SaveData. Would need to be initialized. +//Can also be used as a Save Data Chooser. +class SaveDataListDialog : public wxDialog +{ + wxListView* m_list; + wxMenu* m_sort_options; + unsigned int m_sort_type; + std::stringstream m_entry_convert; + + void OnSelect(wxCommandEvent& event); + void OnManage(wxCommandEvent& event); + + void OnRightClick(wxMouseEvent& event); + void OnSort(wxCommandEvent& event); + void OnEntryCopy(wxCommandEvent& event); + void OnEntryRemove(wxCommandEvent& event); + void OnEntryInfo(wxCommandEvent& event); + + void LoadEntries(void); + void UpdateList(void); +public: + SaveDataListDialog(wxWindow* parent, bool enable_manage); +}; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index aa7a3dd570..9b4424a1db 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -177,6 +177,7 @@ + @@ -221,6 +222,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index ab5d60bf39..7043c6c0f1 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -99,6 +99,9 @@ Gui + + Gui + @@ -209,5 +212,8 @@ Gui + + Gui + \ No newline at end of file From 9e59ccd9affa0c6d088c666250a213143805d051 Mon Sep 17 00:00:00 2001 From: luxsie <877033040@qq.com> Date: Fri, 15 Aug 2014 21:02:18 +0800 Subject: [PATCH 3/4] Typo Fix. Bind submenu items. --- rpcs3/Gui/SaveDataUtility.cpp | 12 +++++++----- rpcs3/Gui/SaveDataUtility.h | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rpcs3/Gui/SaveDataUtility.cpp b/rpcs3/Gui/SaveDataUtility.cpp index 41cef9d2ba..8c888dc084 100644 --- a/rpcs3/Gui/SaveDataUtility.cpp +++ b/rpcs3/Gui/SaveDataUtility.cpp @@ -216,6 +216,11 @@ SaveDataListDialog::SaveDataListDialog(wxWindow* parent, bool enable_manage) Bind(wxEVT_MENU, &SaveDataListDialog::OnEntryRemove, this, id_remove); Bind(wxEVT_MENU, &SaveDataListDialog::OnEntryInfo, this, id_info); + //Looks stupid, isn't it. I can't find Bind for range use.. + Bind(wxEVT_MENU, &SaveDataListDialog::OnSort, this, 0); + Bind(wxEVT_MENU, &SaveDataListDialog::OnSort, this, 1); + Bind(wxEVT_MENU, &SaveDataListDialog::OnSort, this, 2); + SetSizerAndFit(s_main); Layout(); Centre(wxBOTH); @@ -226,13 +231,12 @@ SaveDataListDialog::SaveDataListDialog(wxWindow* parent, bool enable_manage) //After you pick a menu item from the sort sub-menu void SaveDataListDialog::OnSort(wxCommandEvent& event) { - LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSort called."); - int idx = event.GetSelection(); + int idx = event.GetId(); + LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSort called. Type Value:%d", idx); if ((idx < m_sort_options->GetMenuItemCount()) && (idx >= 0)) { m_sort_type = idx; - LOG_WARNING(HLE, "Stub - SaveDataUtility: SaveDataListDialog: OnSort called. Type Value:%d",m_sort_type); } } //Copy a existing save, need to get more arguments. maybe a new dialog. @@ -300,8 +304,6 @@ void SaveDataListDialog::OnRightClick(wxMouseEvent& event) m_sort_options->Append(0, "UserID"); m_sort_options->Append(1, "Title"); m_sort_options->Append(2, "Subtitle"); - //Well you can not use direct index cause you can not get its index through wxCommandEvent - m_sort_options->Bind(wxEVT_MENU, &SaveDataListDialog::OnSort, this); menu->AppendSubMenu(m_sort_options, "&Sort"); menu->AppendSeparator(); diff --git a/rpcs3/Gui/SaveDataUtility.h b/rpcs3/Gui/SaveDataUtility.h index c04fa8f910..88037add29 100644 --- a/rpcs3/Gui/SaveDataUtility.h +++ b/rpcs3/Gui/SaveDataUtility.h @@ -27,7 +27,8 @@ struct SaveDataEntry enum { - id_copy, + //Reserved some Ids for Sort-By Submenu. + id_copy = 64, id_remove, id_info }; From d949ef1b8a626afc1638df2d9f768a72cb9d70da Mon Sep 17 00:00:00 2001 From: luxsie <877033040@qq.com> Date: Fri, 15 Aug 2014 21:36:20 +0800 Subject: [PATCH 4/4] Removed checking <0 on unsigned int. (lol) --- rpcs3/Gui/SaveDataUtility.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rpcs3/Gui/SaveDataUtility.cpp b/rpcs3/Gui/SaveDataUtility.cpp index 8c888dc084..82ed6a70d2 100644 --- a/rpcs3/Gui/SaveDataUtility.cpp +++ b/rpcs3/Gui/SaveDataUtility.cpp @@ -96,8 +96,7 @@ SaveDataManageDialog::SaveDataManageDialog(wxWindow* parent, unsigned int* sort_ if (m_sort_type != nullptr) { //Check sort type and set it to combo box - if ((*m_sort_type >= m_sort_options->GetCount()) - || (*m_sort_type < 0)) + if (*m_sort_type >= m_sort_options->GetCount()) { *m_sort_type = 0; }