1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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

@ -62,10 +62,10 @@ CDownloadManager::FileEntry & CDownloadManager::getEntry(QNetworkReply * reply)
void CDownloadManager::downloadFinished(QNetworkReply * reply)
{
FileEntry & file = getEntry(reply);
QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
QUrl qurl = possibleRedirectUrl.toUrl();
if(possibleRedirectUrl.isValid())
{
QString filename;
@ -135,7 +135,7 @@ void CDownloadManager::downloadProgressChanged(qint64 bytesReceived, qint64 byte
quint64 total = 0;
for(auto & entry : currentDownloads)
total += entry.totalSize > 0 ? entry.totalSize : 0;
total += entry.totalSize > 0 ? entry.totalSize : entry.bytesReceived;
quint64 received = 0;
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)
{
// display progress, in kilobytes
ui->progressBar->setValue(current / 1024);
ui->progressBar->setMaximum(max / 1024);
ui->progressBar->setValue(current / 1024);
}
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");
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->modChanged(mod);
JsonUtils::JsonToFile(settingsPath(), modSettings);
return true;