mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #10307 from AdmiralCurtiss/config-port-autoupdate
Config: Port AutoUpdate settings to new config system.
This commit is contained in:
@ -286,7 +286,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
|
||||
if (!Settings::Instance().IsBatchModeEnabled())
|
||||
{
|
||||
auto* updater = new Updater(&win);
|
||||
auto* updater = new Updater(&win, Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK),
|
||||
Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE));
|
||||
updater->start();
|
||||
}
|
||||
|
||||
|
@ -548,12 +548,8 @@ void MenuBar::AddOptionsMenu()
|
||||
|
||||
void MenuBar::InstallUpdateManually()
|
||||
{
|
||||
auto& track = SConfig::GetInstance().m_auto_update_track;
|
||||
auto previous_value = track;
|
||||
|
||||
track = "dev";
|
||||
|
||||
auto* updater = new Updater(this->parentWidget());
|
||||
auto* updater =
|
||||
new Updater(this->parentWidget(), "dev", Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE));
|
||||
|
||||
if (!updater->CheckForUpdate())
|
||||
{
|
||||
@ -561,8 +557,6 @@ void MenuBar::InstallUpdateManually()
|
||||
this, tr("Update"),
|
||||
tr("You are running the latest version available on this update track."));
|
||||
}
|
||||
|
||||
track = previous_value;
|
||||
}
|
||||
|
||||
void MenuBar::AddHelpMenu()
|
||||
|
@ -614,14 +614,14 @@ void Settings::SetAutoUpdateTrack(const QString& mode)
|
||||
if (mode == GetAutoUpdateTrack())
|
||||
return;
|
||||
|
||||
SConfig::GetInstance().m_auto_update_track = mode.toStdString();
|
||||
Config::SetBase(Config::MAIN_AUTOUPDATE_UPDATE_TRACK, mode.toStdString());
|
||||
|
||||
emit AutoUpdateTrackChanged(mode);
|
||||
}
|
||||
|
||||
QString Settings::GetAutoUpdateTrack() const
|
||||
{
|
||||
return QString::fromStdString(SConfig::GetInstance().m_auto_update_track);
|
||||
return QString::fromStdString(Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK));
|
||||
}
|
||||
|
||||
void Settings::SetFallbackRegion(const DiscIO::Region& region)
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "DolphinQt/Updater.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
@ -18,20 +20,22 @@
|
||||
|
||||
// Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process
|
||||
|
||||
Updater::Updater(QWidget* parent) : m_parent(parent)
|
||||
Updater::Updater(QWidget* parent, std::string update_track, std::string hash_override)
|
||||
: m_parent(parent), m_update_track(std::move(update_track)),
|
||||
m_hash_override(std::move(hash_override))
|
||||
{
|
||||
connect(this, &QThread::finished, this, &QObject::deleteLater);
|
||||
}
|
||||
|
||||
void Updater::run()
|
||||
{
|
||||
AutoUpdateChecker::CheckForUpdate();
|
||||
AutoUpdateChecker::CheckForUpdate(m_update_track, m_hash_override);
|
||||
}
|
||||
|
||||
bool Updater::CheckForUpdate()
|
||||
{
|
||||
m_update_available = false;
|
||||
AutoUpdateChecker::CheckForUpdate();
|
||||
AutoUpdateChecker::CheckForUpdate(m_update_track, m_hash_override);
|
||||
|
||||
return m_update_available;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include "UICommon/AutoUpdate.h"
|
||||
@ -15,7 +17,7 @@ class Updater : public QThread, public AutoUpdateChecker
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Updater(QWidget* parent);
|
||||
explicit Updater(QWidget* parent, std::string update_track, std::string hash_override);
|
||||
|
||||
void run() override;
|
||||
void OnUpdateAvailable(const NewVersionInformation& info) override;
|
||||
@ -23,5 +25,7 @@ public:
|
||||
|
||||
private:
|
||||
QWidget* m_parent;
|
||||
std::string m_update_track;
|
||||
std::string m_hash_override;
|
||||
bool m_update_available = false;
|
||||
};
|
||||
|
Reference in New Issue
Block a user