Path: blob/master/src/duckstation-qt/asynchttprequest.h
15701 views
// SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#pragma once45#include "util/http_downloader.h"67#include "common/error.h"89#include <string>10#include <string_view>1112#include <QtCore/QObject>1314class QPixmap;1516class AsyncHTTPRequest final : public QObject17{18Q_OBJECT1920public:21AsyncHTTPRequest();22~AsyncHTTPRequest() override;2324void get(std::string url, const void* owner, ProgressCallback* progress = nullptr,25HTTPDownloader::HeaderList additional_headers = {}, std::optional<u16> timeout_seconds = {});26void post(std::string url, std::string post_data, const void* owner, ProgressCallback* progress = nullptr,27HTTPDownloader::HeaderList additional_headers = {}, std::optional<u16> timeout_seconds = {});2829Q_SIGNALS:30void requestComplete(qint32 status_code, Error& error_message, std::string& content_type,31HTTPDownloader::RequestData& data);3233private:34void handleResponse(s32 status_code, Error& error, std::string& content_type, HTTPDownloader::RequestData& data);35void finishRequest();3637s32 m_status_code = HTTPDownloader::HTTP_STATUS_ERROR;38Error m_error;39std::string m_content_type;40HTTPDownloader::RequestData m_data;41};424344