diff options
author | Marcus Nilsson <brainbomb@gmail.com> | 2021-05-31 18:20:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-13 20:55:58 +0200 |
commit | 4faff699747dfd6953daa69812f0752bbf2589b1 (patch) | |
tree | b50cd4d770968e372b7d3255cf2651b743fd3a7a /Userland/Applications/Browser | |
parent | 29cce65d2f3bd8f81f0f81f3f0e322110b0862e7 (diff) | |
download | serenity-4faff699747dfd6953daa69812f0752bbf2589b1.zip |
Browser: Add download finished graphics to download widget
Not the prettiest, but visually indicates that the download has finished
successfully.
Diffstat (limited to 'Userland/Applications/Browser')
-rw-r--r-- | Userland/Applications/Browser/DownloadWidget.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/Browser/DownloadWidget.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index a9a9b17cc5..f46b113c76 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -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) { diff --git a/Userland/Applications/Browser/DownloadWidget.h b/Userland/Applications/Browser/DownloadWidget.h index 37da49801f..7d544eb9e4 100644 --- a/Userland/Applications/Browser/DownloadWidget.h +++ b/Userland/Applications/Browser/DownloadWidget.h @@ -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; }; |