1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
This commit is contained in:
nordsoft 2023-09-07 19:57:57 +02:00
parent 32ad463170
commit 40ea45498f
3 changed files with 10 additions and 10 deletions

View File

@ -22,7 +22,7 @@
"type" : "string",
"description" : "Author of the mod. Can be nickname, real name or name of team"
},
"size": {
"downloadSize": {
"type" : "number",
"description" : "Approximate size of mod, compressed by zip algorithm, in Mb"
},

View File

@ -327,7 +327,7 @@ CModEntry CModList::getMod(QString modname) const
//take valid download link, screenshots and mod size before assignment
auto download = repo.value("download");
auto screenshots = repo.value("screenshots");
auto size = repo.value("size");
auto size = repo.value("downloadSize");
repo = repoValMap;
if(repo.value("download").isNull())
{
@ -335,8 +335,8 @@ CModEntry CModList::getMod(QString modname) const
if(repo.value("screenshots").isNull()) //taking screenshot from the downloadable version
repo["screenshots"] = screenshots;
}
if(repo.value("size").isNull())
repo["size"] = size;
if(repo.value("downloadSize").isNull())
repo["downloadSize"] = size;
}
}
}

View File

@ -249,9 +249,9 @@ QString CModListView::genModInfoText(CModEntry & mod)
result += replaceIfNotEmpty(mod.getValue("latestVersion"), lineTemplate.arg(tr("Latest version")));
if(mod.getValue("localSizeBytes").isValid())
result += replaceIfNotEmpty(CModEntry::sizeToString(mod.getValue("localSizeBytes").toDouble()), lineTemplate.arg(tr("Size")));
if((mod.isAvailable() || mod.isUpdateable()) && mod.getValue("size").isValid())
result += replaceIfNotEmpty(CModEntry::sizeToString(mbToBytes(mod.getValue("size").toDouble())), lineTemplate.arg(tr("Download size")));
result += replaceIfNotEmpty(CModEntry::sizeToString(mod.getValue("localSizeBytes").toDouble()), lineTemplate.arg(tr("downloadSize")));
if((mod.isAvailable() || mod.isUpdateable()) && mod.getValue("downloadSize").isValid())
result += replaceIfNotEmpty(CModEntry::sizeToString(mbToBytes(mod.getValue("downloadSize").toDouble())), lineTemplate.arg(tr("Download size")));
result += replaceIfNotEmpty(mod.getValue("author"), lineTemplate.arg(tr("Authors")));
@ -543,7 +543,7 @@ void CModListView::on_updateButton_clicked()
auto mod = modModel->getMod(name);
// update required mod, install missing (can be new dependency)
if(mod.isUpdateable() || !mod.isInstalled())
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("size").toDouble()));
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
}
}
@ -573,7 +573,7 @@ void CModListView::on_installButton_clicked()
{
auto mod = modModel->getMod(name);
if(!mod.isInstalled())
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("size").toDouble()));
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
}
}
@ -863,7 +863,7 @@ void CModListView::doInstallMod(const QString & modName)
{
auto mod = modModel->getMod(name);
if(!mod.isInstalled())
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("size").toDouble()));
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
}
}