mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
Edit updater_dialog.h
This commit is contained in:
@@ -3,17 +3,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include <memory>
|
||||
#include "citron/updater/updater_service.h"
|
||||
|
||||
// Forward declare QString for the helper function.
|
||||
class QString;
|
||||
|
||||
namespace Ui {
|
||||
class UpdaterDialog;
|
||||
}
|
||||
|
||||
namespace Updater {
|
||||
|
||||
// Add the declaration for the date formatting helper function.
|
||||
QString FormatDateTimeString(const std::string& iso_string);
|
||||
|
||||
class UpdaterDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -24,7 +29,7 @@ namespace Updater {
|
||||
void CheckForUpdates(const std::string& update_url);
|
||||
|
||||
private slots:
|
||||
void OnUpdateCheckCompleted(bool has_update, const UpdateInfo& update_info);
|
||||
void OnUpdateCheckCompleted(bool has_update, const Updater::UpdateInfo& update_info);
|
||||
void OnUpdateDownloadProgress(int percentage, qint64 bytes_received, qint64 bytes_total);
|
||||
void OnUpdateInstallProgress(int percentage, const QString& current_file);
|
||||
void OnUpdateCompleted(Updater::UpdaterService::UpdateResult result, const QString& message);
|
||||
@@ -35,29 +40,19 @@ namespace Updater {
|
||||
void OnRestartButtonClicked();
|
||||
|
||||
private:
|
||||
enum class State { Checking, NoUpdate, UpdateAvailable, Downloading, Installing, Completed, Error };
|
||||
|
||||
void SetupUI();
|
||||
void ShowCheckingState();
|
||||
void ShowNoUpdateState();
|
||||
void ShowNoUpdateState(const Updater::UpdateInfo& update_info);
|
||||
void ShowUpdateAvailableState();
|
||||
void ShowDownloadingState();
|
||||
void ShowInstallingState();
|
||||
void ShowCompletedState();
|
||||
void ShowErrorState();
|
||||
void UpdateDownloadProgress(int percentage, qint64 bytes_received, qint64 bytes_total);
|
||||
void UpdateInstallProgress(int percentage, const QString& current_file);
|
||||
QString FormatBytes(qint64 bytes) const;
|
||||
QString GetUpdateMessage(Updater::UpdaterService::UpdateResult result) const;
|
||||
|
||||
enum class State {
|
||||
Checking,
|
||||
NoUpdate,
|
||||
UpdateAvailable,
|
||||
Downloading,
|
||||
Installing,
|
||||
Completed,
|
||||
Error
|
||||
};
|
||||
|
||||
std::unique_ptr<Ui::UpdaterDialog> ui;
|
||||
std::unique_ptr<Updater::UpdaterService> updater_service;
|
||||
UpdateInfo current_update_info;
|
||||
|
||||
Reference in New Issue
Block a user