Gamelist: Add option to hide the icon column (#604)

This commit is contained in:
SSimco 2024-03-25 23:30:39 +02:00 committed by GitHub
parent 4b7d2f88ae
commit fa4ad9b8c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View File

@ -84,6 +84,8 @@ void CemuConfig::Load(XMLConfigParser& parser)
game_list_style = gamelist.get("style", 0); game_list_style = gamelist.get("style", 0);
game_list_column_order = gamelist.get("order", ""); game_list_column_order = gamelist.get("order", "");
show_icon_column = parser.get("show_icon_column", true);
// return default width if value in config file out of range // return default width if value in config file out of range
auto loadColumnSize = [&gamelist] (const char *name, uint32 defaultWidth) auto loadColumnSize = [&gamelist] (const char *name, uint32 defaultWidth)
{ {
@ -385,6 +387,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
psize.set<sint32>("x", pad_size.x); psize.set<sint32>("x", pad_size.x);
psize.set<sint32>("y", pad_size.y); psize.set<sint32>("y", pad_size.y);
config.set<bool>("pad_maximized", pad_maximized); config.set<bool>("pad_maximized", pad_maximized);
config.set<bool>("show_icon_column" , show_icon_column);
auto gamelist = config.set("GameList"); auto gamelist = config.set("GameList");
gamelist.set("style", game_list_style); gamelist.set("style", game_list_style);

View File

@ -418,6 +418,8 @@ struct CemuConfig
ConfigValue<bool> did_show_graphic_pack_download{false}; ConfigValue<bool> did_show_graphic_pack_download{false};
ConfigValue<bool> did_show_macos_disclaimer{false}; ConfigValue<bool> did_show_macos_disclaimer{false};
ConfigValue<bool> show_icon_column{ false };
int game_list_style = 0; int game_list_style = 0;
std::string game_list_column_order; std::string game_list_column_order;
struct struct

View File

@ -88,7 +88,10 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
const auto& config = GetConfig(); const auto& config = GetConfig();
InsertColumn(ColumnHiddenName, "", wxLIST_FORMAT_LEFT, 0); InsertColumn(ColumnHiddenName, "", wxLIST_FORMAT_LEFT, 0);
InsertColumn(ColumnIcon, "", wxLIST_FORMAT_LEFT, kListIconWidth); if(config.show_icon_column)
InsertColumn(ColumnIcon, _("Icon"), wxLIST_FORMAT_LEFT, kListIconWidth);
else
InsertColumn(ColumnIcon, _("Icon"), wxLIST_FORMAT_LEFT, 0);
InsertColumn(ColumnName, _("Game"), wxLIST_FORMAT_LEFT, config.column_width.name); InsertColumn(ColumnName, _("Game"), wxLIST_FORMAT_LEFT, config.column_width.name);
InsertColumn(ColumnVersion, _("Version"), wxLIST_FORMAT_RIGHT, config.column_width.version); InsertColumn(ColumnVersion, _("Version"), wxLIST_FORMAT_RIGHT, config.column_width.version);
InsertColumn(ColumnDLC, _("DLC"), wxLIST_FORMAT_RIGHT, config.column_width.dlc); InsertColumn(ColumnDLC, _("DLC"), wxLIST_FORMAT_RIGHT, config.column_width.dlc);
@ -794,6 +797,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
ResetWidth = wxID_HIGHEST + 1, ResetWidth = wxID_HIGHEST + 1,
ResetOrder, ResetOrder,
ShowIcon,
ShowName, ShowName,
ShowVersion, ShowVersion,
ShowDlc, ShowDlc,
@ -810,6 +814,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
menu.Append(ResetOrder, _("Reset &order")) ; menu.Append(ResetOrder, _("Reset &order")) ;
menu.AppendSeparator(); menu.AppendSeparator();
menu.AppendCheckItem(ShowIcon, _("Show &icon"))->Check(GetColumnWidth(ColumnIcon) > 0);
menu.AppendCheckItem(ShowName, _("Show &name"))->Check(GetColumnWidth(ColumnName) > 0); menu.AppendCheckItem(ShowName, _("Show &name"))->Check(GetColumnWidth(ColumnName) > 0);
menu.AppendCheckItem(ShowVersion, _("Show &version"))->Check(GetColumnWidth(ColumnVersion) > 0); menu.AppendCheckItem(ShowVersion, _("Show &version"))->Check(GetColumnWidth(ColumnVersion) > 0);
menu.AppendCheckItem(ShowDlc, _("Show &dlc"))->Check(GetColumnWidth(ColumnDLC) > 0); menu.AppendCheckItem(ShowDlc, _("Show &dlc"))->Check(GetColumnWidth(ColumnDLC) > 0);
@ -828,6 +833,9 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case ShowIcon:
config.show_icon_column = menu->IsChecked(ShowIcon);
break;
case ShowName: case ShowName:
config.column_width.name = menu->IsChecked(ShowName) ? DefaultColumnSize::name : 0; config.column_width.name = menu->IsChecked(ShowName) ? DefaultColumnSize::name : 0;
break; break;
@ -907,7 +915,10 @@ void wxGameList::ApplyGameListColumnWidths()
{ {
const auto& config = GetConfig(); const auto& config = GetConfig();
wxWindowUpdateLocker lock(this); wxWindowUpdateLocker lock(this);
if(config.show_icon_column)
SetColumnWidth(ColumnIcon, kListIconWidth); SetColumnWidth(ColumnIcon, kListIconWidth);
else
SetColumnWidth(ColumnIcon, 0);
SetColumnWidth(ColumnName, config.column_width.name); SetColumnWidth(ColumnName, config.column_width.name);
SetColumnWidth(ColumnVersion, config.column_width.version); SetColumnWidth(ColumnVersion, config.column_width.version);
SetColumnWidth(ColumnDLC, config.column_width.dlc); SetColumnWidth(ColumnDLC, config.column_width.dlc);