Bläddra i källkod

Partial fix for displaying download progress of mods

Ivan Savenko 2 år sedan
förälder
incheckning
814a4b9455

+ 3 - 3
launcher/modManager/cdownloadmanager_moc.cpp

@@ -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)

+ 2 - 2
launcher/modManager/cmodlistview_moc.cpp

@@ -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");
 					}
 				}
 			}

+ 0 - 1
launcher/modManager/cmodmanager.cpp

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