Path: blob/master/src/duckstation-qt/autoupdaterdialog.h
6233 views
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#pragma once45#include "ui_autoupdaterdialog.h"67#include "common/types.h"89#include <QtCore/QTimer>10#include <string>11#include <string_view>12#include <vector>1314class Error;15class HTTPDownloader;16class QtProgressCallback;1718class EmuThread;1920class AutoUpdaterDialog final : public QDialog21{22Q_OBJECT2324public:25~AutoUpdaterDialog();2627static AutoUpdaterDialog* create(QWidget* const parent, Error* const error);2829void queueUpdateCheck(bool display_errors);30void queueGetLatestRelease();3132// (channel name, channel display name)33static std::vector<std::pair<QString, QString>> getChannelList();3435static std::string getDefaultTag();36static std::string getCurrentUpdateTag();37static void cleanupAfterUpdate();38static void warnAboutUnofficialBuild();3940Q_SIGNALS:41/// Update check completed, might have an update available.42void updateCheckCompleted(bool update_available);4344/// Update was available, but the window was closed.45void closed();4647protected:48void closeEvent(QCloseEvent* event) override;4950private:51AutoUpdaterDialog(QWidget* const parent, Error* const error);5253void setDownloadSectionVisibility(bool visible);5455void reportError(const std::string_view msg);56void ensureHttpPollingActive();57void httpPollTimerPoll();5859void downloadUpdateClicked();60void skipThisUpdateClicked();61void remindMeLaterClicked();6263bool updateNeeded() const;6465void getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response, bool display_errors);66void getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response);6768void queueGetChanges();69void getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response);7071bool processUpdate(const std::vector<u8>& update_data);7273#ifdef _WIN3274bool doesUpdaterNeedElevation(const std::string& application_dir) const;75bool doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path,76const std::string& program_path);77bool extractUpdater(const std::string& zip_path, const std::string& destination_path,78const std::string_view check_for_file, Error* error);79#endif8081Ui::AutoUpdaterDialog m_ui;8283std::unique_ptr<HTTPDownloader> m_http;84QTimer* m_http_poll_timer = nullptr;85QtProgressCallback* m_download_progress_callback = nullptr;86QString m_latest_sha;87QString m_download_url;88int m_download_size = 0;8990bool m_update_will_break_save_states = false;91};929394