Upload percentage
This commit is contained in:
@@ -51,7 +51,8 @@ CSiaApi::_CSiaRenter::_CSiaRenter(const CSiaCurl& siaCurl) :
|
||||
_Funds(0),
|
||||
_Hosts(0),
|
||||
_Unspent(0),
|
||||
_TotalUsedBytes(0)
|
||||
_TotalUsedBytes(0),
|
||||
_TotalUploadProgress(100)
|
||||
{
|
||||
StartAutoThread();
|
||||
}
|
||||
@@ -83,11 +84,19 @@ void CSiaApi::_CSiaRenter::AutoThreadCallback(const CSiaCurl& siaCurl)
|
||||
{
|
||||
return sz + file->GetFileSize();
|
||||
});
|
||||
SetTotalUsedBytes(total);
|
||||
|
||||
std::uint32_t totalProgress = std::accumulate(std::next(fileList.begin()), fileList.end(), fileList[0]->GetUploadProgress(), [](const std::uint32_t& progress, const CSiaFilePtr& file)
|
||||
{
|
||||
return progress + file->GetUploadProgress();
|
||||
}) / fileList.size();
|
||||
|
||||
SetTotalUsedBytes(total);
|
||||
SetTotalUploadProgress(totalProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTotalUsedBytes(0);
|
||||
SetTotalUploadProgress(100);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -96,6 +105,7 @@ void CSiaApi::_CSiaRenter::AutoThreadCallback(const CSiaCurl& siaCurl)
|
||||
SetHosts(0);
|
||||
SetUnspent(0);
|
||||
SetTotalUsedBytes(0);
|
||||
SetTotalUploadProgress(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user