Config: Port GameList settings to new config system.

This commit is contained in:
Admiral H. Curtiss 2021-12-26 23:46:35 +01:00
parent a29d7625dd
commit 5999e9e139
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
8 changed files with 163 additions and 207 deletions

View File

@ -202,4 +202,50 @@ const Info<bool> MAIN_ANALYTICS_ENABLED{{System::Main, "Analytics", "Enabled"},
const Info<bool> MAIN_ANALYTICS_PERMISSION_ASKED{{System::Main, "Analytics", "PermissionAsked"},
false};
// Main.GameList
const Info<bool> MAIN_GAMELIST_LIST_DRIVES{{System::Main, "GameList", "ListDrives"}, false};
const Info<bool> MAIN_GAMELIST_LIST_WAD{{System::Main, "GameList", "ListWad"}, true};
const Info<bool> MAIN_GAMELIST_LIST_ELF_DOL{{System::Main, "GameList", "ListElfDol"}, true};
const Info<bool> MAIN_GAMELIST_LIST_WII{{System::Main, "GameList", "ListWii"}, true};
const Info<bool> MAIN_GAMELIST_LIST_GC{{System::Main, "GameList", "ListGC"}, true};
const Info<bool> MAIN_GAMELIST_LIST_JPN{{System::Main, "GameList", "ListJap"}, true};
const Info<bool> MAIN_GAMELIST_LIST_PAL{{System::Main, "GameList", "ListPal"}, true};
const Info<bool> MAIN_GAMELIST_LIST_USA{{System::Main, "GameList", "ListUsa"}, true};
const Info<bool> MAIN_GAMELIST_LIST_AUSTRALIA{{System::Main, "GameList", "ListAustralia"}, true};
const Info<bool> MAIN_GAMELIST_LIST_FRANCE{{System::Main, "GameList", "ListFrance"}, true};
const Info<bool> MAIN_GAMELIST_LIST_GERMANY{{System::Main, "GameList", "ListGermany"}, true};
const Info<bool> MAIN_GAMELIST_LIST_ITALY{{System::Main, "GameList", "ListItaly"}, true};
const Info<bool> MAIN_GAMELIST_LIST_KOREA{{System::Main, "GameList", "ListKorea"}, true};
const Info<bool> MAIN_GAMELIST_LIST_NETHERLANDS{{System::Main, "GameList", "ListNetherlands"},
true};
const Info<bool> MAIN_GAMELIST_LIST_RUSSIA{{System::Main, "GameList", "ListRussia"}, true};
const Info<bool> MAIN_GAMELIST_LIST_SPAIN{{System::Main, "GameList", "ListSpain"}, true};
const Info<bool> MAIN_GAMELIST_LIST_TAIWAN{{System::Main, "GameList", "ListTaiwan"}, true};
const Info<bool> MAIN_GAMELIST_LIST_WORLD{{System::Main, "GameList", "ListWorld"}, true};
const Info<bool> MAIN_GAMELIST_LIST_UNKNOWN{{System::Main, "GameList", "ListUnknown"}, true};
const Info<int> MAIN_GAMELIST_LIST_SORT{{System::Main, "GameList", "ListSort"}, 3};
const Info<int> MAIN_GAMELIST_LIST_SORT_SECONDARY{{System::Main, "GameList", "ListSortSecondary"},
0};
const Info<bool> MAIN_GAMELIST_COLUMN_PLATFORM{{System::Main, "GameList", "ColumnPlatform"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_DESCRIPTION{{System::Main, "GameList", "ColumnDescription"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_BANNER{{System::Main, "GameList", "ColumnBanner"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_TITLE{{System::Main, "GameList", "ColumnTitle"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_MAKER{{System::Main, "GameList", "ColumnNotes"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_FILE_NAME{{System::Main, "GameList", "ColumnFileName"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_FILE_PATH{{System::Main, "GameList", "ColumnFilePath"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_GAME_ID{{System::Main, "GameList", "ColumnID"}, false};
const Info<bool> MAIN_GAMELIST_COLUMN_REGION{{System::Main, "GameList", "ColumnRegion"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_FILE_SIZE{{System::Main, "GameList", "ColumnSize"}, true};
const Info<bool> MAIN_GAMELIST_COLUMN_FILE_FORMAT{{System::Main, "GameList", "ColumnFileFormat"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_BLOCK_SIZE{{System::Main, "GameList", "ColumnBlockSize"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_COMPRESSION{{System::Main, "GameList", "ColumnCompression"},
false};
const Info<bool> MAIN_GAMELIST_COLUMN_TAGS{{System::Main, "GameList", "ColumnTags"}, false};
} // namespace Config

View File

@ -171,4 +171,43 @@ extern const Info<bool> MAIN_SKIP_NKIT_WARNING;
extern const Info<std::string> MAIN_ANALYTICS_ID;
extern const Info<bool> MAIN_ANALYTICS_ENABLED;
extern const Info<bool> MAIN_ANALYTICS_PERMISSION_ASKED;
// Main.GameList
extern const Info<bool> MAIN_GAMELIST_LIST_DRIVES;
extern const Info<bool> MAIN_GAMELIST_LIST_WAD;
extern const Info<bool> MAIN_GAMELIST_LIST_ELF_DOL;
extern const Info<bool> MAIN_GAMELIST_LIST_WII;
extern const Info<bool> MAIN_GAMELIST_LIST_GC;
extern const Info<bool> MAIN_GAMELIST_LIST_JPN;
extern const Info<bool> MAIN_GAMELIST_LIST_PAL;
extern const Info<bool> MAIN_GAMELIST_LIST_USA;
extern const Info<bool> MAIN_GAMELIST_LIST_AUSTRALIA;
extern const Info<bool> MAIN_GAMELIST_LIST_FRANCE;
extern const Info<bool> MAIN_GAMELIST_LIST_GERMANY;
extern const Info<bool> MAIN_GAMELIST_LIST_ITALY;
extern const Info<bool> MAIN_GAMELIST_LIST_KOREA;
extern const Info<bool> MAIN_GAMELIST_LIST_NETHERLANDS;
extern const Info<bool> MAIN_GAMELIST_LIST_RUSSIA;
extern const Info<bool> MAIN_GAMELIST_LIST_SPAIN;
extern const Info<bool> MAIN_GAMELIST_LIST_TAIWAN;
extern const Info<bool> MAIN_GAMELIST_LIST_WORLD;
extern const Info<bool> MAIN_GAMELIST_LIST_UNKNOWN;
extern const Info<int> MAIN_GAMELIST_LIST_SORT;
extern const Info<int> MAIN_GAMELIST_LIST_SORT_SECONDARY;
extern const Info<bool> MAIN_GAMELIST_COLUMN_PLATFORM;
extern const Info<bool> MAIN_GAMELIST_COLUMN_DESCRIPTION;
extern const Info<bool> MAIN_GAMELIST_COLUMN_BANNER;
extern const Info<bool> MAIN_GAMELIST_COLUMN_TITLE;
extern const Info<bool> MAIN_GAMELIST_COLUMN_MAKER;
extern const Info<bool> MAIN_GAMELIST_COLUMN_FILE_NAME;
extern const Info<bool> MAIN_GAMELIST_COLUMN_FILE_PATH;
extern const Info<bool> MAIN_GAMELIST_COLUMN_GAME_ID;
extern const Info<bool> MAIN_GAMELIST_COLUMN_REGION;
extern const Info<bool> MAIN_GAMELIST_COLUMN_FILE_SIZE;
extern const Info<bool> MAIN_GAMELIST_COLUMN_FILE_FORMAT;
extern const Info<bool> MAIN_GAMELIST_COLUMN_BLOCK_SIZE;
extern const Info<bool> MAIN_GAMELIST_COLUMN_COMPRESSION;
extern const Info<bool> MAIN_GAMELIST_COLUMN_TAGS;
} // namespace Config

View File

@ -26,7 +26,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
if (config_location.system == Config::System::Main)
{
for (const std::string_view section : {"NetPlay", "General", "GBA", "Display", "Network",
"Analytics", "AndroidOverlayButtons", "DSP"})
"Analytics", "AndroidOverlayButtons", "DSP", "GameList"})
{
if (config_location.section == section)
return true;

View File

@ -90,7 +90,6 @@ void SConfig::SaveSettings()
SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
SaveGameListSettings(ini);
SaveCoreSettings(ini);
SaveMovieSettings(ini);
SaveInputSettings(ini);
@ -153,48 +152,6 @@ void SConfig::SaveInterfaceSettings(IniFile& ini)
interface->Set("DebugModeEnabled", bEnableDebugging);
}
void SConfig::SaveGameListSettings(IniFile& ini)
{
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
gamelist->Set("ListDrives", m_ListDrives);
gamelist->Set("ListWad", m_ListWad);
gamelist->Set("ListElfDol", m_ListElfDol);
gamelist->Set("ListWii", m_ListWii);
gamelist->Set("ListGC", m_ListGC);
gamelist->Set("ListJap", m_ListJap);
gamelist->Set("ListPal", m_ListPal);
gamelist->Set("ListUsa", m_ListUsa);
gamelist->Set("ListAustralia", m_ListAustralia);
gamelist->Set("ListFrance", m_ListFrance);
gamelist->Set("ListGermany", m_ListGermany);
gamelist->Set("ListItaly", m_ListItaly);
gamelist->Set("ListKorea", m_ListKorea);
gamelist->Set("ListNetherlands", m_ListNetherlands);
gamelist->Set("ListRussia", m_ListRussia);
gamelist->Set("ListSpain", m_ListSpain);
gamelist->Set("ListTaiwan", m_ListTaiwan);
gamelist->Set("ListWorld", m_ListWorld);
gamelist->Set("ListUnknown", m_ListUnknown);
gamelist->Set("ListSort", m_ListSort);
gamelist->Set("ListSortSecondary", m_ListSort2);
gamelist->Set("ColumnPlatform", m_showSystemColumn);
gamelist->Set("ColumnBanner", m_showBannerColumn);
gamelist->Set("ColumnDescription", m_showDescriptionColumn);
gamelist->Set("ColumnTitle", m_showTitleColumn);
gamelist->Set("ColumnNotes", m_showMakerColumn);
gamelist->Set("ColumnFileName", m_showFileNameColumn);
gamelist->Set("ColumnFilePath", m_showFilePathColumn);
gamelist->Set("ColumnID", m_showIDColumn);
gamelist->Set("ColumnRegion", m_showRegionColumn);
gamelist->Set("ColumnSize", m_showSizeColumn);
gamelist->Set("ColumnFileFormat", m_showFileFormatColumn);
gamelist->Set("ColumnBlockSize", m_showBlockSizeColumn);
gamelist->Set("ColumnCompression", m_showCompressionColumn);
gamelist->Set("ColumnTags", m_showTagsColumn);
}
void SConfig::SaveCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");
@ -331,7 +288,6 @@ void SConfig::LoadSettings()
LoadGeneralSettings(ini);
LoadInterfaceSettings(ini);
LoadGameListSettings(ini);
LoadCoreSettings(ini);
LoadMovieSettings(ini);
LoadInputSettings(ini);
@ -385,50 +341,6 @@ void SConfig::LoadInterfaceSettings(IniFile& ini)
interface->Get("DebugModeEnabled", &bEnableDebugging, false);
}
void SConfig::LoadGameListSettings(IniFile& ini)
{
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
gamelist->Get("ListDrives", &m_ListDrives, false);
gamelist->Get("ListWad", &m_ListWad, true);
gamelist->Get("ListElfDol", &m_ListElfDol, true);
gamelist->Get("ListWii", &m_ListWii, true);
gamelist->Get("ListGC", &m_ListGC, true);
gamelist->Get("ListJap", &m_ListJap, true);
gamelist->Get("ListPal", &m_ListPal, true);
gamelist->Get("ListUsa", &m_ListUsa, true);
gamelist->Get("ListAustralia", &m_ListAustralia, true);
gamelist->Get("ListFrance", &m_ListFrance, true);
gamelist->Get("ListGermany", &m_ListGermany, true);
gamelist->Get("ListItaly", &m_ListItaly, true);
gamelist->Get("ListKorea", &m_ListKorea, true);
gamelist->Get("ListNetherlands", &m_ListNetherlands, true);
gamelist->Get("ListRussia", &m_ListRussia, true);
gamelist->Get("ListSpain", &m_ListSpain, true);
gamelist->Get("ListTaiwan", &m_ListTaiwan, true);
gamelist->Get("ListWorld", &m_ListWorld, true);
gamelist->Get("ListUnknown", &m_ListUnknown, true);
gamelist->Get("ListSort", &m_ListSort, 3);
gamelist->Get("ListSortSecondary", &m_ListSort2, 0);
// Gamelist columns toggles
gamelist->Get("ColumnPlatform", &m_showSystemColumn, true);
gamelist->Get("ColumnDescription", &m_showDescriptionColumn, false);
gamelist->Get("ColumnBanner", &m_showBannerColumn, true);
gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
gamelist->Get("ColumnFilePath", &m_showFilePathColumn, false);
gamelist->Get("ColumnID", &m_showIDColumn, false);
gamelist->Get("ColumnRegion", &m_showRegionColumn, true);
gamelist->Get("ColumnSize", &m_showSizeColumn, true);
gamelist->Get("ColumnFileFormat", &m_showFileFormatColumn, false);
gamelist->Get("ColumnBlockSize", &m_showBlockSizeColumn, false);
gamelist->Get("ColumnCompression", &m_showCompressionColumn, false);
gamelist->Get("ColumnTags", &m_showTagsColumn, false);
}
void SConfig::LoadCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");

View File

@ -228,44 +228,6 @@ struct SConfig
bool m_show_active_title = false;
bool m_use_builtin_title_database = true;
bool m_ListDrives;
bool m_ListWad;
bool m_ListElfDol;
bool m_ListWii;
bool m_ListGC;
bool m_ListPal;
bool m_ListUsa;
bool m_ListJap;
bool m_ListAustralia;
bool m_ListFrance;
bool m_ListGermany;
bool m_ListItaly;
bool m_ListKorea;
bool m_ListNetherlands;
bool m_ListRussia;
bool m_ListSpain;
bool m_ListTaiwan;
bool m_ListWorld;
bool m_ListUnknown;
int m_ListSort;
int m_ListSort2;
// Game list column toggles
bool m_showSystemColumn;
bool m_showBannerColumn;
bool m_showDescriptionColumn;
bool m_showTitleColumn;
bool m_showMakerColumn;
bool m_showFileNameColumn;
bool m_showFilePathColumn;
bool m_showIDColumn;
bool m_showRegionColumn;
bool m_showSizeColumn;
bool m_showFileFormatColumn;
bool m_showBlockSizeColumn;
bool m_showCompressionColumn;
bool m_showTagsColumn;
std::string m_WirelessMac;
bool m_PauseMovie;
bool m_ShowRerecord;
@ -310,7 +272,6 @@ private:
void SaveGeneralSettings(IniFile& ini);
void SaveInterfaceSettings(IniFile& ini);
void SaveGameListSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini);
void SaveMovieSettings(IniFile& ini);
@ -322,7 +283,6 @@ private:
void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
void LoadGameListSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini);
void LoadMovieSettings(IniFile& ini);

View File

@ -218,26 +218,25 @@ GameList::~GameList()
void GameList::UpdateColumnVisibility()
{
const auto& config = SConfig::GetInstance();
const auto SetVisiblity = [this](const GameListModel::Column column, const bool is_visible) {
m_list->setColumnHidden(static_cast<int>(column), !is_visible);
};
using Column = GameListModel::Column;
SetVisiblity(Column::Platform, config.m_showSystemColumn);
SetVisiblity(Column::Banner, config.m_showBannerColumn);
SetVisiblity(Column::Title, config.m_showTitleColumn);
SetVisiblity(Column::Description, config.m_showDescriptionColumn);
SetVisiblity(Column::Maker, config.m_showMakerColumn);
SetVisiblity(Column::ID, config.m_showIDColumn);
SetVisiblity(Column::Country, config.m_showRegionColumn);
SetVisiblity(Column::Size, config.m_showSizeColumn);
SetVisiblity(Column::FileName, config.m_showFileNameColumn);
SetVisiblity(Column::FilePath, config.m_showFilePathColumn);
SetVisiblity(Column::FileFormat, config.m_showFileFormatColumn);
SetVisiblity(Column::BlockSize, config.m_showBlockSizeColumn);
SetVisiblity(Column::Compression, config.m_showCompressionColumn);
SetVisiblity(Column::Tags, config.m_showTagsColumn);
SetVisiblity(Column::Platform, Config::Get(Config::MAIN_GAMELIST_COLUMN_PLATFORM));
SetVisiblity(Column::Banner, Config::Get(Config::MAIN_GAMELIST_COLUMN_BANNER));
SetVisiblity(Column::Title, Config::Get(Config::MAIN_GAMELIST_COLUMN_TITLE));
SetVisiblity(Column::Description, Config::Get(Config::MAIN_GAMELIST_COLUMN_DESCRIPTION));
SetVisiblity(Column::Maker, Config::Get(Config::MAIN_GAMELIST_COLUMN_MAKER));
SetVisiblity(Column::ID, Config::Get(Config::MAIN_GAMELIST_COLUMN_GAME_ID));
SetVisiblity(Column::Country, Config::Get(Config::MAIN_GAMELIST_COLUMN_REGION));
SetVisiblity(Column::Size, Config::Get(Config::MAIN_GAMELIST_COLUMN_FILE_SIZE));
SetVisiblity(Column::FileName, Config::Get(Config::MAIN_GAMELIST_COLUMN_FILE_NAME));
SetVisiblity(Column::FilePath, Config::Get(Config::MAIN_GAMELIST_COLUMN_FILE_PATH));
SetVisiblity(Column::FileFormat, Config::Get(Config::MAIN_GAMELIST_COLUMN_FILE_FORMAT));
SetVisiblity(Column::BlockSize, Config::Get(Config::MAIN_GAMELIST_COLUMN_BLOCK_SIZE));
SetVisiblity(Column::Compression, Config::Get(Config::MAIN_GAMELIST_COLUMN_COMPRESSION));
SetVisiblity(Column::Tags, Config::Get(Config::MAIN_GAMELIST_COLUMN_TAGS));
}
void GameList::MakeEmptyView()

View File

@ -8,7 +8,7 @@
#include <QPixmap>
#include <QRegularExpression>
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "DiscIO/Enums.h"
@ -267,13 +267,13 @@ bool GameListModel::ShouldDisplayGameListItem(int index) const
switch (game.GetPlatform())
{
case DiscIO::Platform::GameCubeDisc:
return SConfig::GetInstance().m_ListGC;
return Config::Get(Config::MAIN_GAMELIST_LIST_GC);
case DiscIO::Platform::WiiDisc:
return SConfig::GetInstance().m_ListWii;
return Config::Get(Config::MAIN_GAMELIST_LIST_WII);
case DiscIO::Platform::WiiWAD:
return SConfig::GetInstance().m_ListWad;
return Config::Get(Config::MAIN_GAMELIST_LIST_WAD);
case DiscIO::Platform::ELFOrDOL:
return SConfig::GetInstance().m_ListElfDol;
return Config::Get(Config::MAIN_GAMELIST_LIST_ELF_DOL);
default:
return false;
}
@ -285,34 +285,34 @@ bool GameListModel::ShouldDisplayGameListItem(int index) const
switch (game.GetCountry())
{
case DiscIO::Country::Australia:
return SConfig::GetInstance().m_ListAustralia;
return Config::Get(Config::MAIN_GAMELIST_LIST_AUSTRALIA);
case DiscIO::Country::Europe:
return SConfig::GetInstance().m_ListPal;
return Config::Get(Config::MAIN_GAMELIST_LIST_PAL);
case DiscIO::Country::France:
return SConfig::GetInstance().m_ListFrance;
return Config::Get(Config::MAIN_GAMELIST_LIST_FRANCE);
case DiscIO::Country::Germany:
return SConfig::GetInstance().m_ListGermany;
return Config::Get(Config::MAIN_GAMELIST_LIST_GERMANY);
case DiscIO::Country::Italy:
return SConfig::GetInstance().m_ListItaly;
return Config::Get(Config::MAIN_GAMELIST_LIST_ITALY);
case DiscIO::Country::Japan:
return SConfig::GetInstance().m_ListJap;
return Config::Get(Config::MAIN_GAMELIST_LIST_JPN);
case DiscIO::Country::Korea:
return SConfig::GetInstance().m_ListKorea;
return Config::Get(Config::MAIN_GAMELIST_LIST_KOREA);
case DiscIO::Country::Netherlands:
return SConfig::GetInstance().m_ListNetherlands;
return Config::Get(Config::MAIN_GAMELIST_LIST_NETHERLANDS);
case DiscIO::Country::Russia:
return SConfig::GetInstance().m_ListRussia;
return Config::Get(Config::MAIN_GAMELIST_LIST_RUSSIA);
case DiscIO::Country::Spain:
return SConfig::GetInstance().m_ListSpain;
return Config::Get(Config::MAIN_GAMELIST_LIST_SPAIN);
case DiscIO::Country::Taiwan:
return SConfig::GetInstance().m_ListTaiwan;
return Config::Get(Config::MAIN_GAMELIST_LIST_TAIWAN);
case DiscIO::Country::USA:
return SConfig::GetInstance().m_ListUsa;
return Config::Get(Config::MAIN_GAMELIST_LIST_USA);
case DiscIO::Country::World:
return SConfig::GetInstance().m_ListWorld;
return Config::Get(Config::MAIN_GAMELIST_LIST_WORLD);
case DiscIO::Country::Unknown:
default:
return SConfig::GetInstance().m_ListUnknown;
return Config::Get(Config::MAIN_GAMELIST_LIST_UNKNOWN);
}
}

View File

@ -622,21 +622,21 @@ void MenuBar::AddGameListTypeSection(QMenu* view_menu)
void MenuBar::AddListColumnsMenu(QMenu* view_menu)
{
static const QMap<QString, bool*> columns{
{tr("Platform"), &SConfig::GetInstance().m_showSystemColumn},
{tr("Banner"), &SConfig::GetInstance().m_showBannerColumn},
{tr("Title"), &SConfig::GetInstance().m_showTitleColumn},
{tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn},
{tr("Maker"), &SConfig::GetInstance().m_showMakerColumn},
{tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn},
{tr("File Path"), &SConfig::GetInstance().m_showFilePathColumn},
{tr("Game ID"), &SConfig::GetInstance().m_showIDColumn},
{tr("Region"), &SConfig::GetInstance().m_showRegionColumn},
{tr("File Size"), &SConfig::GetInstance().m_showSizeColumn},
{tr("File Format"), &SConfig::GetInstance().m_showFileFormatColumn},
{tr("Block Size"), &SConfig::GetInstance().m_showBlockSizeColumn},
{tr("Compression"), &SConfig::GetInstance().m_showCompressionColumn},
{tr("Tags"), &SConfig::GetInstance().m_showTagsColumn}};
static const QMap<QString, const Config::Info<bool>*> columns{
{tr("Platform"), &Config::MAIN_GAMELIST_COLUMN_PLATFORM},
{tr("Banner"), &Config::MAIN_GAMELIST_COLUMN_BANNER},
{tr("Title"), &Config::MAIN_GAMELIST_COLUMN_TITLE},
{tr("Description"), &Config::MAIN_GAMELIST_COLUMN_DESCRIPTION},
{tr("Maker"), &Config::MAIN_GAMELIST_COLUMN_MAKER},
{tr("File Name"), &Config::MAIN_GAMELIST_COLUMN_FILE_NAME},
{tr("File Path"), &Config::MAIN_GAMELIST_COLUMN_FILE_PATH},
{tr("Game ID"), &Config::MAIN_GAMELIST_COLUMN_GAME_ID},
{tr("Region"), &Config::MAIN_GAMELIST_COLUMN_REGION},
{tr("File Size"), &Config::MAIN_GAMELIST_COLUMN_FILE_SIZE},
{tr("File Format"), &Config::MAIN_GAMELIST_COLUMN_FILE_FORMAT},
{tr("Block Size"), &Config::MAIN_GAMELIST_COLUMN_BLOCK_SIZE},
{tr("Compression"), &Config::MAIN_GAMELIST_COLUMN_COMPRESSION},
{tr("Tags"), &Config::MAIN_GAMELIST_COLUMN_TAGS}};
QActionGroup* column_group = new QActionGroup(this);
m_cols_menu = view_menu->addMenu(tr("List Columns"));
@ -644,12 +644,12 @@ void MenuBar::AddListColumnsMenu(QMenu* view_menu)
for (const auto& key : columns.keys())
{
bool* config = columns[key];
const Config::Info<bool>* const config = columns[key];
QAction* action = column_group->addAction(m_cols_menu->addAction(key));
action->setCheckable(true);
action->setChecked(*config);
action->setChecked(Config::Get(*config));
connect(action, &QAction::toggled, [this, config, key](bool value) {
*config = value;
Config::SetBase(*config, value);
emit ColumnVisibilityToggled(key, value);
});
}
@ -657,11 +657,11 @@ void MenuBar::AddListColumnsMenu(QMenu* view_menu)
void MenuBar::AddShowPlatformsMenu(QMenu* view_menu)
{
static const QMap<QString, bool*> platform_map{
{tr("Show Wii"), &SConfig::GetInstance().m_ListWii},
{tr("Show GameCube"), &SConfig::GetInstance().m_ListGC},
{tr("Show WAD"), &SConfig::GetInstance().m_ListWad},
{tr("Show ELF/DOL"), &SConfig::GetInstance().m_ListElfDol}};
static const QMap<QString, const Config::Info<bool>*> platform_map{
{tr("Show Wii"), &Config::MAIN_GAMELIST_LIST_WII},
{tr("Show GameCube"), &Config::MAIN_GAMELIST_LIST_GC},
{tr("Show WAD"), &Config::MAIN_GAMELIST_LIST_WAD},
{tr("Show ELF/DOL"), &Config::MAIN_GAMELIST_LIST_ELF_DOL}};
QActionGroup* platform_group = new QActionGroup(this);
QMenu* plat_menu = view_menu->addMenu(tr("Show Platforms"));
@ -669,12 +669,12 @@ void MenuBar::AddShowPlatformsMenu(QMenu* view_menu)
for (const auto& key : platform_map.keys())
{
bool* config = platform_map[key];
const Config::Info<bool>* const config = platform_map[key];
QAction* action = platform_group->addAction(plat_menu->addAction(key));
action->setCheckable(true);
action->setChecked(*config);
action->setChecked(Config::Get(*config));
connect(action, &QAction::toggled, [this, config, key](bool value) {
*config = value;
Config::SetBase(*config, value);
emit GameListPlatformVisibilityToggled(key, value);
});
}
@ -682,21 +682,21 @@ void MenuBar::AddShowPlatformsMenu(QMenu* view_menu)
void MenuBar::AddShowRegionsMenu(QMenu* view_menu)
{
static const QMap<QString, bool*> region_map{
{tr("Show JAP"), &SConfig::GetInstance().m_ListJap},
{tr("Show PAL"), &SConfig::GetInstance().m_ListPal},
{tr("Show USA"), &SConfig::GetInstance().m_ListUsa},
{tr("Show Australia"), &SConfig::GetInstance().m_ListAustralia},
{tr("Show France"), &SConfig::GetInstance().m_ListFrance},
{tr("Show Germany"), &SConfig::GetInstance().m_ListGermany},
{tr("Show Italy"), &SConfig::GetInstance().m_ListItaly},
{tr("Show Korea"), &SConfig::GetInstance().m_ListKorea},
{tr("Show Netherlands"), &SConfig::GetInstance().m_ListNetherlands},
{tr("Show Russia"), &SConfig::GetInstance().m_ListRussia},
{tr("Show Spain"), &SConfig::GetInstance().m_ListSpain},
{tr("Show Taiwan"), &SConfig::GetInstance().m_ListTaiwan},
{tr("Show World"), &SConfig::GetInstance().m_ListWorld},
{tr("Show Unknown"), &SConfig::GetInstance().m_ListUnknown}};
static const QMap<QString, const Config::Info<bool>*> region_map{
{tr("Show JPN"), &Config::MAIN_GAMELIST_LIST_JPN},
{tr("Show PAL"), &Config::MAIN_GAMELIST_LIST_PAL},
{tr("Show USA"), &Config::MAIN_GAMELIST_LIST_USA},
{tr("Show Australia"), &Config::MAIN_GAMELIST_LIST_AUSTRALIA},
{tr("Show France"), &Config::MAIN_GAMELIST_LIST_FRANCE},
{tr("Show Germany"), &Config::MAIN_GAMELIST_LIST_GERMANY},
{tr("Show Italy"), &Config::MAIN_GAMELIST_LIST_ITALY},
{tr("Show Korea"), &Config::MAIN_GAMELIST_LIST_KOREA},
{tr("Show Netherlands"), &Config::MAIN_GAMELIST_LIST_NETHERLANDS},
{tr("Show Russia"), &Config::MAIN_GAMELIST_LIST_RUSSIA},
{tr("Show Spain"), &Config::MAIN_GAMELIST_LIST_SPAIN},
{tr("Show Taiwan"), &Config::MAIN_GAMELIST_LIST_TAIWAN},
{tr("Show World"), &Config::MAIN_GAMELIST_LIST_WORLD},
{tr("Show Unknown"), &Config::MAIN_GAMELIST_LIST_UNKNOWN}};
QMenu* const region_menu = view_menu->addMenu(tr("Show Regions"));
const QAction* const show_all_regions = region_menu->addAction(tr("Show All"));
@ -705,14 +705,14 @@ void MenuBar::AddShowRegionsMenu(QMenu* view_menu)
for (const auto& key : region_map.keys())
{
bool* const config = region_map[key];
const Config::Info<bool>* const config = region_map[key];
QAction* const menu_item = region_menu->addAction(key);
menu_item->setCheckable(true);
menu_item->setChecked(*config);
menu_item->setChecked(Config::Get(*config));
const auto set_visibility = [this, config, key, menu_item](bool visibility) {
menu_item->setChecked(visibility);
*config = visibility;
Config::SetBase(*config, visibility);
emit GameListRegionVisibilityToggled(key, visibility);
};
const auto set_visible = std::bind(set_visibility, true);