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

Restored mod list display functionality in launcher

This commit is contained in:
Ivan Savenko
2024-11-13 17:25:59 +00:00
parent f8724b9558
commit 06ce71087e
14 changed files with 137 additions and 75 deletions

View File

@@ -11,20 +11,31 @@
#include "modstatemodel.h"
#include "../../lib/modding/ModManager.h"
#include "../../lib/json/JsonUtils.h"
ModStateModel::ModStateModel()
:modManager(std::make_unique<ModManager>())
{}
: repositoryData(std::make_unique<JsonNode>())
, modManager(std::make_unique<ModManager>())
{
}
ModStateModel::~ModStateModel() = default;
void ModStateModel::setRepositories(QVector<JsonNode> repositoriesList)
void ModStateModel::appendRepositories(const JsonNode & repositoriesList)
{
//TODO
JsonUtils::mergeCopy(*repositoryData, repositoriesList);
modManager = std::make_unique<ModManager>(*repositoryData);
}
const JsonNode & ModStateModel::getRepositoryData() const
{
return *repositoryData;
}
ModState ModStateModel::getMod(QString modName) const
{
assert(modName.toLower() == modName);
return ModState(modManager->getModDescription(modName.toStdString()));
}
@@ -39,7 +50,7 @@ QStringList stringListStdToQt(const Container & container)
QStringList ModStateModel::getAllMods() const
{
return stringListStdToQt(modManager->getActiveMods());
return stringListStdToQt(modManager->getAllMods());
}
QStringList ModStateModel::getSubmods(QString modName) const