
The current ProtocolServer was really only used for requests, and with the recent introduction of the WebSocket service, long-lasting connections with another server are not part of it. To better reflect this, this commit renames it to RequestServer. This commit also changes the existing 'protocol' portal to 'request', the existing 'protocol' user and group to 'request', and most mentions of the 'download' aspect of the request to 'request' when relevant, to make everything consistent across the system. Note that LibProtocol still exists as-is, but the more generic Client class and the more specific Download class have both been renamed to a more accurate RequestClient and Request to match the new names. This commit only change names, not behaviors.
41 lines
970 B
C++
41 lines
970 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/URL.h>
|
|
#include <LibCore/ElapsedTimer.h>
|
|
#include <LibCore/FileStream.h>
|
|
#include <LibGUI/Progressbar.h>
|
|
#include <LibGUI/Widget.h>
|
|
#include <LibProtocol/Request.h>
|
|
|
|
namespace Browser {
|
|
|
|
class DownloadWidget final : public GUI::Widget {
|
|
C_OBJECT(DownloadWidget);
|
|
|
|
public:
|
|
virtual ~DownloadWidget() override;
|
|
|
|
private:
|
|
explicit DownloadWidget(const URL&);
|
|
|
|
void did_progress(Optional<u32> total_size, u32 downloaded_size);
|
|
void did_finish(bool success);
|
|
|
|
URL m_url;
|
|
String m_destination_path;
|
|
RefPtr<Protocol::Request> 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;
|
|
OwnPtr<Core::OutputFileStream> m_output_file_stream;
|
|
Core::ElapsedTimer m_elapsed_timer;
|
|
};
|
|
|
|
}
|