From b9de74f5c674df05324618d7728b74ed31fd9a4a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 30 Mar 2014 00:13:00 -0400 Subject: [PATCH] Move VHDDManager over to using vector. Also fix some variable and function name typos. --- rpcs3/Gui/VHDDManager.cpp | 46 +++++++++++++++++++-------------------- rpcs3/Gui/VHDDManager.h | 9 ++++---- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/rpcs3/Gui/VHDDManager.cpp b/rpcs3/Gui/VHDDManager.cpp index bc16439916..f64bef72b3 100644 --- a/rpcs3/Gui/VHDDManager.cpp +++ b/rpcs3/Gui/VHDDManager.cpp @@ -87,7 +87,7 @@ void VHDDExplorer::UpdateList() { m_list->Freeze(); m_list->DeleteAllItems(); - m_entries.Clear(); + m_entries.clear(); m_names.Clear(); u64 block; @@ -101,7 +101,7 @@ void VHDDExplorer::UpdateList() m_list->SetItem(item, 1, entry.type == vfsHDD_Entry_Dir ? "Dir" : "File"); m_list->SetItem(item, 2, wxString::Format("%lld", entry.size)); m_list->SetItem(item, 3, wxDateTime().Set(time_t(entry.ctime)).Format()); - m_entries.AddCpy(entry); + m_entries.push_back(entry); m_names.Add(name); } @@ -397,7 +397,7 @@ VHDDManagerDialog::VHDDManagerDialog(wxWindow* parent) Connect(id_remove, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(VHDDManagerDialog::OnRemove)); Connect(id_create_hdd, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(VHDDManagerDialog::OnCreateHDD)); Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VHDDManagerDialog::OnClose)); - LoadPathes(); + LoadPaths(); UpdateList(); } @@ -406,9 +406,9 @@ void VHDDManagerDialog::UpdateList() m_list->Freeze(); m_list->DeleteAllItems(); - for(size_t i=0; iInsertItem(i, m_pathes[i]); + m_list->InsertItem(i, m_paths[i]); } m_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); @@ -420,7 +420,7 @@ void VHDDManagerDialog::UpdateList() void VHDDManagerDialog::Open(int sel) { - VHDDExplorer dial(this, m_pathes[sel]); + VHDDExplorer dial(this, m_paths[sel]); dial.ShowModal(); } @@ -439,14 +439,14 @@ void VHDDManagerDialog::AddHDD(wxCommandEvent& event) return; } - wxArrayString pathes; - ctrl.GetPaths(pathes); - for(size_t i=0; iGetNextSelected(-1), offs = 0; sel != wxNOT_FOUND; sel = m_list->GetNextSelected(sel), --offs) { - m_pathes.RemoveAt(sel + offs); + m_paths.erase(m_paths.begin() + (sel + offs)); } UpdateList(); @@ -506,44 +506,42 @@ void VHDDManagerDialog::OnCreateHDD(wxCommandEvent& event) u64 size, bsize; dial.GetResult(size, bsize); vfsHDDManager::CreateHDD(ctrl.GetPath(), size, bsize); - m_pathes.AddCpy(ctrl.GetPath()); + m_paths.push_back(ctrl.GetPath()); UpdateList(); } } void VHDDManagerDialog::OnClose(wxCloseEvent& event) { - SavePathes(); + SavePaths(); event.Skip(); } -void VHDDManagerDialog::LoadPathes() +void VHDDManagerDialog::LoadPaths() { IniEntry path_count; path_count.Init("path_count", "HDDManager"); int count = 0; count = path_count.LoadValue(count); - m_pathes.SetCount(count); - - for(size_t i=0; i path_entry; path_entry.Init(wxString::Format("path[%d]", i), "HDDManager"); - new (m_pathes + i) wxString(path_entry.LoadValue(wxEmptyString)); + m_paths.emplace_back(path_entry.LoadValue(wxEmptyString)); } } -void VHDDManagerDialog::SavePathes() +void VHDDManagerDialog::SavePaths() { IniEntry path_count; path_count.Init("path_count", "HDDManager"); - path_count.SaveValue(m_pathes.GetCount()); + path_count.SaveValue(m_paths.size()); - for(size_t i=0; i path_entry; path_entry.Init(wxString::Format("path[%d]", i), "HDDManager"); - path_entry.SaveValue(m_pathes[i]); + path_entry.SaveValue(m_paths[i]); } } diff --git a/rpcs3/Gui/VHDDManager.h b/rpcs3/Gui/VHDDManager.h index 744760f27e..8632f225bb 100644 --- a/rpcs3/Gui/VHDDManager.h +++ b/rpcs3/Gui/VHDDManager.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include "Emu/HDD/HDD.h" @@ -20,7 +21,7 @@ public: class VHDDExplorer : public wxDialog { - Array m_entries; + std::vector m_entries; wxArrayString m_names; wxListView* m_list; vfsHDD* m_hdd; @@ -65,7 +66,7 @@ public: class VHDDManagerDialog : public wxDialog { - Array m_pathes; + std::vector m_paths; wxListView* m_list; public: @@ -82,6 +83,6 @@ public: void OnCreateHDD(wxCommandEvent& event); void OnClose(wxCloseEvent& event); - void LoadPathes(); - void SavePathes(); + void LoadPaths(); + void SavePaths(); };