Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions loader/src/ui/mods/ModsLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,24 @@ void ModsStatusNode::updateState() {

case DownloadState::SomeDownloading: {
size_t totalProgress = 0;
size_t totalDownloading = 0;
// size_t totalDownloading = 0;

for (auto& download : downloads) {
auto status = download.getStatus();
/*
if (auto loading = std::get_if<server::DownloadStatusDownloading>(&status)) {
totalProgress += loading->percentage;
totalDownloading += 1;
}
*/
if (std::holds_alternative<server::DownloadStatusDone>(status)) {
totalProgress += 100;
} else if (auto downloading = std::get_if<server::DownloadStatusDownloading>(&status)) {
totalProgress += downloading->percentage;
}
}
auto percentage = totalProgress / static_cast<float>(totalDownloading);
auto totalDownloads = downloads.size();
auto percentage = totalProgress / static_cast<float>(totalDownloads);

m_statusPercentage->setString(fmt::format("{}%", static_cast<size_t>(percentage)).c_str());
m_statusPercentage->setVisible(true);
Expand Down