diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-20 11:46:20 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-24 17:10:01 +0100 |
commit | 2b3790100a3d4f0b8c51e8d7d7a58a0877c545bc (patch) | |
tree | 467d7409225b00f5745b63ddca22c9e876d41f48 /Userland/Applications/Browser | |
parent | de3225a28be9e09f6540489c3927de4396ab07cd (diff) | |
download | serenity-2b3790100a3d4f0b8c51e8d7d7a58a0877c545bc.zip |
Browser: Convert file-downloading code to Core::Stream :^)
Diffstat (limited to 'Userland/Applications/Browser')
-rw-r--r-- | Userland/Applications/Browser/DownloadWidget.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/Browser/DownloadWidget.h | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 4b2fb937d6..880f9b4566 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -8,9 +8,8 @@ #include <AK/NumberFormat.h> #include <AK/StringBuilder.h> #include <LibConfig/Client.h> -#include <LibCore/File.h> -#include <LibCore/FileStream.h> #include <LibCore/StandardPaths.h> +#include <LibCore/Stream.h> #include <LibDesktop/Launcher.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/Button.h> @@ -46,13 +45,13 @@ DownloadWidget::DownloadWidget(const URL& url) }; { - auto file_or_error = Core::File::open(m_destination_path, Core::OpenMode::WriteOnly); + auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write); if (file_or_error.is_error()) { GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed", GUI::MessageBox::Type::Error); window()->close(); return; } - m_output_file_stream = make<Core::OutputFileStream>(*file_or_error.value()); + m_output_file_stream = file_or_error.release_value(); } m_download->on_finish = [this](bool success, auto) { did_finish(success); }; diff --git a/Userland/Applications/Browser/DownloadWidget.h b/Userland/Applications/Browser/DownloadWidget.h index 7d544eb9e4..8b37aab4ed 100644 --- a/Userland/Applications/Browser/DownloadWidget.h +++ b/Userland/Applications/Browser/DownloadWidget.h @@ -8,7 +8,7 @@ #include <AK/URL.h> #include <LibCore/ElapsedTimer.h> -#include <LibCore/FileStream.h> +#include <LibCore/Stream.h> #include <LibGUI/ImageWidget.h> #include <LibGUI/Progressbar.h> #include <LibGUI/Widget.h> @@ -37,7 +37,7 @@ private: 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; + OwnPtr<Core::Stream::File> m_output_file_stream; Core::ElapsedTimer m_elapsed_timer; }; |