shared_translation: Populate combobox enums with macro

This commit is contained in:
lat9nq 2023-06-09 19:52:59 -04:00
parent b86171d2b5
commit 47d870b11f

View File

@ -175,207 +175,197 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
std::make_unique<ComboboxTranslationMap>(); std::make_unique<ComboboxTranslationMap>();
const auto& tr = [&](const char* text) { return parent->tr(text); }; const auto& tr = [&](const char* text) { return parent->tr(text); };
#define PAIR(ENUM, VALUE, TRANSLATION) \
{ static_cast<u32>(Settings::ENUM::VALUE), tr(TRANSLATION) }
#define CTX_PAIR(ENUM, VALUE, TRANSLATION, CONTEXT) \
{ static_cast<u32>(Settings::ENUM::VALUE), tr(TRANSLATION, CONTEXT) }
// Intentionally skipping VSyncMode to let the UI fill that one out // Intentionally skipping VSyncMode to let the UI fill that one out
translations->insert( translations->insert({typeid(Settings::AstcDecodeMode),
{typeid(Settings::AstcDecodeMode), {
{ PAIR(AstcDecodeMode, Cpu, "CPU"),
{static_cast<u32>(Settings::AstcDecodeMode::Cpu), tr("CPU")}, PAIR(AstcDecodeMode, Gpu, "GPU"),
{static_cast<u32>(Settings::AstcDecodeMode::Gpu), tr("GPU")}, PAIR(AstcDecodeMode, CpuAsynchronous, "CPU Asynchronous"),
{static_cast<u32>(Settings::AstcDecodeMode::CpuAsynchronous), tr("CPU Asynchronous")}, }});
}}); translations->insert({typeid(Settings::AstcRecompression),
translations->insert( {
{typeid(Settings::AstcRecompression), PAIR(AstcRecompression, Uncompressed, "Uncompressed (Best quality)"),
{ PAIR(AstcRecompression, Bc1, "BC1 (Low quality)"),
{static_cast<u32>(Settings::AstcRecompression::Uncompressed), PAIR(AstcRecompression, Bc3, "BC3 (Medium quality)"),
tr("Uncompressed (Best quality)")}, }});
{static_cast<u32>(Settings::AstcRecompression::Bc1), tr("BC1 (Low quality)")},
{static_cast<u32>(Settings::AstcRecompression::Bc3), tr("BC3 (Medium quality)")},
}});
translations->insert({typeid(Settings::RendererBackend), translations->insert({typeid(Settings::RendererBackend),
{ {
#ifdef HAS_OPENGL #ifdef HAS_OPENGL
{static_cast<u32>(Settings::RendererBackend::OpenGL), tr("OpenGL")}, PAIR(RendererBackend, OpenGL, "OpenGL"),
#endif #endif
{static_cast<u32>(Settings::RendererBackend::Vulkan), tr("Vulkan")}, PAIR(RendererBackend, Vulkan, "Vulkan"),
{static_cast<u32>(Settings::RendererBackend::Null), tr("Null")}, PAIR(RendererBackend, Null, "Null"),
}}); }});
translations->insert({typeid(Settings::ShaderBackend), translations->insert({typeid(Settings::ShaderBackend),
{ {
{static_cast<u32>(Settings::ShaderBackend::Glsl), tr("GLSL")}, PAIR(ShaderBackend, Glsl, "GLSL"),
{static_cast<u32>(Settings::ShaderBackend::Glasm), PAIR(ShaderBackend, Glasm, "GLASM (Assembly Shaders, NVIDIA Only)"),
tr("GLASM (Assembly Shaders, NVIDIA Only)")}, PAIR(ShaderBackend, SpirV, "SPIR-V (Experimental, Mesa Only)"),
{static_cast<u32>(Settings::ShaderBackend::SpirV),
tr("SPIR-V (Experimental, Mesa Only)")},
}}); }});
translations->insert({typeid(Settings::GpuAccuracy), translations->insert({typeid(Settings::GpuAccuracy),
{ {
{static_cast<u32>(Settings::GpuAccuracy::Normal), tr("Normal")}, PAIR(GpuAccuracy, Normal, "Normal"),
{static_cast<u32>(Settings::GpuAccuracy::High), tr("High")}, PAIR(GpuAccuracy, High, "High"),
{static_cast<u32>(Settings::GpuAccuracy::Extreme), tr("Extreme")}, PAIR(GpuAccuracy, Extreme, "Extreme"),
}}); }});
translations->insert({typeid(Settings::CpuAccuracy), translations->insert({typeid(Settings::CpuAccuracy),
{ {
{static_cast<u32>(Settings::CpuAccuracy::Auto), tr("Auto")}, PAIR(CpuAccuracy, Auto, "Auto"),
{static_cast<u32>(Settings::CpuAccuracy::Accurate), tr("Accurate")}, PAIR(CpuAccuracy, Accurate, "Accurate"),
{static_cast<u32>(Settings::CpuAccuracy::Unsafe), tr("Unsafe")}, PAIR(CpuAccuracy, Unsafe, "Unsafe"),
{static_cast<u32>(Settings::CpuAccuracy::Paranoid), PAIR(CpuAccuracy, Paranoid, "Paranoid (disables most optimizations)"),
tr("Paranoid (disables most optimizations)")}, }});
translations->insert({typeid(Settings::FullscreenMode),
{
PAIR(FullscreenMode, Borderless, "Borderless Windowed"),
PAIR(FullscreenMode, Exclusive, "Exclusive Fullscreen"),
}});
translations->insert({typeid(Settings::NvdecEmulation),
{
PAIR(NvdecEmulation, Off, "No Video Output"),
PAIR(NvdecEmulation, Cpu, "CPU Video Decoding"),
PAIR(NvdecEmulation, Gpu, "GPU Video Decoding (Default)"),
}});
translations->insert({typeid(Settings::ResolutionSetup),
{
PAIR(ResolutionSetup, Res1_2X, "0.5X (360p/540p) [EXPERIMENTAL]"),
PAIR(ResolutionSetup, Res3_4X, "0.75X (540p/810p) [EXPERIMENTAL]"),
PAIR(ResolutionSetup, Res1X, "1X (720p/1080p)"),
PAIR(ResolutionSetup, Res3_2X, "1.5X (1080p/1620p) [EXPERIMENTAL]"),
PAIR(ResolutionSetup, Res2X, "2X (1440p/2160p)"),
PAIR(ResolutionSetup, Res3X, "3X (2160p/3240p)"),
PAIR(ResolutionSetup, Res4X, "4X (2880p/4320p)"),
PAIR(ResolutionSetup, Res5X, "5X (3600p/5400p)"),
PAIR(ResolutionSetup, Res6X, "6X (4320p/6480p)"),
PAIR(ResolutionSetup, Res7X, "7X (5040p/7560p)"),
PAIR(ResolutionSetup, Res8X, "8X (5760p/8640p)"),
}});
translations->insert({typeid(Settings::ScalingFilter),
{
PAIR(ScalingFilter, NearestNeighbor, "Nearest Neighbor"),
PAIR(ScalingFilter, Bilinear, "Bilinear"),
PAIR(ScalingFilter, Bicubic, "Bicubic"),
PAIR(ScalingFilter, Gaussian, "Gaussian"),
PAIR(ScalingFilter, ScaleForce, "ScaleForce"),
PAIR(ScalingFilter, Fsr, "AMD FidelityFX™ Super Resolution"),
}}); }});
translations->insert(
{typeid(Settings::FullscreenMode),
{
{static_cast<u32>(Settings::FullscreenMode::Borderless), tr("Borderless Windowed")},
{static_cast<u32>(Settings::FullscreenMode::Exclusive), tr("Exclusive Fullscreen")},
}});
translations->insert(
{typeid(Settings::NvdecEmulation),
{
{static_cast<u32>(Settings::NvdecEmulation::Off), tr("No Video Output")},
{static_cast<u32>(Settings::NvdecEmulation::Cpu), tr("CPU Video Decoding")},
{static_cast<u32>(Settings::NvdecEmulation::Gpu), tr("GPU Video Decoding (Default)")},
}});
translations->insert(
{typeid(Settings::ResolutionSetup),
{
{static_cast<u32>(Settings::ResolutionSetup::Res1_2X),
tr("0.5X (360p/540p) [EXPERIMENTAL]")},
{static_cast<u32>(Settings::ResolutionSetup::Res3_4X),
tr("0.75X (540p/810p) [EXPERIMENTAL]")},
{static_cast<u32>(Settings::ResolutionSetup::Res1X), tr("1X (720p/1080p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res3_2X),
tr("1.5X (1080p/1620p) [EXPERIMENTAL]")},
{static_cast<u32>(Settings::ResolutionSetup::Res2X), tr("2X (1440p/2160p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res3X), tr("3X (2160p/3240p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res4X), tr("4X (2880p/4320p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res5X), tr("5X (3600p/5400p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res6X), tr("6X (4320p/6480p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res7X), tr("7X (5040p/7560p)")},
{static_cast<u32>(Settings::ResolutionSetup::Res8X), tr("8X (5760p/8640p)")},
}});
translations->insert(
{typeid(Settings::ScalingFilter),
{
{static_cast<u32>(Settings::ScalingFilter::NearestNeighbor), tr("Nearest Neighbor")},
{static_cast<u32>(Settings::ScalingFilter::Bilinear), tr("Bilinear")},
{static_cast<u32>(Settings::ScalingFilter::Bicubic), tr("Bicubic")},
{static_cast<u32>(Settings::ScalingFilter::Gaussian), tr("Gaussian")},
{static_cast<u32>(Settings::ScalingFilter::ScaleForce), tr("ScaleForce")},
{static_cast<u32>(Settings::ScalingFilter::Fsr),
tr("AMD FidelityFX™ Super Resolution")},
}});
translations->insert({typeid(Settings::AntiAliasing), translations->insert({typeid(Settings::AntiAliasing),
{ {
{static_cast<u32>(Settings::AntiAliasing::None), tr("None")}, PAIR(AntiAliasing, None, "None"),
{static_cast<u32>(Settings::AntiAliasing::Fxaa), tr("FXAA")}, PAIR(AntiAliasing, Fxaa, "FXAA"),
{static_cast<u32>(Settings::AntiAliasing::Smaa), tr("SMAA")}, PAIR(AntiAliasing, Smaa, "SMAA"),
}});
translations->insert({typeid(Settings::AspectRatio),
{
PAIR(AspectRatio, R16_9, "Default (16:9)"),
PAIR(AspectRatio, R4_3, "Force 4:3"),
PAIR(AspectRatio, R21_9, "Force 21:9"),
PAIR(AspectRatio, R16_10, "Force 16:10"),
PAIR(AspectRatio, Stretch, "Stretch to Window"),
}});
translations->insert({typeid(Settings::AnisotropyMode),
{
PAIR(AnisotropyMode, Automatic, "Automatic"),
PAIR(AnisotropyMode, Default, "Default"),
PAIR(AnisotropyMode, X2, "2x"),
PAIR(AnisotropyMode, X4, "4x"),
PAIR(AnisotropyMode, X8, "8x"),
PAIR(AnisotropyMode, X16, "16x"),
}}); }});
translations->insert(
{typeid(Settings::AspectRatio),
{
{static_cast<u32>(Settings::AspectRatio::R16_9), tr("Default (16:9)")},
{static_cast<u32>(Settings::AspectRatio::R4_3), tr("Force 4:3")},
{static_cast<u32>(Settings::AspectRatio::R21_9), tr("Force 21:9")},
{static_cast<u32>(Settings::AspectRatio::R16_10), tr("Force 16:10")},
{static_cast<u32>(Settings::AspectRatio::Stretch), tr("Stretch to Window")},
}});
translations->insert(
{typeid(Settings::AnisotropyMode),
{
{static_cast<u32>(Settings::AnisotropyMode::Automatic), tr("Automatic")},
{static_cast<u32>(Settings::AnisotropyMode::Default), tr("Default")},
{static_cast<u32>(Settings::AnisotropyMode::X2), tr("2x")},
{static_cast<u32>(Settings::AnisotropyMode::X4), tr("4x")},
{static_cast<u32>(Settings::AnisotropyMode::X8), tr("8x")},
{static_cast<u32>(Settings::AnisotropyMode::X16), tr("16x")},
}});
translations->insert( translations->insert(
{typeid(Settings::Language), {typeid(Settings::Language),
{ {
{static_cast<u32>(Settings::Language::Japanese), tr("Japanese (日本語)")}, PAIR(Language, Japanese, "Japanese (日本語)"),
{static_cast<u32>(Settings::Language::EnglishAmerican), tr("American English")}, PAIR(Language, EnglishAmerican, "American English"),
{static_cast<u32>(Settings::Language::French), tr("French (français)")}, PAIR(Language, French, "French (français)"),
{static_cast<u32>(Settings::Language::German), tr("German (Deutsch)")}, PAIR(Language, German, "German (Deutsch)"),
{static_cast<u32>(Settings::Language::Italian), tr("Italian (italiano)")}, PAIR(Language, Italian, "Italian (italiano)"),
{static_cast<u32>(Settings::Language::Spanish), tr("Spanish (español)")}, PAIR(Language, Spanish, "Spanish (español)"),
{static_cast<u32>(Settings::Language::Chinese), tr("Chinese")}, PAIR(Language, Chinese, "Chinese"),
{static_cast<u32>(Settings::Language::Korean), tr("Korean (한국어)")}, PAIR(Language, Korean, "Korean (한국어)"),
{static_cast<u32>(Settings::Language::Dutch), tr("Dutch (Nederlands)")}, PAIR(Language, Dutch, "Dutch (Nederlands)"),
{static_cast<u32>(Settings::Language::Portuguese), tr("Portuguese (português)")}, PAIR(Language, Portuguese, "Portuguese (português)"),
{static_cast<u32>(Settings::Language::Russian), tr("Russian (Русский)")}, PAIR(Language, Russian, "Russian (Русский)"),
{static_cast<u32>(Settings::Language::Taiwanese), tr("Taiwanese")}, PAIR(Language, Taiwanese, "Taiwanese"),
{static_cast<u32>(Settings::Language::EnglishBritish), tr("British English")}, PAIR(Language, EnglishBritish, "British English"),
{static_cast<u32>(Settings::Language::FrenchCanadian), tr("Canadian French")}, PAIR(Language, FrenchCanadian, "Canadian French"),
{static_cast<u32>(Settings::Language::SpanishLatin), tr("Latin American Spanish")}, PAIR(Language, SpanishLatin, "Latin American Spanish"),
{static_cast<u32>(Settings::Language::ChineseSimplified), tr("Simplified Chinese")}, PAIR(Language, ChineseSimplified, "Simplified Chinese"),
{static_cast<u32>(Settings::Language::ChineseTraditional), PAIR(Language, ChineseTraditional, "Traditional Chinese (正體中文)"),
tr("Traditional Chinese (正體中文)")}, PAIR(Language, PortugueseBrazilian, "Brazilian Portuguese (português do Brasil)"),
{static_cast<u32>(Settings::Language::PortugueseBrazilian),
tr("Brazilian Portuguese (português do Brasil)")},
}}); }});
translations->insert({typeid(Settings::Region), translations->insert({typeid(Settings::Region),
{ {
{static_cast<u32>(Settings::Region::Japan), tr("Japan")}, PAIR(Region, Japan, "Japan"),
{static_cast<u32>(Settings::Region::Usa), tr("USA")}, PAIR(Region, Usa, "USA"),
{static_cast<u32>(Settings::Region::Europe), tr("Europe")}, PAIR(Region, Europe, "Europe"),
{static_cast<u32>(Settings::Region::Australia), tr("Australia")}, PAIR(Region, Australia, "Australia"),
{static_cast<u32>(Settings::Region::China), tr("China")}, PAIR(Region, China, "China"),
{static_cast<u32>(Settings::Region::Korea), tr("Korea")}, PAIR(Region, Korea, "Korea"),
{static_cast<u32>(Settings::Region::Taiwan), tr("Taiwan")}, PAIR(Region, Taiwan, "Taiwan"),
}}); }});
translations->insert({typeid(Settings::TimeZone), translations->insert({typeid(Settings::TimeZone),
{ {
{static_cast<u32>(Settings::TimeZone::Auto), tr("Auto")}, PAIR(TimeZone, Auto, "Auto"),
{static_cast<u32>(Settings::TimeZone::Default), tr("Default")}, PAIR(TimeZone, Default, "Default"),
{static_cast<u32>(Settings::TimeZone::CET), tr("CET")}, PAIR(TimeZone, CET, "CET"),
{static_cast<u32>(Settings::TimeZone::CST6CDT), tr("CST6CDT")}, PAIR(TimeZone, CST6CDT, "CST6CDT"),
{static_cast<u32>(Settings::TimeZone::Cuba), tr("Cuba")}, PAIR(TimeZone, Cuba, "Cuba"),
{static_cast<u32>(Settings::TimeZone::EET), tr("EET")}, PAIR(TimeZone, EET, "EET"),
{static_cast<u32>(Settings::TimeZone::Egypt), tr("Egypt")}, PAIR(TimeZone, Egypt, "Egypt"),
{static_cast<u32>(Settings::TimeZone::Eire), tr("Eire")}, PAIR(TimeZone, Eire, "Eire"),
{static_cast<u32>(Settings::TimeZone::EST), tr("EST")}, PAIR(TimeZone, EST, "EST"),
{static_cast<u32>(Settings::TimeZone::EST5EDT), tr("EST5EDT")}, PAIR(TimeZone, EST5EDT, "EST5EDT"),
{static_cast<u32>(Settings::TimeZone::GB), tr("GB")}, PAIR(TimeZone, GB, "GB"),
{static_cast<u32>(Settings::TimeZone::GBEire), tr("GB-Eire")}, PAIR(TimeZone, GBEire, "GB-Eire"),
{static_cast<u32>(Settings::TimeZone::GMT), tr("GMT")}, PAIR(TimeZone, GMT, "GMT"),
{static_cast<u32>(Settings::TimeZone::GMTPlusZero), tr("GMT+0")}, PAIR(TimeZone, GMTPlusZero, "GMT+0"),
{static_cast<u32>(Settings::TimeZone::GMTMinusZero), tr("GMT-0")}, PAIR(TimeZone, GMTMinusZero, "GMT-0"),
{static_cast<u32>(Settings::TimeZone::GMTZero), tr("GMT0")}, PAIR(TimeZone, GMTZero, "GMT0"),
{static_cast<u32>(Settings::TimeZone::Greenwich), tr("Greenwich")}, PAIR(TimeZone, Greenwich, "Greenwich"),
{static_cast<u32>(Settings::TimeZone::Hongkong), tr("Hongkong")}, PAIR(TimeZone, Hongkong, "Hongkong"),
{static_cast<u32>(Settings::TimeZone::HST), tr("HST")}, PAIR(TimeZone, HST, "HST"),
{static_cast<u32>(Settings::TimeZone::Iceland), tr("Iceland")}, PAIR(TimeZone, Iceland, "Iceland"),
{static_cast<u32>(Settings::TimeZone::Iran), tr("Iran")}, PAIR(TimeZone, Iran, "Iran"),
{static_cast<u32>(Settings::TimeZone::Israel), tr("Israel")}, PAIR(TimeZone, Israel, "Israel"),
{static_cast<u32>(Settings::TimeZone::Jamaica), tr("Jamaica")}, PAIR(TimeZone, Jamaica, "Jamaica"),
{static_cast<u32>(Settings::TimeZone::Kwajalein), tr("Kwajalein")}, PAIR(TimeZone, Kwajalein, "Kwajalein"),
{static_cast<u32>(Settings::TimeZone::Libya), tr("Libya")}, PAIR(TimeZone, Libya, "Libya"),
{static_cast<u32>(Settings::TimeZone::MET), tr("MET")}, PAIR(TimeZone, MET, "MET"),
{static_cast<u32>(Settings::TimeZone::MST), tr("MST")}, PAIR(TimeZone, MST, "MST"),
{static_cast<u32>(Settings::TimeZone::MST7MDT), tr("MST7MDT")}, PAIR(TimeZone, MST7MDT, "MST7MDT"),
{static_cast<u32>(Settings::TimeZone::Navajo), tr("Navajo")}, PAIR(TimeZone, Navajo, "Navajo"),
{static_cast<u32>(Settings::TimeZone::NZ), tr("NZ")}, PAIR(TimeZone, NZ, "NZ"),
{static_cast<u32>(Settings::TimeZone::NZCHAT), tr("NZ-CHAT")}, PAIR(TimeZone, NZCHAT, "NZ-CHAT"),
{static_cast<u32>(Settings::TimeZone::Poland), tr("Poland")}, PAIR(TimeZone, Poland, "Poland"),
{static_cast<u32>(Settings::TimeZone::Portugal), tr("Portugal")}, PAIR(TimeZone, Portugal, "Portugal"),
{static_cast<u32>(Settings::TimeZone::PRC), tr("PRC")}, PAIR(TimeZone, PRC, "PRC"),
{static_cast<u32>(Settings::TimeZone::PST8PDT), tr("PST8PDT")}, PAIR(TimeZone, PST8PDT, "PST8PDT"),
{static_cast<u32>(Settings::TimeZone::ROC), tr("ROC")}, PAIR(TimeZone, ROC, "ROC"),
{static_cast<u32>(Settings::TimeZone::ROK), tr("ROK")}, PAIR(TimeZone, ROK, "ROK"),
{static_cast<u32>(Settings::TimeZone::Singapore), tr("Singapore")}, PAIR(TimeZone, Singapore, "Singapore"),
{static_cast<u32>(Settings::TimeZone::Turkey), tr("Turkey")}, PAIR(TimeZone, Turkey, "Turkey"),
{static_cast<u32>(Settings::TimeZone::UCT), tr("UCT")}, PAIR(TimeZone, UCT, "UCT"),
{static_cast<u32>(Settings::TimeZone::W_SU), tr("W-SU")}, PAIR(TimeZone, W_SU, "W-SU"),
{static_cast<u32>(Settings::TimeZone::WET), tr("WET")}, PAIR(TimeZone, WET, "WET"),
{static_cast<u32>(Settings::TimeZone::Zulu), tr("Zulu")}, PAIR(TimeZone, Zulu, "Zulu"),
}}); }});
translations->insert({typeid(Settings::AudioMode), translations->insert({typeid(Settings::AudioMode),
{ {
{static_cast<u32>(Settings::AudioMode::Mono), tr("Mono")}, PAIR(AudioMode, Mono, "Mono"),
{static_cast<u32>(Settings::AudioMode::Stereo), tr("Stereo")}, PAIR(AudioMode, Stereo, "Stereo"),
{static_cast<u32>(Settings::AudioMode::Surround), tr("Surround")}, PAIR(AudioMode, Surround, "Surround"),
}}); }});
#undef PAIR
#undef CTX_PAIR
return translations; return translations;
} }
} // namespace ConfigurationShared } // namespace ConfigurationShared