Skip to content

Commit

Permalink
Gamelist: Add option to hide the icon column (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
SSimco authored Mar 25, 2024
1 parent 4b7d2f8 commit fa4ad9b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/config/CemuConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ void CemuConfig::Load(XMLConfigParser& parser)
game_list_style = gamelist.get("style", 0);
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
auto loadColumnSize = [&gamelist] (const char *name, uint32 defaultWidth)
{
Expand Down Expand Up @@ -385,6 +387,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
psize.set<sint32>("x", pad_size.x);
psize.set<sint32>("y", pad_size.y);
config.set<bool>("pad_maximized", pad_maximized);
config.set<bool>("show_icon_column" , show_icon_column);

auto gamelist = config.set("GameList");
gamelist.set("style", game_list_style);
Expand Down
2 changes: 2 additions & 0 deletions src/config/CemuConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ struct CemuConfig
ConfigValue<bool> did_show_graphic_pack_download{false};
ConfigValue<bool> did_show_macos_disclaimer{false};

ConfigValue<bool> show_icon_column{ false };

int game_list_style = 0;
std::string game_list_column_order;
struct
Expand Down
15 changes: 13 additions & 2 deletions src/gui/components/wxGameList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
const auto& config = GetConfig();

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(ColumnVersion, _("Version"), wxLIST_FORMAT_RIGHT, config.column_width.version);
InsertColumn(ColumnDLC, _("DLC"), wxLIST_FORMAT_RIGHT, config.column_width.dlc);
Expand Down Expand Up @@ -794,6 +797,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
ResetWidth = wxID_HIGHEST + 1,
ResetOrder,

ShowIcon,
ShowName,
ShowVersion,
ShowDlc,
Expand All @@ -810,6 +814,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
menu.Append(ResetOrder, _("Reset &order")) ;

menu.AppendSeparator();
menu.AppendCheckItem(ShowIcon, _("Show &icon"))->Check(GetColumnWidth(ColumnIcon) > 0);
menu.AppendCheckItem(ShowName, _("Show &name"))->Check(GetColumnWidth(ColumnName) > 0);
menu.AppendCheckItem(ShowVersion, _("Show &version"))->Check(GetColumnWidth(ColumnVersion) > 0);
menu.AppendCheckItem(ShowDlc, _("Show &dlc"))->Check(GetColumnWidth(ColumnDLC) > 0);
Expand All @@ -828,6 +833,9 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)

switch (event.GetId())
{
case ShowIcon:
config.show_icon_column = menu->IsChecked(ShowIcon);
break;
case ShowName:
config.column_width.name = menu->IsChecked(ShowName) ? DefaultColumnSize::name : 0;
break;
Expand Down Expand Up @@ -907,7 +915,10 @@ void wxGameList::ApplyGameListColumnWidths()
{
const auto& config = GetConfig();
wxWindowUpdateLocker lock(this);
SetColumnWidth(ColumnIcon, kListIconWidth);
if(config.show_icon_column)
SetColumnWidth(ColumnIcon, kListIconWidth);
else
SetColumnWidth(ColumnIcon, 0);
SetColumnWidth(ColumnName, config.column_width.name);
SetColumnWidth(ColumnVersion, config.column_width.version);
SetColumnWidth(ColumnDLC, config.column_width.dlc);
Expand Down

0 comments on commit fa4ad9b

Please sign in to comment.