1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Partial fix for displaying download progress of mods

This commit is contained in:
Ivan Savenko
2023-06-27 22:34:34 +03:00
parent fc696fa0b3
commit 814a4b9455
3 changed files with 5 additions and 6 deletions

View File

@ -135,7 +135,7 @@ void CDownloadManager::downloadProgressChanged(qint64 bytesReceived, qint64 byte
quint64 total = 0; quint64 total = 0;
for(auto & entry : currentDownloads) for(auto & entry : currentDownloads)
total += entry.totalSize > 0 ? entry.totalSize : 0; total += entry.totalSize > 0 ? entry.totalSize : entry.bytesReceived;
quint64 received = 0; quint64 received = 0;
for(auto & entry : currentDownloads) for(auto & entry : currentDownloads)

View File

@ -603,8 +603,8 @@ void CModListView::downloadFile(QString file, QString url, QString description)
void CModListView::downloadProgress(qint64 current, qint64 max) void CModListView::downloadProgress(qint64 current, qint64 max)
{ {
// display progress, in kilobytes // display progress, in kilobytes
ui->progressBar->setValue(current / 1024);
ui->progressBar->setMaximum(max / 1024); ui->progressBar->setMaximum(max / 1024);
ui->progressBar->setValue(current / 1024);
} }
void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors) void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors)
@ -680,7 +680,7 @@ void CModListView::installFiles(QStringList files)
auto modjson = repodata[key].toMap().value("mod"); auto modjson = repodata[key].toMap().value("mod");
if(!modjson.isNull()) if(!modjson.isNull())
{ {
downloadFile(key + ".json", modjson.toString(), "mod json"); downloadFile(key + ".json", modjson.toString(), "repository index");
} }
} }
} }

View File

@ -248,7 +248,6 @@ bool CModManager::doEnableMod(QString mod, bool on)
modList->setModSettings(modSettings["activeMods"]); modList->setModSettings(modSettings["activeMods"]);
modList->modChanged(mod); modList->modChanged(mod);
JsonUtils::JsonToFile(settingsPath(), modSettings); JsonUtils::JsonToFile(settingsPath(), modSettings);
return true; return true;