MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / updateAvailableLanguages

Method updateAvailableLanguages

tools/launcher/launcherwindow.cpp:600–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600void LauncherWindow::updateAvailableLanguages()
601{
602 if (selectedLanguageID.empty())
603 {
604 selectedLanguageID = Options::languageOption.get();
605 if (selectedLanguageID.empty())
606 {
607 // Just default to american english if not set
608 selectedLanguageID = "en.UTF-8";
609 }
610 }
611
612 ui->languageBox->clear();
613
614 // FIXME: Currently just returns all supported languages of the first mod
615
616 auto foundMods = enumerateMods();
617 auto enabledMods = split(Options::modList.get(), ":");
618
619 for (const auto &enabledModName : enabledMods)
620 {
621 for (const auto &[modDir, modInfo] : foundMods)
622 {
623 if (modDir == enabledModName)
624 {
625 for (const auto &languageID : modInfo.getSupportedLanguages())
626 {
627 ui->languageBox->addItem(getLanguageName(languageID),
628 QString::fromStdString(languageID));
629 if (selectedLanguageID == languageID)
630 {
631 ui->languageBox->setCurrentIndex(ui->languageBox->count() - 1);
632 }
633 }
634 }
635 }
636 }
637}

Callers

nothing calls this directly

Calls 9

enumerateModsFunction · 0.85
splitFunction · 0.85
getLanguageNameFunction · 0.85
emptyMethod · 0.80
getSupportedLanguagesMethod · 0.80
getMethod · 0.45
clearMethod · 0.45
addItemMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected