mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Merge pull request #5108 from IvanSavenko/preset_import
[1.6.1?] Mod preset import/export
This commit is contained in:
@@ -857,6 +857,12 @@ void CModListView::installMods(QStringList archives)
|
||||
modNames.push_back(modName);
|
||||
}
|
||||
|
||||
if (!activatingPreset.isEmpty())
|
||||
{
|
||||
modStateModel->activatePreset(activatingPreset);
|
||||
activatingPreset.clear();
|
||||
}
|
||||
|
||||
// uninstall old version of mod, if installed
|
||||
for(QString mod : modNames)
|
||||
{
|
||||
@@ -1147,3 +1153,25 @@ QString CModListView::getActivePreset() const
|
||||
{
|
||||
return modStateModel->getActivePreset();
|
||||
}
|
||||
|
||||
JsonNode CModListView::exportCurrentPreset() const
|
||||
{
|
||||
return modStateModel->exportCurrentPreset();
|
||||
}
|
||||
|
||||
void CModListView::importPreset(const JsonNode & data)
|
||||
{
|
||||
const auto & [presetName, modList] = modStateModel->importPreset(data);
|
||||
|
||||
if (modList.empty())
|
||||
{
|
||||
modStateModel->activatePreset(presetName);
|
||||
modStateModel->reloadLocalState();
|
||||
}
|
||||
else
|
||||
{
|
||||
activatingPreset = presetName;
|
||||
for (const auto & modID : modList)
|
||||
doInstallMod(modID);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user