From 91840cb4c77651179480f4c9480928b097296343 Mon Sep 17 00:00:00 2001 From: yourgamesbeover Date: Wed, 4 Jun 2014 09:54:48 -0400 Subject: [PATCH] added option for selecting which column are displayed in the game list, added optional game id column, and added config entry to disable making compressed games blue --- Source/Core/Core/ConfigManager.cpp | 22 +++++++++++ Source/Core/Core/ConfigManager.h | 12 ++++++ Source/Core/DolphinWX/Frame.cpp | 1 + Source/Core/DolphinWX/Frame.h | 1 + Source/Core/DolphinWX/FrameTools.cpp | 51 ++++++++++++++++++++++++++ Source/Core/DolphinWX/GameListCtrl.cpp | 42 ++++++++++++++------- Source/Core/DolphinWX/GameListCtrl.h | 1 + Source/Core/DolphinWX/Globals.h | 10 +++++ 8 files changed, 127 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index e5491fdae5..c166ccaad4 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -226,6 +226,16 @@ void SConfig::SaveSettings() ini.Set("GameList", "ListSort", m_ListSort); ini.Set("GameList", "ListSortSecondary", m_ListSort2); + ini.Set("GameList", "ColorCompressed", m_ColorCompressed); + + ini.Set("GameList", "ColumnPlatform", m_showSystemColumn); + ini.Set("GameList", "ColumnBanner", m_showBannerColumn); + ini.Set("GameList", "ColumnNotes", m_showNotesColumn); + ini.Set("GameList", "ColumnID", m_showIDColumn); + ini.Set("GameList", "ColumnRegion", m_showRegionColumn); + ini.Set("GameList", "ColumnSize", m_showSizeColumn); + ini.Set("GameList", "ColumnState", m_showStateColumn); + // Core ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); @@ -376,6 +386,18 @@ void SConfig::LoadSettings() ini.Get("GameList", "ListSort", &m_ListSort, 3); ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0); + // Determines if compressed games display in blue + ini.Get("GameList", "ColorCompressed", &m_ColorCompressed, true); + + // Gamelist columns toggles + ini.Get("GameList", "ColumnPlatform", &m_showSystemColumn, true); + ini.Get("GameList", "ColumnBanner", &m_showBannerColumn, true); + ini.Get("GameList", "ColumnNotes", &m_showNotesColumn, true); + ini.Get("GameList", "ColumnID", &m_showIDColumn, false); + ini.Get("GameList", "ColumnRegion", &m_showRegionColumn, true); + ini.Get("GameList", "ColumnSize", &m_showSizeColumn, true); + ini.Get("GameList", "ColumnState", &m_showStateColumn, true); + // Core ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); #ifdef _M_X86 diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 9f70e88168..afc2f14c52 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -72,6 +72,18 @@ struct SConfig : NonCopyable int m_ListSort; int m_ListSort2; + // Game list column toggles + bool m_showSystemColumn; + bool m_showBannerColumn; + bool m_showNotesColumn; + bool m_showIDColumn; + bool m_showRegionColumn; + bool m_showSizeColumn; + bool m_showStateColumn; + + // Toggles whether compressed titles show up in blue in the game list + bool m_ColorCompressed; + std::string m_WirelessMac; bool m_PauseMovie; bool m_ShowLag; diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index b1c15bb874..199d25b374 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -248,6 +248,7 @@ EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) EVT_MENU_RANGE(IDM_LOGWINDOW, IDM_VIDEOWINDOW, CFrame::OnToggleWindow) +EVT_MENU_RANGE(IDM_SHOW_SYSTEM, IDM_SHOW_STATE, CFrame::OnChangeColumnsVisible) EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged) diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 20498c7ebc..f8a260206a 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -343,6 +343,7 @@ private: void OnRenderParentResize(wxSizeEvent& event); bool RendererIsFullscreen(); void StartGame(const std::string& filename); + void OnChangeColumnsVisible(wxCommandEvent& event); // Event table DECLARE_EVENT_TABLE(); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 999243077d..e9da74c5fa 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -318,6 +318,26 @@ void CFrame::CreateMenu() viewMenu->AppendCheckItem(IDM_LISTDRIVES, _("Show Drives")); viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives); viewMenu->Append(IDM_PURGECACHE, _("Purge Cache")); + + wxMenu *columnsMenu = new wxMenu; + viewMenu->AppendSubMenu(columnsMenu, _("Select Columns")); + columnsMenu->AppendCheckItem(IDM_SHOW_SYSTEM, _("Platform")); + columnsMenu->Check(IDM_SHOW_SYSTEM, SConfig::GetInstance().m_showSystemColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_BANNER, _("Banner")); + columnsMenu->Check(IDM_SHOW_BANNER, SConfig::GetInstance().m_showBannerColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_NOTES, _("Notes")); + columnsMenu->Check(IDM_SHOW_NOTES, SConfig::GetInstance().m_showNotesColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_ID, _("Game ID")); + columnsMenu->Check(IDM_SHOW_ID, SConfig::GetInstance().m_showIDColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_REGION, _("Region")); + columnsMenu->Check(IDM_SHOW_REGION, SConfig::GetInstance().m_showRegionColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_SIZE, _("File size")); + columnsMenu->Check(IDM_SHOW_SIZE, SConfig::GetInstance().m_showSizeColumn); + columnsMenu->AppendCheckItem(IDM_SHOW_STATE, _("State")); + columnsMenu->Check(IDM_SHOW_STATE, SConfig::GetInstance().m_showStateColumn); + + + m_MenuBar->Append(viewMenu, _("&View")); if (g_pCodeWindow) @@ -1884,3 +1904,34 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) this->SendSizeEvent(); } + +void CFrame::OnChangeColumnsVisible(wxCommandEvent& event) +{ + switch (event.GetId()) + { + case IDM_SHOW_SYSTEM: + SConfig::GetInstance().m_showSystemColumn = !SConfig::GetInstance().m_showSystemColumn; + break; + case IDM_SHOW_BANNER: + SConfig::GetInstance().m_showBannerColumn = !SConfig::GetInstance().m_showBannerColumn; + break; + case IDM_SHOW_NOTES: + SConfig::GetInstance().m_showNotesColumn = !SConfig::GetInstance().m_showNotesColumn; + break; + case IDM_SHOW_ID: + SConfig::GetInstance().m_showIDColumn = !SConfig::GetInstance().m_showIDColumn; + break; + case IDM_SHOW_REGION: + SConfig::GetInstance().m_showRegionColumn = !SConfig::GetInstance().m_showRegionColumn; + break; + case IDM_SHOW_SIZE: + SConfig::GetInstance().m_showSizeColumn = !SConfig::GetInstance().m_showSizeColumn; + break; + case IDM_SHOW_STATE: + SConfig::GetInstance().m_showStateColumn = !SConfig::GetInstance().m_showStateColumn; + break; + default: return; + } + m_GameListCtrl->Update(); + SConfig::GetInstance().SaveSettings(); +} diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index d3fc07033d..63d7418337 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -143,6 +143,8 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is iso2->GetCompany() : iso2->GetDescription(indexOther); return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t; } + case CGameListCtrl::COLUMN_ID: + return strcasecmp(iso1->GetUniqueID().c_str(), iso2->GetUniqueID().c_str()) * t; case CGameListCtrl::COLUMN_COUNTRY: if (iso1->GetCountry() > iso2->GetCountry()) return 1 * t; @@ -317,6 +319,7 @@ void CGameListCtrl::Update() // wii titles We show in the same column : company for GC games and // description for wii/wad games InsertColumn(COLUMN_NOTES, _("Notes")); + InsertColumn(COLUMN_ID, _("ID")); InsertColumn(COLUMN_COUNTRY, ""); InsertColumn(COLUMN_SIZE, _("Size")); InsertColumn(COLUMN_EMULATION_STATE, _("State")); @@ -329,18 +332,19 @@ void CGameListCtrl::Update() // set initial sizes for columns SetColumnWidth(COLUMN_DUMMY,0); - SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding); - SetColumnWidth(COLUMN_BANNER, 96 + platform_padding); - SetColumnWidth(COLUMN_TITLE, 200 + platform_padding); - SetColumnWidth(COLUMN_NOTES, 200 + platform_padding); - SetColumnWidth(COLUMN_COUNTRY, 32 + platform_padding); - SetColumnWidth(COLUMN_EMULATION_STATE, 50 + platform_padding); + SetColumnWidth(COLUMN_PLATFORM, SConfig::GetInstance().m_showSystemColumn ? 35 + platform_padding : 0); + SetColumnWidth(COLUMN_BANNER, SConfig::GetInstance().m_showBannerColumn ? 96 + platform_padding : 0); + SetColumnWidth(COLUMN_TITLE, 175 + platform_padding); + SetColumnWidth(COLUMN_NOTES, SConfig::GetInstance().m_showNotesColumn ? 150 + platform_padding : 0); + SetColumnWidth(COLUMN_ID, SConfig::GetInstance().m_showIDColumn ? 75 + platform_padding : 0); + SetColumnWidth(COLUMN_COUNTRY, SConfig::GetInstance().m_showRegionColumn ? 32 + platform_padding : 0); + SetColumnWidth(COLUMN_EMULATION_STATE, SConfig::GetInstance().m_showStateColumn ? 50 + platform_padding : 0); // add all items for (int i = 0; i < (int)m_ISOFiles.size(); i++) { InsertItemInReportView(i); - if (m_ISOFiles[i]->IsCompressed()) + if (SConfig::GetInstance().m_ColorCompressed && m_ISOFiles[i]->IsCompressed()) SetItemTextColour(i, wxColour(0xFF0000)); } @@ -459,6 +463,9 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // File size SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); + // Game ID + SetItem(_Index, COLUMN_ID, rISOFile.GetUniqueID(), -1); + // Background color SetBackgroundColor(); @@ -1278,20 +1285,29 @@ void CGameListCtrl::AutomaticColumnWidth() { SetColumnWidth(0, rc.GetWidth()); } - else if (GetColumnCount() > 4) + else { + int resizable = rc.GetWidth() - ( - GetColumnWidth(COLUMN_BANNER) + GetColumnWidth(COLUMN_PLATFORM) + + GetColumnWidth(COLUMN_BANNER) + + GetColumnWidth(COLUMN_ID) + GetColumnWidth(COLUMN_COUNTRY) + GetColumnWidth(COLUMN_SIZE) - + GetColumnWidth(COLUMN_EMULATION_STATE) - + GetColumnWidth(COLUMN_PLATFORM)); + + GetColumnWidth(COLUMN_EMULATION_STATE)); // We hide the Notes column if the window is too small if (resizable > 400) { - SetColumnWidth(COLUMN_TITLE, resizable / 2); - SetColumnWidth(COLUMN_NOTES, resizable / 2); + if (SConfig::GetInstance().m_showNotesColumn) + { + SetColumnWidth(COLUMN_TITLE, resizable / 2); + SetColumnWidth(COLUMN_NOTES, resizable / 2); + } + else + { + SetColumnWidth(COLUMN_TITLE, resizable); + } } else { diff --git a/Source/Core/DolphinWX/GameListCtrl.h b/Source/Core/DolphinWX/GameListCtrl.h index 402fcf283c..3349b52861 100644 --- a/Source/Core/DolphinWX/GameListCtrl.h +++ b/Source/Core/DolphinWX/GameListCtrl.h @@ -51,6 +51,7 @@ public: COLUMN_BANNER, COLUMN_TITLE, COLUMN_NOTES, + COLUMN_ID, COLUMN_COUNTRY, COLUMN_SIZE, COLUMN_EMULATION_STATE, diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 19a880870f..62b3cc2f44 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -138,6 +138,16 @@ enum IDM_VIDEOWINDOW, IDM_CODEWINDOW, + // List Column Title Toggles + IDM_SHOW_SYSTEM, + IDM_SHOW_BANNER, + IDM_SHOW_NOTES, + IDM_SHOW_ID, + IDM_SHOW_REGION, + IDM_SHOW_SIZE, + IDM_SHOW_STATE, + + // Float Window IDs IDM_LOGWINDOW_PARENT, IDM_LOGCONFIGWINDOW_PARENT,