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

Method setupModList

tools/launcher/launcherwindow.cpp:416–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void LauncherWindow::setupModList()
417{
418 auto foundMods = enumerateMods();
419 auto enabledMods = split(Options::modList.get(), ":");
420
421 ui->enabledModsList->clear();
422 ui->disabledModsList->clear();
423
424 // First set enabled mods in order
425
426 for (const auto &enabledModName : enabledMods)
427 {
428 for (const auto &[modDir, modInfo] : foundMods)
429 {
430 if (modDir == enabledModName)
431 {
432 const auto &modName = modInfo.getName();
433 ui->enabledModsList->addItem(QString::fromStdString(modName));
434 }
435 }
436 }
437
438 // Then fill the disabled modlist with anything else
439
440 for (const auto &[modDir, modInfo] : foundMods)
441 {
442 bool enabled = false;
443 // Is this enabled?
444 for (const auto &enabledModName : enabledMods)
445 {
446 if (modDir == enabledModName)
447 {
448 enabled = true;
449 break;
450 }
451 }
452 const auto &modName = modInfo.getName();
453 if (!enabled)
454 ui->disabledModsList->addItem(QString::fromStdString(modName));
455 }
456
457 updateAvailableLanguages();
458}
459
460void LauncherWindow::enabledModSelected(const QString &itemName)
461{

Callers

nothing calls this directly

Calls 6

enumerateModsFunction · 0.85
splitFunction · 0.85
getMethod · 0.45
clearMethod · 0.45
getNameMethod · 0.45
addItemMethod · 0.45

Tested by

no test coverage detected