Qt: Convert auto updater to window

And remove the application modality.

Fixes fights between the auto updater and achievement relogin window.
This commit is contained in:
Stenzek 2025-06-17 18:18:52 +10:00
parent a2bf5b4f50
commit fa7b4ae9f1
No known key found for this signature in database
11 changed files with 89 additions and 120 deletions

View File

@ -4,7 +4,6 @@
#define ENUMERATE_LOG_CHANNELS(X) \ #define ENUMERATE_LOG_CHANNELS(X) \
X(Achievements) \ X(Achievements) \
X(AudioStream) \ X(AudioStream) \
X(AutoUpdaterDialog) \
X(BIOS) \ X(BIOS) \
X(Bus) \ X(Bus) \
X(CDImage) \ X(CDImage) \

View File

@ -20,9 +20,9 @@ set(SRCS
audiosettingswidget.h audiosettingswidget.h
audiosettingswidget.ui audiosettingswidget.ui
audiostretchsettingsdialog.ui audiostretchsettingsdialog.ui
autoupdaterdialog.cpp autoupdaterwindow.cpp
autoupdaterdialog.h autoupdaterwindow.h
autoupdaterdialog.ui autoupdaterwindow.ui
biossettingswidget.cpp biossettingswidget.cpp
biossettingswidget.h biossettingswidget.h
biossettingswidget.ui biossettingswidget.ui

View File

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com> // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: CC-BY-NC-ND-4.0 // SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "autoupdaterdialog.h" #include "autoupdaterwindow.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "qthost.h" #include "qthost.h"
#include "qtprogresscallback.h" #include "qtprogresscallback.h"
@ -76,17 +76,17 @@ static const char* DOWNLOAD_PAGE_URL = "https://github.com/stenzek/duckstation/r
#endif #endif
LOG_CHANNEL(AutoUpdaterDialog); LOG_CHANNEL(Host);
AutoUpdaterDialog::AutoUpdaterDialog(QWidget* parent /* = nullptr */) : QDialog(parent) AutoUpdaterWindow::AutoUpdaterWindow(QWidget* parent /* = nullptr */) : QWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
setWindowIcon(QtHost::GetAppIcon());
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterDialog::downloadUpdateClicked); connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterWindow::downloadUpdateClicked);
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterDialog::skipThisUpdateClicked); connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterWindow::skipThisUpdateClicked);
connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterDialog::remindMeLaterClicked); connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterWindow::remindMeLaterClicked);
Error error; Error error;
m_http = HTTPDownloader::Create(Host::GetHTTPUserAgent(), &error); m_http = HTTPDownloader::Create(Host::GetHTTPUserAgent(), &error);
@ -94,9 +94,9 @@ AutoUpdaterDialog::AutoUpdaterDialog(QWidget* parent /* = nullptr */) : QDialog(
ERROR_LOG("Failed to create HTTP downloader, auto updater will not be available:\n{}", error.GetDescription()); ERROR_LOG("Failed to create HTTP downloader, auto updater will not be available:\n{}", error.GetDescription());
} }
AutoUpdaterDialog::~AutoUpdaterDialog() = default; AutoUpdaterWindow::~AutoUpdaterWindow() = default;
bool AutoUpdaterDialog::isSupported() bool AutoUpdaterWindow::isSupported()
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
return true; return true;
@ -105,7 +105,7 @@ bool AutoUpdaterDialog::isSupported()
#endif #endif
} }
bool AutoUpdaterDialog::isOfficialBuild() bool AutoUpdaterWindow::isOfficialBuild()
{ {
#if !__has_include("scmversion/tag.h") #if !__has_include("scmversion/tag.h")
return false; return false;
@ -114,7 +114,7 @@ bool AutoUpdaterDialog::isOfficialBuild()
#endif #endif
} }
void AutoUpdaterDialog::warnAboutUnofficialBuild() void AutoUpdaterWindow::warnAboutUnofficialBuild()
{ {
// //
// To those distributing their own builds or packages of DuckStation, and seeing this message: // To those distributing their own builds or packages of DuckStation, and seeing this message:
@ -206,7 +206,7 @@ void AutoUpdaterDialog::warnAboutUnofficialBuild()
#endif #endif
} }
QStringList AutoUpdaterDialog::getTagList() QStringList AutoUpdaterWindow::getTagList()
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
return QStringList(std::begin(UPDATE_TAGS), std::end(UPDATE_TAGS)); return QStringList(std::begin(UPDATE_TAGS), std::end(UPDATE_TAGS));
@ -215,7 +215,7 @@ QStringList AutoUpdaterDialog::getTagList()
#endif #endif
} }
std::string AutoUpdaterDialog::getDefaultTag() std::string AutoUpdaterWindow::getDefaultTag()
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
return THIS_RELEASE_TAG; return THIS_RELEASE_TAG;
@ -224,7 +224,7 @@ std::string AutoUpdaterDialog::getDefaultTag()
#endif #endif
} }
std::string AutoUpdaterDialog::getCurrentUpdateTag() const std::string AutoUpdaterWindow::getCurrentUpdateTag() const
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
return Host::GetBaseStringSettingValue("AutoUpdater", "UpdateTag", THIS_RELEASE_TAG); return Host::GetBaseStringSettingValue("AutoUpdater", "UpdateTag", THIS_RELEASE_TAG);
@ -233,12 +233,12 @@ std::string AutoUpdaterDialog::getCurrentUpdateTag() const
#endif #endif
} }
void AutoUpdaterDialog::reportError(const std::string_view msg) void AutoUpdaterWindow::reportError(const std::string_view msg)
{ {
QMessageBox::critical(this, tr("Updater Error"), QtUtils::StringViewToQString(msg)); QMessageBox::critical(this, tr("Updater Error"), QtUtils::StringViewToQString(msg));
} }
bool AutoUpdaterDialog::ensureHttpReady() bool AutoUpdaterWindow::ensureHttpReady()
{ {
if (!m_http) if (!m_http)
return false; return false;
@ -246,7 +246,7 @@ bool AutoUpdaterDialog::ensureHttpReady()
if (!m_http_poll_timer) if (!m_http_poll_timer)
{ {
m_http_poll_timer = new QTimer(this); m_http_poll_timer = new QTimer(this);
m_http_poll_timer->connect(m_http_poll_timer, &QTimer::timeout, this, &AutoUpdaterDialog::httpPollTimerPoll); m_http_poll_timer->connect(m_http_poll_timer, &QTimer::timeout, this, &AutoUpdaterWindow::httpPollTimerPoll);
} }
if (!m_http_poll_timer->isActive()) if (!m_http_poll_timer->isActive())
@ -259,7 +259,7 @@ bool AutoUpdaterDialog::ensureHttpReady()
return true; return true;
} }
void AutoUpdaterDialog::httpPollTimerPoll() void AutoUpdaterWindow::httpPollTimerPoll()
{ {
Assert(m_http); Assert(m_http);
m_http->PollRequests(); m_http->PollRequests();
@ -271,39 +271,7 @@ void AutoUpdaterDialog::httpPollTimerPoll()
} }
} }
void AutoUpdaterDialog::lockAndExec() void AutoUpdaterWindow::queueUpdateCheck(bool display_errors)
{
// pause+unfullscreen system. annoyingly, need to reparent if we were fullscreen
MainWindow::SystemLock lock = g_main_window->pauseAndLockSystem();
const Qt::WindowFlags prev_flags = windowFlags();
QWidget* const prev_parent = qobject_cast<QWidget*>(parent());
const bool needs_parent_change = (prev_parent && lock.getDialogParent() != prev_parent);
if (needs_parent_change)
{
setParent(lock.getDialogParent());
setWindowFlags(prev_flags);
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
// ensure we're at the front
QTimer::singleShot(20, Qt::TimerType::CoarseTimer, parent(), SLOT(raise()));
}
const int result = exec();
if (needs_parent_change)
{
setParent(prev_parent);
setWindowFlags(prev_flags);
}
// cancel resume if we're exiting anyway
if (result)
lock.cancelResume();
emit updateCheckCompleted();
}
void AutoUpdaterDialog::queueUpdateCheck(bool display_errors)
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
if (!ensureHttpReady()) if (!ensureHttpReady())
@ -322,7 +290,7 @@ void AutoUpdaterDialog::queueUpdateCheck(bool display_errors)
#endif #endif
} }
void AutoUpdaterDialog::queueGetLatestRelease() void AutoUpdaterWindow::queueGetLatestRelease()
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
if (!ensureHttpReady()) if (!ensureHttpReady())
@ -332,12 +300,12 @@ void AutoUpdaterDialog::queueGetLatestRelease()
} }
std::string url = fmt::format(fmt::runtime(LATEST_RELEASE_URL), getCurrentUpdateTag()); std::string url = fmt::format(fmt::runtime(LATEST_RELEASE_URL), getCurrentUpdateTag());
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterDialog::getLatestReleaseComplete, this, m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterWindow::getLatestReleaseComplete, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_4)); std::placeholders::_1, std::placeholders::_2, std::placeholders::_4));
#endif #endif
} }
void AutoUpdaterDialog::getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response, void AutoUpdaterWindow::getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response,
bool display_errors) bool display_errors)
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
@ -401,7 +369,7 @@ void AutoUpdaterDialog::getLatestTagComplete(s32 status_code, const Error& error
#endif #endif
} }
void AutoUpdaterDialog::getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response) void AutoUpdaterWindow::getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response)
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
if (status_code == HTTPDownloader::HTTP_STATUS_OK) if (status_code == HTTPDownloader::HTTP_STATUS_OK)
@ -447,9 +415,7 @@ void AutoUpdaterDialog::getLatestReleaseComplete(s32 status_code, const Error& e
m_ui.downloadAndInstall->setEnabled(true); m_ui.downloadAndInstall->setEnabled(true);
m_ui.updateNotes->setText(tr("Loading...")); m_ui.updateNotes->setText(tr("Loading..."));
queueGetChanges(); queueGetChanges();
QtUtils::ShowOrRaiseWindow(this);
// We have to defer this, because it comes back through the timer/HTTP callback...
QMetaObject::invokeMethod(this, "lockAndExec", Qt::QueuedConnection);
return; return;
} }
else else
@ -466,19 +432,19 @@ void AutoUpdaterDialog::getLatestReleaseComplete(s32 status_code, const Error& e
#endif #endif
} }
void AutoUpdaterDialog::queueGetChanges() void AutoUpdaterWindow::queueGetChanges()
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
if (!ensureHttpReady()) if (!ensureHttpReady())
return; return;
std::string url = fmt::format(fmt::runtime(CHANGES_URL), g_scm_hash_str, getCurrentUpdateTag()); std::string url = fmt::format(fmt::runtime(CHANGES_URL), g_scm_hash_str, getCurrentUpdateTag());
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterDialog::getChangesComplete, this, std::placeholders::_1, m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterWindow::getChangesComplete, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_4)); std::placeholders::_2, std::placeholders::_4));
#endif #endif
} }
void AutoUpdaterDialog::getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response) void AutoUpdaterWindow::getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response)
{ {
#ifdef UPDATE_CHECKER_SUPPORTED #ifdef UPDATE_CHECKER_SUPPORTED
if (status_code == HTTPDownloader::HTTP_STATUS_OK) if (status_code == HTTPDownloader::HTTP_STATUS_OK)
@ -552,7 +518,7 @@ void AutoUpdaterDialog::getChangesComplete(s32 status_code, const Error& error,
#endif #endif
} }
void AutoUpdaterDialog::downloadUpdateClicked() void AutoUpdaterWindow::downloadUpdateClicked()
{ {
#ifdef AUTO_UPDATER_SUPPORTED #ifdef AUTO_UPDATER_SUPPORTED
// Prevent multiple clicks of the button. // Prevent multiple clicks of the button.
@ -609,7 +575,7 @@ void AutoUpdaterDialog::downloadUpdateClicked()
{ {
// updater started. since we're a modal on the main window, we have to queue this. // updater started. since we're a modal on the main window, we have to queue this.
QMetaObject::invokeMethod(g_main_window, "requestExit", Qt::QueuedConnection, Q_ARG(bool, false)); QMetaObject::invokeMethod(g_main_window, "requestExit", Qt::QueuedConnection, Q_ARG(bool, false));
done(1); close();
} }
else else
{ {
@ -621,7 +587,7 @@ void AutoUpdaterDialog::downloadUpdateClicked()
#endif #endif
} }
bool AutoUpdaterDialog::updateNeeded() const bool AutoUpdaterWindow::updateNeeded() const
{ {
QString last_checked_sha = QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "LastVersion")); QString last_checked_sha = QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "LastVersion"));
@ -638,16 +604,22 @@ bool AutoUpdaterDialog::updateNeeded() const
return true; return true;
} }
void AutoUpdaterDialog::skipThisUpdateClicked() void AutoUpdaterWindow::skipThisUpdateClicked()
{ {
Host::SetBaseStringSettingValue("AutoUpdater", "LastVersion", m_latest_sha.toUtf8().constData()); Host::SetBaseStringSettingValue("AutoUpdater", "LastVersion", m_latest_sha.toUtf8().constData());
Host::CommitBaseSettingChanges(); Host::CommitBaseSettingChanges();
done(0); close();
} }
void AutoUpdaterDialog::remindMeLaterClicked() void AutoUpdaterWindow::remindMeLaterClicked()
{ {
done(0); close();
}
void AutoUpdaterWindow::closeEvent(QCloseEvent* event)
{
emit updateCheckCompleted();
QWidget::closeEvent(event);
} }
#ifdef _WIN32 #ifdef _WIN32
@ -655,7 +627,7 @@ void AutoUpdaterDialog::remindMeLaterClicked()
static constexpr char UPDATER_EXECUTABLE[] = "updater.exe"; static constexpr char UPDATER_EXECUTABLE[] = "updater.exe";
static constexpr char UPDATER_ARCHIVE_NAME[] = "update.zip"; static constexpr char UPDATER_ARCHIVE_NAME[] = "update.zip";
bool AutoUpdaterDialog::doesUpdaterNeedElevation(const std::string& application_dir) const bool AutoUpdaterWindow::doesUpdaterNeedElevation(const std::string& application_dir) const
{ {
// Try to create a dummy text file in the updater directory. If it fails, we probably won't have write permission. // Try to create a dummy text file in the updater directory. If it fails, we probably won't have write permission.
const std::string dummy_path = Path::Combine(application_dir, "update.txt"); const std::string dummy_path = Path::Combine(application_dir, "update.txt");
@ -668,7 +640,7 @@ bool AutoUpdaterDialog::doesUpdaterNeedElevation(const std::string& application_
return false; return false;
} }
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data) bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
{ {
const std::string& application_dir = EmuFolders::AppRoot; const std::string& application_dir = EmuFolders::AppRoot;
const std::string update_zip_path = Path::Combine(EmuFolders::DataRoot, UPDATER_ARCHIVE_NAME); const std::string update_zip_path = Path::Combine(EmuFolders::DataRoot, UPDATER_ARCHIVE_NAME);
@ -697,7 +669,7 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
return doUpdate(application_dir, update_zip_path, updater_path); return doUpdate(application_dir, update_zip_path, updater_path);
} }
bool AutoUpdaterDialog::extractUpdater(const std::string& zip_path, const std::string& destination_path, Error* error) bool AutoUpdaterWindow::extractUpdater(const std::string& zip_path, const std::string& destination_path, Error* error)
{ {
unzFile zf = MinizipHelpers::OpenUnzFile(zip_path.c_str()); unzFile zf = MinizipHelpers::OpenUnzFile(zip_path.c_str());
if (!zf) if (!zf)
@ -753,7 +725,7 @@ bool AutoUpdaterDialog::extractUpdater(const std::string& zip_path, const std::s
return true; return true;
} }
bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::string& zip_path, bool AutoUpdaterWindow::doUpdate(const std::string& application_dir, const std::string& zip_path,
const std::string& updater_path) const std::string& updater_path)
{ {
const std::string program_path = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()).toStdString(); const std::string program_path = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()).toStdString();
@ -787,7 +759,7 @@ bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::
return true; return true;
} }
void AutoUpdaterDialog::cleanupAfterUpdate() void AutoUpdaterWindow::cleanupAfterUpdate()
{ {
// If we weren't portable, then updater executable gets left in the application directory. // If we weren't portable, then updater executable gets left in the application directory.
if (EmuFolders::AppRoot == EmuFolders::DataRoot) if (EmuFolders::AppRoot == EmuFolders::DataRoot)
@ -809,7 +781,7 @@ void AutoUpdaterDialog::cleanupAfterUpdate()
#elif defined(__APPLE__) #elif defined(__APPLE__)
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data) bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
{ {
std::optional<std::string> bundle_path = CocoaTools::GetNonTranslocatedBundlePath(); std::optional<std::string> bundle_path = CocoaTools::GetNonTranslocatedBundlePath();
if (!bundle_path.has_value()) if (!bundle_path.has_value())
@ -870,13 +842,13 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
return true; return true;
} }
void AutoUpdaterDialog::cleanupAfterUpdate() void AutoUpdaterWindow::cleanupAfterUpdate()
{ {
} }
#elif defined(__linux__) #elif defined(__linux__)
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data) bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
{ {
const char* appimage_path = std::getenv("APPIMAGE"); const char* appimage_path = std::getenv("APPIMAGE");
if (!appimage_path || !FileSystem::FileExists(appimage_path)) if (!appimage_path || !FileSystem::FileExists(appimage_path))
@ -995,7 +967,7 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
return true; return true;
} }
void AutoUpdaterDialog::cleanupAfterUpdate() void AutoUpdaterWindow::cleanupAfterUpdate()
{ {
// Remove old/backup AppImage. // Remove old/backup AppImage.
const char* appimage_path = std::getenv("APPIMAGE"); const char* appimage_path = std::getenv("APPIMAGE");
@ -1014,12 +986,12 @@ void AutoUpdaterDialog::cleanupAfterUpdate()
#else #else
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data) bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
{ {
return false; return false;
} }
void AutoUpdaterDialog::cleanupAfterUpdate() void AutoUpdaterWindow::cleanupAfterUpdate()
{ {
} }

View File

@ -5,7 +5,7 @@
#include "common/types.h" #include "common/types.h"
#include "ui_autoupdaterdialog.h" #include "ui_autoupdaterwindow.h"
#include <memory> #include <memory>
#include <string> #include <string>
@ -21,13 +21,13 @@ class HTTPDownloader;
class EmuThread; class EmuThread;
class AutoUpdaterDialog final : public QDialog class AutoUpdaterWindow final : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AutoUpdaterDialog(QWidget* parent = nullptr); explicit AutoUpdaterWindow(QWidget* parent = nullptr);
~AutoUpdaterDialog(); ~AutoUpdaterWindow();
static bool isSupported(); static bool isSupported();
static QStringList getTagList(); static QStringList getTagList();
@ -45,12 +45,14 @@ public Q_SLOTS:
private Q_SLOTS: private Q_SLOTS:
void httpPollTimerPoll(); void httpPollTimerPoll();
void lockAndExec();
void downloadUpdateClicked(); void downloadUpdateClicked();
void skipThisUpdateClicked(); void skipThisUpdateClicked();
void remindMeLaterClicked(); void remindMeLaterClicked();
protected:
void closeEvent(QCloseEvent* event) override;
private: private:
void reportError(const std::string_view msg); void reportError(const std::string_view msg);
@ -73,7 +75,7 @@ private:
bool extractUpdater(const std::string& zip_path, const std::string& destination_path, Error* error); bool extractUpdater(const std::string& zip_path, const std::string& destination_path, Error* error);
#endif #endif
Ui::AutoUpdaterDialog m_ui; Ui::AutoUpdaterWindow m_ui;
std::unique_ptr<HTTPDownloader> m_http; std::unique_ptr<HTTPDownloader> m_http;
QTimer* m_http_poll_timer = nullptr; QTimer* m_http_poll_timer = nullptr;

View File

@ -1,10 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AutoUpdaterDialog</class> <class>AutoUpdaterWindow</class>
<widget class="QDialog" name="AutoUpdaterDialog"> <widget class="QWidget" name="AutoUpdaterWindow">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -16,9 +13,6 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Automatic Updater</string> <string>Automatic Updater</string>
</property> </property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">

View File

@ -7,7 +7,7 @@
<ClCompile Include="achievementlogindialog.cpp" /> <ClCompile Include="achievementlogindialog.cpp" />
<ClCompile Include="advancedsettingswidget.cpp" /> <ClCompile Include="advancedsettingswidget.cpp" />
<ClCompile Include="audiosettingswidget.cpp" /> <ClCompile Include="audiosettingswidget.cpp" />
<ClCompile Include="autoupdaterdialog.cpp" /> <ClCompile Include="autoupdaterwindow.cpp" />
<ClCompile Include="biossettingswidget.cpp" /> <ClCompile Include="biossettingswidget.cpp" />
<ClCompile Include="colorpickerbutton.cpp" /> <ClCompile Include="colorpickerbutton.cpp" />
<ClCompile Include="consolesettingswidget.cpp" /> <ClCompile Include="consolesettingswidget.cpp" />
@ -68,7 +68,7 @@
<QtMoc Include="advancedsettingswidget.h" /> <QtMoc Include="advancedsettingswidget.h" />
<QtMoc Include="qtprogresscallback.h" /> <QtMoc Include="qtprogresscallback.h" />
<QtMoc Include="inputbindingdialog.h" /> <QtMoc Include="inputbindingdialog.h" />
<QtMoc Include="autoupdaterdialog.h" /> <QtMoc Include="autoupdaterwindow.h" />
<QtMoc Include="debuggermodels.h" /> <QtMoc Include="debuggermodels.h" />
<QtMoc Include="debuggerwindow.h" /> <QtMoc Include="debuggerwindow.h" />
<QtMoc Include="achievementsettingswidget.h" /> <QtMoc Include="achievementsettingswidget.h" />
@ -145,7 +145,7 @@
<QtUi Include="inputbindingdialog.ui"> <QtUi Include="inputbindingdialog.ui">
<FileType>Document</FileType> <FileType>Document</FileType>
</QtUi> </QtUi>
<QtUi Include="autoupdaterdialog.ui"> <QtUi Include="autoupdaterwindow.ui">
<FileType>Document</FileType> <FileType>Document</FileType>
</QtUi> </QtUi>
<QtUi Include="achievementsettingswidget.ui"> <QtUi Include="achievementsettingswidget.ui">
@ -216,7 +216,7 @@
<ClCompile Include="$(IntDir)moc_achievementlogindialog.cpp" /> <ClCompile Include="$(IntDir)moc_achievementlogindialog.cpp" />
<ClCompile Include="$(IntDir)moc_achievementsettingswidget.cpp" /> <ClCompile Include="$(IntDir)moc_achievementsettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_audiosettingswidget.cpp" /> <ClCompile Include="$(IntDir)moc_audiosettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_autoupdaterdialog.cpp" /> <ClCompile Include="$(IntDir)moc_autoupdaterwindow.cpp" />
<ClCompile Include="$(IntDir)moc_advancedsettingswidget.cpp" /> <ClCompile Include="$(IntDir)moc_advancedsettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_biossettingswidget.cpp" /> <ClCompile Include="$(IntDir)moc_biossettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_colorpickerbutton.cpp" /> <ClCompile Include="$(IntDir)moc_colorpickerbutton.cpp" />

View File

@ -18,7 +18,7 @@
<ClCompile Include="aboutdialog.cpp" /> <ClCompile Include="aboutdialog.cpp" />
<ClCompile Include="memorycardsettingswidget.cpp" /> <ClCompile Include="memorycardsettingswidget.cpp" />
<ClCompile Include="inputbindingdialog.cpp" /> <ClCompile Include="inputbindingdialog.cpp" />
<ClCompile Include="autoupdaterdialog.cpp" /> <ClCompile Include="autoupdaterwindow.cpp" />
<ClCompile Include="biossettingswidget.cpp" /> <ClCompile Include="biossettingswidget.cpp" />
<ClCompile Include="memorycardeditorwindow.cpp" /> <ClCompile Include="memorycardeditorwindow.cpp" />
<ClCompile Include="postprocessingsettingswidget.cpp" /> <ClCompile Include="postprocessingsettingswidget.cpp" />
@ -56,7 +56,7 @@
<ClCompile Include="$(IntDir)moc_audiosettingswidget.cpp"> <ClCompile Include="$(IntDir)moc_audiosettingswidget.cpp">
<Filter>moc</Filter> <Filter>moc</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(IntDir)moc_autoupdaterdialog.cpp"> <ClCompile Include="$(IntDir)moc_autoupdaterwindow.cpp">
<Filter>moc</Filter> <Filter>moc</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(IntDir)moc_biossettingswidget.cpp"> <ClCompile Include="$(IntDir)moc_biossettingswidget.cpp">
@ -211,7 +211,7 @@
<QtMoc Include="aboutdialog.h" /> <QtMoc Include="aboutdialog.h" />
<QtMoc Include="memorycardsettingswidget.h" /> <QtMoc Include="memorycardsettingswidget.h" />
<QtMoc Include="inputbindingdialog.h" /> <QtMoc Include="inputbindingdialog.h" />
<QtMoc Include="autoupdaterdialog.h" /> <QtMoc Include="autoupdaterwindow.h" />
<QtMoc Include="biossettingswidget.h" /> <QtMoc Include="biossettingswidget.h" />
<QtMoc Include="memorycardeditorwindow.h" /> <QtMoc Include="memorycardeditorwindow.h" />
<QtMoc Include="postprocessingsettingswidget.h" /> <QtMoc Include="postprocessingsettingswidget.h" />
@ -248,7 +248,7 @@
<QtUi Include="advancedsettingswidget.ui" /> <QtUi Include="advancedsettingswidget.ui" />
<QtUi Include="aboutdialog.ui" /> <QtUi Include="aboutdialog.ui" />
<QtUi Include="inputbindingdialog.ui" /> <QtUi Include="inputbindingdialog.ui" />
<QtUi Include="autoupdaterdialog.ui" /> <QtUi Include="autoupdaterwindow.ui" />
<QtUi Include="biossettingswidget.ui" /> <QtUi Include="biossettingswidget.ui" />
<QtUi Include="postprocessingchainconfigwidget.ui" /> <QtUi Include="postprocessingchainconfigwidget.ui" />
<QtUi Include="memorycardeditorwindow.ui" /> <QtUi Include="memorycardeditorwindow.ui" />

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: CC-BY-NC-ND-4.0 // SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "interfacesettingswidget.h" #include "interfacesettingswidget.h"
#include "autoupdaterdialog.h" #include "autoupdaterwindow.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "qtutils.h" #include "qtutils.h"
#include "scmversion/scmversion.h" #include "scmversion/scmversion.h"
@ -135,12 +135,12 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
if (!m_dialog->isPerGameSettings()) if (!m_dialog->isPerGameSettings())
{ {
if (AutoUpdaterDialog::isSupported()) if (AutoUpdaterWindow::isSupported())
{ {
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true);
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList()); m_ui.autoUpdateTag->addItems(AutoUpdaterWindow::getTagList());
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag", SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
AutoUpdaterDialog::getDefaultTag()); AutoUpdaterWindow::getDefaultTag());
connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); }); connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); });
} }
else else

View File

@ -4,7 +4,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "aboutdialog.h" #include "aboutdialog.h"
#include "achievementlogindialog.h" #include "achievementlogindialog.h"
#include "autoupdaterdialog.h" #include "autoupdaterwindow.h"
#include "coverdownloaddialog.h" #include "coverdownloaddialog.h"
#include "debuggerwindow.h" #include "debuggerwindow.h"
#include "displaywidget.h" #include "displaywidget.h"
@ -815,6 +815,7 @@ void MainWindow::destroySubWindows()
QtUtils::CloseAndDeleteWindow(m_memory_scanner_window); QtUtils::CloseAndDeleteWindow(m_memory_scanner_window);
QtUtils::CloseAndDeleteWindow(m_debugger_window); QtUtils::CloseAndDeleteWindow(m_debugger_window);
QtUtils::CloseAndDeleteWindow(m_memory_card_editor_window); QtUtils::CloseAndDeleteWindow(m_memory_card_editor_window);
QtUtils::CloseAndDeleteWindow(m_auto_updater_dialog);
QtUtils::CloseAndDeleteWindow(m_controller_settings_window); QtUtils::CloseAndDeleteWindow(m_controller_settings_window);
QtUtils::CloseAndDeleteWindow(m_input_profile_editor_window); QtUtils::CloseAndDeleteWindow(m_input_profile_editor_window);
QtUtils::CloseAndDeleteWindow(m_settings_window); QtUtils::CloseAndDeleteWindow(m_settings_window);
@ -2964,7 +2965,7 @@ void MainWindow::onToolsOpenTextureDirectoryTriggered()
void MainWindow::checkForUpdates(bool display_message) void MainWindow::checkForUpdates(bool display_message)
{ {
if (!AutoUpdaterDialog::isSupported()) if (!AutoUpdaterWindow::isSupported())
{ {
if (display_message) if (display_message)
{ {
@ -2974,7 +2975,7 @@ void MainWindow::checkForUpdates(bool display_message)
mbox.setTextFormat(Qt::RichText); mbox.setTextFormat(Qt::RichText);
QString message; QString message;
if (!AutoUpdaterDialog::isOfficialBuild()) if (!AutoUpdaterWindow::isOfficialBuild())
{ {
message = message =
tr("<p>Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To " tr("<p>Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To "
@ -2998,8 +2999,8 @@ void MainWindow::checkForUpdates(bool display_message)
if (m_auto_updater_dialog) if (m_auto_updater_dialog)
return; return;
m_auto_updater_dialog = new AutoUpdaterDialog(this); m_auto_updater_dialog = new AutoUpdaterWindow();
connect(m_auto_updater_dialog, &AutoUpdaterDialog::updateCheckCompleted, this, &MainWindow::onUpdateCheckComplete); connect(m_auto_updater_dialog, &AutoUpdaterWindow::updateCheckCompleted, this, &MainWindow::onUpdateCheckComplete);
m_auto_updater_dialog->queueUpdateCheck(display_message); m_auto_updater_dialog->queueUpdateCheck(display_message);
} }

View File

@ -29,7 +29,7 @@ class QShortcut;
class MainWindow; class MainWindow;
class GameListWidget; class GameListWidget;
class EmuThread; class EmuThread;
class AutoUpdaterDialog; class AutoUpdaterWindow;
class MemoryCardEditorWindow; class MemoryCardEditorWindow;
class DebuggerWindow; class DebuggerWindow;
class MemoryScannerWindow; class MemoryScannerWindow;
@ -100,6 +100,7 @@ public:
ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; } ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; }
ALWAYS_INLINE QLabel* getStatusFPSWidget() const { return m_status_fps_widget; } ALWAYS_INLINE QLabel* getStatusFPSWidget() const { return m_status_fps_widget; }
ALWAYS_INLINE QLabel* getStatusVPSWidget() const { return m_status_vps_widget; } ALWAYS_INLINE QLabel* getStatusVPSWidget() const { return m_status_vps_widget; }
ALWAYS_INLINE AutoUpdaterWindow* getAutoUpdaterDialog() const { return m_auto_updater_dialog; }
/// Opens the editor for a specific input profile. /// Opens the editor for a specific input profile.
void openInputProfileEditor(const std::string_view name); void openInputProfileEditor(const std::string_view name);
@ -326,7 +327,7 @@ private:
ControllerSettingsWindow* m_controller_settings_window = nullptr; ControllerSettingsWindow* m_controller_settings_window = nullptr;
ControllerSettingsWindow* m_input_profile_editor_window = nullptr; ControllerSettingsWindow* m_input_profile_editor_window = nullptr;
AutoUpdaterDialog* m_auto_updater_dialog = nullptr; AutoUpdaterWindow* m_auto_updater_dialog = nullptr;
MemoryCardEditorWindow* m_memory_card_editor_window = nullptr; MemoryCardEditorWindow* m_memory_card_editor_window = nullptr;
DebuggerWindow* m_debugger_window = nullptr; DebuggerWindow* m_debugger_window = nullptr;
MemoryScannerWindow* m_memory_scanner_window = nullptr; MemoryScannerWindow* m_memory_scanner_window = nullptr;

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: CC-BY-NC-ND-4.0 // SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "qthost.h" #include "qthost.h"
#include "autoupdaterdialog.h" #include "autoupdaterwindow.h"
#include "displaywidget.h" #include "displaywidget.h"
#include "logwindow.h" #include "logwindow.h"
#include "mainwindow.h" #include "mainwindow.h"
@ -2808,7 +2808,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
} }
else if (CHECK_ARG("-updatecleanup")) else if (CHECK_ARG("-updatecleanup"))
{ {
s_cleanup_after_update = AutoUpdaterDialog::isSupported(); s_cleanup_after_update = AutoUpdaterWindow::isSupported();
continue; continue;
} }
else if (CHECK_ARG("--")) else if (CHECK_ARG("--"))
@ -2929,13 +2929,13 @@ int main(int argc, char* argv[])
// Remove any previous-version remanants. // Remove any previous-version remanants.
if (s_cleanup_after_update) if (s_cleanup_after_update)
AutoUpdaterDialog::cleanupAfterUpdate(); AutoUpdaterWindow::cleanupAfterUpdate();
// Set theme before creating any windows. // Set theme before creating any windows.
QtHost::UpdateApplicationTheme(); QtHost::UpdateApplicationTheme();
// Build warning. // Build warning.
AutoUpdaterDialog::warnAboutUnofficialBuild(); AutoUpdaterWindow::warnAboutUnofficialBuild();
// Start logging early. // Start logging early.
LogWindow::updateSettings(); LogWindow::updateSettings();