mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Partial fix for displaying download progress of mods
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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"); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|   | ||||
| @@ -248,7 +248,6 @@ bool CModManager::doEnableMod(QString mod, bool on) | ||||
| 	modList->setModSettings(modSettings["activeMods"]); | ||||
| 	modList->modChanged(mod); | ||||
|  | ||||
|  | ||||
| 	JsonUtils::JsonToFile(settingsPath(), modSettings); | ||||
|  | ||||
| 	return true; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user