diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-30 22:21:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-30 23:00:35 +0200 |
commit | 1a15ca2de45c571d33bb1da3d05fd11affaae74c (patch) | |
tree | 8c806c46fff2afd541abc7df1507f19145ecb908 /Applications/Browser | |
parent | 853d900ee8893e2a63a6c490b37522dbd4fe8d1e (diff) | |
download | serenity-1a15ca2de45c571d33bb1da3d05fd11affaae74c.zip |
Browser: Show download progress in the taskbar if available
Diffstat (limited to 'Applications/Browser')
-rw-r--r-- | Applications/Browser/DownloadWidget.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Applications/Browser/DownloadWidget.cpp b/Applications/Browser/DownloadWidget.cpp index cea6ef7ede..3e6ed8a199 100644 --- a/Applications/Browser/DownloadWidget.cpp +++ b/Applications/Browser/DownloadWidget.cpp @@ -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); { |