Browser: Add download finished graphics to download widget

Not the prettiest, but visually indicates that the download has finished
successfully.
This commit is contained in:
Marcus Nilsson 2021-05-31 18:20:50 +02:00 committed by Andreas Kling
parent 29cce65d2f
commit 4faff69974
3 changed files with 6 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -68,8 +68,8 @@ DownloadWidget::DownloadWidget(const URL& url)
animation_container.set_fixed_height(32);
auto& animation_layout = animation_container.set_layout<GUI::HorizontalBoxLayout>();
auto& browser_image = animation_container.add<GUI::ImageWidget>();
browser_image.load_from_file("/res/graphics/download-animation.gif");
m_browser_image = animation_container.add<GUI::ImageWidget>();
m_browser_image->load_from_file("/res/graphics/download-animation.gif");
animation_layout.add_spacer();
auto& source_label = add<GUI::Label>(String::formatted("From: {}", url));
@ -156,6 +156,8 @@ void DownloadWidget::did_finish(bool success)
{
dbgln("did_finish, success={}", success);
m_browser_image->load_from_file("/res/graphics/download-finished.gif");
window()->set_title("Download finished!");
m_close_button->set_enabled(true);
m_cancel_button->set_text("Open in Folder");
m_cancel_button->on_click = [this](auto) {

View file

@ -9,6 +9,7 @@
#include <AK/URL.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/FileStream.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Progressbar.h>
#include <LibGUI/Widget.h>
#include <LibProtocol/Request.h>
@ -35,6 +36,7 @@ private:
RefPtr<GUI::Button> m_cancel_button;
RefPtr<GUI::Button> m_close_button;
RefPtr<GUI::CheckBox> m_close_on_finish_checkbox;
RefPtr<GUI::ImageWidget> m_browser_image;
OwnPtr<Core::OutputFileStream> m_output_file_stream;
Core::ElapsedTimer m_elapsed_timer;
};