serenity/Userland/Applications/Browser/DownloadWidget.h
Shannon Booth e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00

44 lines
1.1 KiB
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/ElapsedTimer.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Progressbar.h>
#include <LibGUI/Widget.h>
#include <LibURL/URL.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Browser {
class DownloadWidget final : public GUI::Widget {
C_OBJECT(DownloadWidget);
public:
virtual ~DownloadWidget() override = default;
private:
explicit DownloadWidget(const URL::URL&);
void did_progress(Optional<u64> total_size, u64 downloaded_size);
void did_finish(bool success);
URL::URL m_url;
ByteString m_destination_path;
RefPtr<Web::ResourceLoaderConnectorRequest> m_download;
RefPtr<GUI::Progressbar> m_progressbar;
RefPtr<GUI::Label> m_progress_label;
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::File> m_output_file_stream;
Core::ElapsedTimer m_elapsed_timer;
};
}