2019-09-11 09:55:43 +02:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
2020-02-22 20:42:49 +01:00
|
|
|
|
#include "stdafx.h"
|
2020-03-13 18:34:08 +01:00
|
|
|
|
#include <QObject>
|
|
|
|
|
|
#include <QByteArray>
|
2020-02-22 20:42:49 +01:00
|
|
|
|
|
2020-03-22 17:49:33 +01:00
|
|
|
|
class curl_handle;
|
2020-02-22 20:42:49 +01:00
|
|
|
|
class progress_dialog;
|
2019-09-11 09:55:43 +02:00
|
|
|
|
|
2020-03-13 18:34:08 +01:00
|
|
|
|
class update_manager final : public QObject
|
2019-09-11 09:55:43 +02:00
|
|
|
|
{
|
2020-03-21 22:17:15 +01:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
2019-09-11 09:55:43 +02:00
|
|
|
|
private:
|
2020-03-13 18:34:08 +01:00
|
|
|
|
std::atomic<bool> m_update_dialog = false;
|
2019-09-11 09:55:43 +02:00
|
|
|
|
progress_dialog* m_progress_dialog = nullptr;
|
|
|
|
|
|
QWidget* m_parent = nullptr;
|
|
|
|
|
|
|
2020-03-22 17:49:33 +01:00
|
|
|
|
curl_handle* m_curl = nullptr;
|
2020-03-13 18:34:08 +01:00
|
|
|
|
QByteArray m_curl_buf;
|
|
|
|
|
|
std::atomic<bool> m_curl_abort = false;
|
2020-03-21 22:17:15 +01:00
|
|
|
|
std::atomic<bool> m_curl_result = false;
|
2019-09-11 09:55:43 +02:00
|
|
|
|
|
|
|
|
|
|
std::string m_expected_hash;
|
|
|
|
|
|
u64 m_expected_size = 0;
|
|
|
|
|
|
|
2020-03-13 18:34:08 +01:00
|
|
|
|
bool handle_json(bool automatic);
|
|
|
|
|
|
bool handle_rpcs3();
|
2019-09-11 09:55:43 +02:00
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
update_manager();
|
|
|
|
|
|
void check_for_updates(bool automatic, QWidget* parent = nullptr);
|
2020-03-21 22:17:15 +01:00
|
|
|
|
size_t update_buffer(char* data, size_t size);
|
|
|
|
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
|
void signal_buffer_update(int size);
|
|
|
|
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
|
|
void handle_buffer_update(int size);
|
2019-09-11 09:55:43 +02:00
|
|
|
|
};
|