Path: blob/master/src/duckstation-qt/autoupdaterwindow.h
4802 views
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#pragma once45#include "common/types.h"67#include "ui_autoupdaterwindow.h"89#include <memory>10#include <string>11#include <string_view>1213#include <QtCore/QDateTime>14#include <QtCore/QStringList>15#include <QtCore/QTimer>16#include <QtWidgets/QDialog>1718class Error;19class HTTPDownloader;2021class EmuThread;2223class AutoUpdaterWindow final : public QWidget24{25Q_OBJECT2627public:28explicit AutoUpdaterWindow(QWidget* parent = nullptr);29~AutoUpdaterWindow();3031void queueUpdateCheck(bool display_errors);32void queueGetLatestRelease();3334static bool isSupported();35static bool canInstallUpdate();36static QStringList getTagList();37static std::string getDefaultTag();38static void cleanupAfterUpdate();39static bool isOfficialBuild();40static void warnAboutUnofficialBuild();4142Q_SIGNALS:43void updateCheckCompleted();4445protected:46void closeEvent(QCloseEvent* event) override;4748private:49void httpPollTimerPoll();5051void downloadUpdateClicked();52void skipThisUpdateClicked();53void remindMeLaterClicked();5455void reportError(const std::string_view msg);5657bool ensureHttpReady();5859bool updateNeeded() const;60std::string getCurrentUpdateTag() const;6162void getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response, bool display_errors);63void getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response);6465void queueGetChanges();66void getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response);6768bool processUpdate(const std::vector<u8>& update_data);6970#ifdef _WIN3271bool doesUpdaterNeedElevation(const std::string& application_dir) const;72bool doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path);73bool extractUpdater(const std::string& zip_path, const std::string& destination_path, Error* error);74#endif7576Ui::AutoUpdaterWindow m_ui;7778std::unique_ptr<HTTPDownloader> m_http;79QTimer* m_http_poll_timer = nullptr;80QString m_latest_sha;81QString m_download_url;82int m_download_size = 0;8384bool m_update_will_break_save_states = false;85};868788