1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:15:07 +00:00

Browser: Show download progress in the taskbar if available

This commit is contained in:
Andreas Kling 2020-05-30 22:21:50 +02:00
parent 853d900ee8
commit 1a15ca2de4

View file

@ -129,10 +129,13 @@ DownloadWidget::~DownloadWidget()
void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
{
m_progress_bar->set_min(0);
if (total_size.has_value())
if (total_size.has_value()) {
int percent = roundf(((float)downloaded_size / (float)total_size.value()) * 100.0f);
window()->set_progress(percent);
m_progress_bar->set_max(total_size.value());
else
} else {
m_progress_bar->set_max(0);
}
m_progress_bar->set_value(downloaded_size);
{