nordsoft 2 年之前
父節點
當前提交
1ef407ea9f
共有 3 個文件被更改,包括 11 次插入1 次删除
  1. 4 0
      config/schemas/mod.json
  2. 3 0
      launcher/modManager/cdownloadmanager_moc.cpp
  3. 4 1
      launcher/modManager/cmodlist.cpp

+ 4 - 0
config/schemas/mod.json

@@ -22,6 +22,10 @@
 					"type" : "string",
 					"description" : "Author of the mod. Can be nickname, real name or name of team"
 				},
+				"size": {
+					"type" : "number",
+					"description" : "Approximate size of mod, compressed by zip algorithm, in Mb"
+				},
 				"changelog" : {
 					"type" : "object",
 					"description" : "List of changes/new features in each version",

+ 3 - 0
launcher/modManager/cdownloadmanager_moc.cpp

@@ -141,6 +141,9 @@ void CDownloadManager::downloadProgressChanged(qint64 bytesReceived, qint64 byte
 	quint64 received = 0;
 	for(auto & entry : currentDownloads)
 		received += entry.bytesReceived > 0 ? entry.bytesReceived : 0;
+	
+	if(received > total)
+		total = received;
 
 	emit downloadProgress(received, total);
 }

+ 4 - 1
launcher/modManager/cmodlist.cpp

@@ -324,9 +324,10 @@ CModEntry CModList::getMod(QString modname) const
 			{
 				if(repo.empty() || CModEntry::compareVersions(repo["version"].toString(), repoValMap["version"].toString()))
 				{
-					//take valid download link and screenshots before assignment
+					//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");
 					repo = repoValMap;
 					if(repo.value("download").isNull())
 					{
@@ -334,6 +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;
 				}
 			}
 		}