1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Merge pull request #1511 from IvanSavenko/launcher_welcome_page

Add welcome/setup page to Laucher
This commit is contained in:
Ivan Savenko
2023-03-16 15:04:49 +02:00
committed by GitHub
36 changed files with 4124 additions and 1601 deletions

View File

@@ -49,7 +49,7 @@ void CGeneralTextHandler::detectInstallParameters()
// load file that will be used for footprint generation
// this is one of the most text-heavy files in game and consists solely from translated texts
auto resource = CResourceHandler::get()->load(ResourceID("DATA/GENRLTXT.TXT", EResType::TEXT));
auto resource = CResourceHandler::get("core")->load(ResourceID("DATA/GENRLTXT.TXT", EResType::TEXT));
std::array<size_t, 256> charCount{};
std::array<double, 16> footprint{};
@@ -87,6 +87,9 @@ void CGeneralTextHandler::detectInstallParameters()
Settings language = settings.write["session"]["language"];
language->String() = knownLanguages[bestIndex];
Settings confidence = settings.write["session"]["languageDeviation"];
confidence->Float() = deviations[bestIndex];
Settings encoding = settings.write["session"]["encoding"];
encoding->String() = Languages::getLanguageOptions(knownLanguages[bestIndex]).encoding;
}
@@ -387,8 +390,6 @@ CGeneralTextHandler::CGeneralTextHandler():
znpc00 (*this, "vcmi.znpc00" ), // technically - wog
qeModCommands (*this, "vcmi.quickExchange" )
{
detectInstallParameters();
readToVector("core.vcdesc", "DATA/VCDESC.TXT" );
readToVector("core.lcdesc", "DATA/LCDESC.TXT" );
readToVector("core.tcommand", "DATA/TCOMMAND.TXT" );
@@ -605,16 +606,19 @@ std::string CGeneralTextHandler::getModLanguage(const std::string & modContext)
std::string CGeneralTextHandler::getPreferredLanguage()
{
assert(!settings["general"]["language"].String().empty());
return settings["general"]["language"].String();
}
std::string CGeneralTextHandler::getInstalledLanguage()
{
assert(!settings["session"]["language"].String().empty());
return settings["session"]["language"].String();
}
std::string CGeneralTextHandler::getInstalledEncoding()
{
assert(!settings["session"]["encoding"].String().empty());
return settings["session"]["encoding"].String();
}