mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-11 17:04:33 +00:00
Qt: Make auto updater window-modal
This commit is contained in:
@@ -21,9 +21,9 @@ set(SRCS
|
||||
audiosettingswidget.h
|
||||
audiosettingswidget.ui
|
||||
audiostretchsettingsdialog.ui
|
||||
autoupdaterwindow.cpp
|
||||
autoupdaterwindow.h
|
||||
autoupdaterwindow.ui
|
||||
autoupdaterdialog.cpp
|
||||
autoupdaterdialog.h
|
||||
autoupdaterdialog.ui
|
||||
biossettingswidget.cpp
|
||||
biossettingswidget.h
|
||||
biossettingswidget.ui
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include "autoupdaterwindow.h"
|
||||
#include "autoupdaterdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qthost.h"
|
||||
#include "qtprogresscallback.h"
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <QtWidgets/QProgressDialog>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
#include "moc_autoupdaterwindow.cpp"
|
||||
#include "moc_autoupdaterdialog.cpp"
|
||||
|
||||
// Interval at which HTTP requests are polled.
|
||||
static constexpr u32 HTTP_POLL_INTERVAL = 10;
|
||||
@@ -105,7 +105,7 @@ static constexpr const std::pair<const char*, const char*> s_update_channels[] =
|
||||
|
||||
LOG_CHANNEL(Host);
|
||||
|
||||
AutoUpdaterWindow::AutoUpdaterWindow(Error* const error) : QWidget()
|
||||
AutoUpdaterDialog::AutoUpdaterDialog(QWidget* const parent, Error* const error) : QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
QFont title_font(m_ui.titleLabel->font());
|
||||
@@ -115,21 +115,21 @@ AutoUpdaterWindow::AutoUpdaterWindow(Error* const error) : QWidget()
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setDownloadSectionVisibility(false);
|
||||
|
||||
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterWindow::downloadUpdateClicked);
|
||||
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterWindow::skipThisUpdateClicked);
|
||||
connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterWindow::remindMeLaterClicked);
|
||||
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterDialog::downloadUpdateClicked);
|
||||
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterDialog::skipThisUpdateClicked);
|
||||
connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterDialog::remindMeLaterClicked);
|
||||
|
||||
m_http = HTTPDownloader::Create(Host::GetHTTPUserAgent(), error);
|
||||
|
||||
m_http_poll_timer = new QTimer(this);
|
||||
m_http_poll_timer->connect(m_http_poll_timer, &QTimer::timeout, this, &AutoUpdaterWindow::httpPollTimerPoll);
|
||||
m_http_poll_timer->connect(m_http_poll_timer, &QTimer::timeout, this, &AutoUpdaterDialog::httpPollTimerPoll);
|
||||
}
|
||||
|
||||
AutoUpdaterWindow::~AutoUpdaterWindow() = default;
|
||||
AutoUpdaterDialog::~AutoUpdaterDialog() = default;
|
||||
|
||||
AutoUpdaterWindow* AutoUpdaterWindow::create(Error* const error)
|
||||
AutoUpdaterDialog* AutoUpdaterDialog::create(QWidget* const parent, Error* const error)
|
||||
{
|
||||
AutoUpdaterWindow* const win = new AutoUpdaterWindow(error);
|
||||
AutoUpdaterDialog* const win = new AutoUpdaterDialog(parent, error);
|
||||
if (!win->m_http)
|
||||
{
|
||||
delete win;
|
||||
@@ -139,7 +139,7 @@ AutoUpdaterWindow* AutoUpdaterWindow::create(Error* const error)
|
||||
return win;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::warnAboutUnofficialBuild()
|
||||
void AutoUpdaterDialog::warnAboutUnofficialBuild()
|
||||
{
|
||||
//
|
||||
// To those distributing their own builds or packages of DuckStation, and seeing this message:
|
||||
@@ -231,7 +231,7 @@ void AutoUpdaterWindow::warnAboutUnofficialBuild()
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::pair<QString, QString>> AutoUpdaterWindow::getChannelList()
|
||||
std::vector<std::pair<QString, QString>> AutoUpdaterDialog::getChannelList()
|
||||
{
|
||||
std::vector<std::pair<QString, QString>> ret;
|
||||
ret.reserve(std::size(s_update_channels));
|
||||
@@ -240,17 +240,17 @@ std::vector<std::pair<QString, QString>> AutoUpdaterWindow::getChannelList()
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string AutoUpdaterWindow::getDefaultTag()
|
||||
std::string AutoUpdaterDialog::getDefaultTag()
|
||||
{
|
||||
return UPDATER_RELEASE_CHANNEL;
|
||||
}
|
||||
|
||||
std::string AutoUpdaterWindow::getCurrentUpdateTag()
|
||||
std::string AutoUpdaterDialog::getCurrentUpdateTag()
|
||||
{
|
||||
return Host::GetBaseStringSettingValue("AutoUpdater", "UpdateTag", UPDATER_RELEASE_CHANNEL);
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::setDownloadSectionVisibility(bool visible)
|
||||
void AutoUpdaterDialog::setDownloadSectionVisibility(bool visible)
|
||||
{
|
||||
m_ui.downloadProgress->setVisible(visible);
|
||||
m_ui.downloadStatus->setVisible(visible);
|
||||
@@ -260,7 +260,7 @@ void AutoUpdaterWindow::setDownloadSectionVisibility(bool visible)
|
||||
m_ui.remindMeLater->setVisible(!visible);
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::reportError(const std::string_view msg)
|
||||
void AutoUpdaterDialog::reportError(const std::string_view msg)
|
||||
{
|
||||
// if we're visible, use ourselves.
|
||||
QWidget* const parent = (isVisible() ? static_cast<QWidget*>(this) : g_main_window);
|
||||
@@ -274,7 +274,7 @@ void AutoUpdaterWindow::reportError(const std::string_view msg)
|
||||
msgbox->open();
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::ensureHttpPollingActive()
|
||||
void AutoUpdaterDialog::ensureHttpPollingActive()
|
||||
{
|
||||
if (m_http_poll_timer->isActive())
|
||||
return;
|
||||
@@ -284,7 +284,7 @@ void AutoUpdaterWindow::ensureHttpPollingActive()
|
||||
m_http_poll_timer->start();
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::httpPollTimerPoll()
|
||||
void AutoUpdaterDialog::httpPollTimerPoll()
|
||||
{
|
||||
m_http->PollRequests();
|
||||
|
||||
@@ -295,7 +295,7 @@ void AutoUpdaterWindow::httpPollTimerPoll()
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::queueUpdateCheck(bool display_errors)
|
||||
void AutoUpdaterDialog::queueUpdateCheck(bool display_errors)
|
||||
{
|
||||
ensureHttpPollingActive();
|
||||
m_http->CreateRequest(LATEST_TAG_URL,
|
||||
@@ -305,15 +305,15 @@ void AutoUpdaterWindow::queueUpdateCheck(bool display_errors)
|
||||
});
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::queueGetLatestRelease()
|
||||
void AutoUpdaterDialog::queueGetLatestRelease()
|
||||
{
|
||||
ensureHttpPollingActive();
|
||||
std::string url = fmt::format(LATEST_RELEASE_URL, getCurrentUpdateTag());
|
||||
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterWindow::getLatestReleaseComplete, this,
|
||||
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterDialog::getLatestReleaseComplete, this,
|
||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_4));
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response,
|
||||
void AutoUpdaterDialog::getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response,
|
||||
bool display_errors)
|
||||
{
|
||||
const std::string selected_tag(getCurrentUpdateTag());
|
||||
@@ -375,7 +375,7 @@ void AutoUpdaterWindow::getLatestTagComplete(s32 status_code, const Error& error
|
||||
emit updateCheckCompleted(false);
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response)
|
||||
void AutoUpdaterDialog::getLatestReleaseComplete(s32 status_code, const Error& error, std::vector<u8> response)
|
||||
{
|
||||
if (status_code == HTTPDownloader::HTTP_STATUS_OK)
|
||||
{
|
||||
@@ -444,15 +444,15 @@ void AutoUpdaterWindow::getLatestReleaseComplete(s32 status_code, const Error& e
|
||||
emit updateCheckCompleted(false);
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::queueGetChanges()
|
||||
void AutoUpdaterDialog::queueGetChanges()
|
||||
{
|
||||
ensureHttpPollingActive();
|
||||
std::string url = fmt::format(CHANGES_URL, g_scm_hash_str, getCurrentUpdateTag());
|
||||
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterWindow::getChangesComplete, this, std::placeholders::_1,
|
||||
m_http->CreateRequest(std::move(url), std::bind(&AutoUpdaterDialog::getChangesComplete, this, std::placeholders::_1,
|
||||
std::placeholders::_2, std::placeholders::_4));
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response)
|
||||
void AutoUpdaterDialog::getChangesComplete(s32 status_code, const Error& error, std::vector<u8> response)
|
||||
{
|
||||
if (status_code == HTTPDownloader::HTTP_STATUS_OK)
|
||||
{
|
||||
@@ -521,7 +521,7 @@ void AutoUpdaterWindow::getChangesComplete(s32 status_code, const Error& error,
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::downloadUpdateClicked()
|
||||
void AutoUpdaterDialog::downloadUpdateClicked()
|
||||
{
|
||||
// Prevent multiple clicks of the button.
|
||||
if (m_download_progress_callback)
|
||||
@@ -579,7 +579,7 @@ void AutoUpdaterWindow::downloadUpdateClicked()
|
||||
m_download_progress_callback);
|
||||
}
|
||||
|
||||
bool AutoUpdaterWindow::updateNeeded() const
|
||||
bool AutoUpdaterDialog::updateNeeded() const
|
||||
{
|
||||
QString last_checked_sha = QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "LastVersion"));
|
||||
|
||||
@@ -596,19 +596,19 @@ bool AutoUpdaterWindow::updateNeeded() const
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::skipThisUpdateClicked()
|
||||
void AutoUpdaterDialog::skipThisUpdateClicked()
|
||||
{
|
||||
Host::SetBaseStringSettingValue("AutoUpdater", "LastVersion", m_latest_sha.toUtf8().constData());
|
||||
Host::CommitBaseSettingChanges();
|
||||
close();
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::remindMeLaterClicked()
|
||||
void AutoUpdaterDialog::remindMeLaterClicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::closeEvent(QCloseEvent* event)
|
||||
void AutoUpdaterDialog::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
emit closed();
|
||||
QWidget::closeEvent(event);
|
||||
@@ -619,7 +619,7 @@ void AutoUpdaterWindow::closeEvent(QCloseEvent* event)
|
||||
static constexpr char UPDATER_EXECUTABLE[] = "updater.exe";
|
||||
static constexpr char UPDATER_ARCHIVE_NAME[] = "update.zip";
|
||||
|
||||
bool AutoUpdaterWindow::doesUpdaterNeedElevation(const std::string& application_dir) const
|
||||
bool AutoUpdaterDialog::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.
|
||||
const std::string dummy_path = Path::Combine(application_dir, "update.txt");
|
||||
@@ -632,7 +632,7 @@ bool AutoUpdaterWindow::doesUpdaterNeedElevation(const std::string& application_
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||
{
|
||||
const std::string& application_dir = EmuFolders::AppRoot;
|
||||
const std::string update_zip_path = Path::Combine(EmuFolders::DataRoot, UPDATER_ARCHIVE_NAME);
|
||||
@@ -669,7 +669,7 @@ bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
return doUpdate(application_dir, update_zip_path, updater_path, program_path);
|
||||
}
|
||||
|
||||
bool AutoUpdaterWindow::extractUpdater(const std::string& zip_path, const std::string& destination_path,
|
||||
bool AutoUpdaterDialog::extractUpdater(const std::string& zip_path, const std::string& destination_path,
|
||||
const std::string_view check_for_file, Error* error)
|
||||
{
|
||||
unzFile zf = MinizipHelpers::OpenUnzFile(zip_path.c_str());
|
||||
@@ -747,7 +747,7 @@ bool AutoUpdaterWindow::extractUpdater(const std::string& zip_path, const std::s
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoUpdaterWindow::doUpdate(const std::string& application_dir, const std::string& zip_path,
|
||||
bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::string& zip_path,
|
||||
const std::string& updater_path, const std::string& program_path)
|
||||
{
|
||||
const std::wstring wupdater_path = StringUtil::UTF8StringToWideString(updater_path);
|
||||
@@ -774,7 +774,7 @@ bool AutoUpdaterWindow::doUpdate(const std::string& application_dir, const std::
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
// If we weren't portable, then updater executable gets left in the application directory.
|
||||
if (EmuFolders::AppRoot == EmuFolders::DataRoot)
|
||||
@@ -796,7 +796,7 @@ void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||
{
|
||||
std::optional<std::string> bundle_path = CocoaTools::GetNonTranslocatedBundlePath();
|
||||
if (!bundle_path.has_value())
|
||||
@@ -857,13 +857,13 @@ bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||
{
|
||||
const char* appimage_path = std::getenv("APPIMAGE");
|
||||
if (!appimage_path || !FileSystem::FileExists(appimage_path))
|
||||
@@ -982,7 +982,7 @@ bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
// Remove old/backup AppImage.
|
||||
const char* appimage_path = std::getenv("APPIMAGE");
|
||||
@@ -1001,12 +1001,12 @@ void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
|
||||
#else
|
||||
|
||||
bool AutoUpdaterWindow::processUpdate(const std::vector<u8>& update_data)
|
||||
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,33 +3,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_autoupdaterdialog.h"
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
#include "ui_autoupdaterwindow.h"
|
||||
|
||||
#include <span>
|
||||
#include <QtCore/QTimer>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
class Error;
|
||||
class HTTPDownloader;
|
||||
class QtProgressCallback;
|
||||
|
||||
class EmuThread;
|
||||
|
||||
class AutoUpdaterWindow final : public QWidget
|
||||
class AutoUpdaterDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~AutoUpdaterWindow();
|
||||
~AutoUpdaterDialog();
|
||||
|
||||
static AutoUpdaterWindow* create(Error* const error);
|
||||
static AutoUpdaterDialog* create(QWidget* const parent, Error* const error);
|
||||
|
||||
void queueUpdateCheck(bool display_errors);
|
||||
void queueGetLatestRelease();
|
||||
@@ -53,7 +49,7 @@ protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
explicit AutoUpdaterWindow(Error* const error);
|
||||
AutoUpdaterDialog(QWidget* const parent, Error* const error);
|
||||
|
||||
void setDownloadSectionVisibility(bool visible);
|
||||
|
||||
@@ -65,7 +61,6 @@ private:
|
||||
void skipThisUpdateClicked();
|
||||
void remindMeLaterClicked();
|
||||
|
||||
|
||||
bool updateNeeded() const;
|
||||
|
||||
void getLatestTagComplete(s32 status_code, const Error& error, std::vector<u8> response, bool display_errors);
|
||||
@@ -84,7 +79,7 @@ private:
|
||||
const std::string_view check_for_file, Error* error);
|
||||
#endif
|
||||
|
||||
Ui::AutoUpdaterWindow m_ui;
|
||||
Ui::AutoUpdaterDialog m_ui;
|
||||
|
||||
std::unique_ptr<HTTPDownloader> m_http;
|
||||
QTimer* m_http_poll_timer = nullptr;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AutoUpdaterWindow</class>
|
||||
<widget class="QWidget" name="AutoUpdaterWindow">
|
||||
<class>AutoUpdaterDialog</class>
|
||||
<widget class="QDialog" name="AutoUpdaterDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -7,7 +7,7 @@
|
||||
<ClCompile Include="achievementlogindialog.cpp" />
|
||||
<ClCompile Include="advancedsettingswidget.cpp" />
|
||||
<ClCompile Include="audiosettingswidget.cpp" />
|
||||
<ClCompile Include="autoupdaterwindow.cpp" />
|
||||
<ClCompile Include="autoupdaterdialog.cpp" />
|
||||
<ClCompile Include="biossettingswidget.cpp" />
|
||||
<ClCompile Include="colorpickerbutton.cpp" />
|
||||
<ClCompile Include="consolesettingswidget.cpp" />
|
||||
@@ -70,7 +70,7 @@
|
||||
<QtMoc Include="advancedsettingswidget.h" />
|
||||
<QtMoc Include="qtprogresscallback.h" />
|
||||
<QtMoc Include="inputbindingdialog.h" />
|
||||
<QtMoc Include="autoupdaterwindow.h" />
|
||||
<QtMoc Include="autoupdaterdialog.h" />
|
||||
<QtMoc Include="debuggermodels.h" />
|
||||
<QtMoc Include="debuggerwindow.h" />
|
||||
<QtMoc Include="achievementsettingswidget.h" />
|
||||
@@ -149,7 +149,7 @@
|
||||
<QtUi Include="inputbindingdialog.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
<QtUi Include="autoupdaterwindow.ui">
|
||||
<QtUi Include="autoupdaterdialog.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
<QtUi Include="achievementsettingswidget.ui">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<ClCompile Include="aboutdialog.cpp" />
|
||||
<ClCompile Include="memorycardsettingswidget.cpp" />
|
||||
<ClCompile Include="inputbindingdialog.cpp" />
|
||||
<ClCompile Include="autoupdaterwindow.cpp" />
|
||||
<ClCompile Include="autoupdaterdialog.cpp" />
|
||||
<ClCompile Include="biossettingswidget.cpp" />
|
||||
<ClCompile Include="memorycardeditorwindow.cpp" />
|
||||
<ClCompile Include="postprocessingsettingswidget.cpp" />
|
||||
@@ -83,7 +83,7 @@
|
||||
<QtMoc Include="aboutdialog.h" />
|
||||
<QtMoc Include="memorycardsettingswidget.h" />
|
||||
<QtMoc Include="inputbindingdialog.h" />
|
||||
<QtMoc Include="autoupdaterwindow.h" />
|
||||
<QtMoc Include="autoupdaterdialog.h" />
|
||||
<QtMoc Include="biossettingswidget.h" />
|
||||
<QtMoc Include="memorycardeditorwindow.h" />
|
||||
<QtMoc Include="postprocessingsettingswidget.h" />
|
||||
@@ -123,7 +123,7 @@
|
||||
<QtUi Include="advancedsettingswidget.ui" />
|
||||
<QtUi Include="aboutdialog.ui" />
|
||||
<QtUi Include="inputbindingdialog.ui" />
|
||||
<QtUi Include="autoupdaterwindow.ui" />
|
||||
<QtUi Include="autoupdaterdialog.ui" />
|
||||
<QtUi Include="biossettingswidget.ui" />
|
||||
<QtUi Include="postprocessingchainconfigwidget.ui" />
|
||||
<QtUi Include="memorycardeditorwindow.ui" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include "interfacesettingswidget.h"
|
||||
#include "autoupdaterwindow.h"
|
||||
#include "autoupdaterdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingswindow.h"
|
||||
@@ -100,10 +100,10 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
||||
m_ui.theme->setSizeAdjustPolicy(m_ui.language->sizeAdjustPolicy());
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true);
|
||||
for (const auto& [name, desc] : AutoUpdaterWindow::getChannelList())
|
||||
for (const auto& [name, desc] : AutoUpdaterDialog::getChannelList())
|
||||
m_ui.autoUpdateTag->addItem(desc, name);
|
||||
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
|
||||
AutoUpdaterWindow::getDefaultTag());
|
||||
AutoUpdaterDialog::getDefaultTag());
|
||||
connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); });
|
||||
|
||||
m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_version_str).arg(g_scm_date_str));
|
||||
@@ -187,7 +187,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
||||
tr("Selects the theme for the application."));
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.autoUpdateTag, tr("Update Channel"),
|
||||
QString::fromStdString(AutoUpdaterWindow::getDefaultTag()),
|
||||
QString::fromStdString(AutoUpdaterDialog::getDefaultTag()),
|
||||
tr("Selects the channel that will be checked for updates to the application. The "
|
||||
"<strong>preview</strong> channel contains the latest changes, and may be unstable. "
|
||||
"The <strong>latest</strong> channel tracks the latest release."));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "achievementlogindialog.h"
|
||||
#include "autoupdaterwindow.h"
|
||||
#include "autoupdaterdialog.h"
|
||||
#include "coverdownloadwindow.h"
|
||||
#include "debuggerwindow.h"
|
||||
#include "displaywidget.h"
|
||||
@@ -3433,7 +3433,7 @@ void MainWindow::checkForUpdates(bool display_message)
|
||||
return;
|
||||
|
||||
Error error;
|
||||
m_auto_updater_dialog = AutoUpdaterWindow::create(&error);
|
||||
m_auto_updater_dialog = AutoUpdaterDialog::create(this, &error);
|
||||
if (!m_auto_updater_dialog)
|
||||
{
|
||||
QtUtils::AsyncMessageBox(
|
||||
@@ -3442,34 +3442,27 @@ void MainWindow::checkForUpdates(bool display_message)
|
||||
return;
|
||||
}
|
||||
|
||||
connect(m_auto_updater_dialog, &AutoUpdaterWindow::closed, this, [this]() {
|
||||
connect(m_auto_updater_dialog, &AutoUpdaterDialog::closed, this, [this]() {
|
||||
if (!m_auto_updater_dialog)
|
||||
return;
|
||||
|
||||
m_auto_updater_dialog->deleteLater();
|
||||
m_auto_updater_dialog = nullptr;
|
||||
});
|
||||
connect(m_auto_updater_dialog, &AutoUpdaterWindow::updateCheckCompleted, this, [this](bool update_available) {
|
||||
connect(m_auto_updater_dialog, &AutoUpdaterDialog::updateCheckCompleted, this, [this](bool update_available) {
|
||||
if (!m_auto_updater_dialog)
|
||||
return;
|
||||
|
||||
if (update_available)
|
||||
{
|
||||
if (isRenderingFullscreen())
|
||||
{
|
||||
// This is truely awful. We have to exit fullscreen to show the dialog, but because it's asynchronous
|
||||
// the fullscreen exit may not have happened yet. So we have to wait for it.
|
||||
g_emu_thread->setFullscreen(false);
|
||||
QTimer::singleShot(500, this, [this]() { QtUtils::ShowOrRaiseWindow(m_auto_updater_dialog, this); });
|
||||
}
|
||||
else
|
||||
{
|
||||
QtUtils::ShowOrRaiseWindow(m_auto_updater_dialog, this);
|
||||
}
|
||||
|
||||
m_auto_updater_dialog->open();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_auto_updater_dialog->disconnect(m_auto_updater_dialog, &AutoUpdaterWindow::closed, this, nullptr);
|
||||
m_auto_updater_dialog->disconnect(m_auto_updater_dialog, &AutoUpdaterDialog::closed, this, nullptr);
|
||||
QtUtils::CloseAndDeleteWindow(m_auto_updater_dialog);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ class QShortcut;
|
||||
class MainWindow;
|
||||
class GameListWidget;
|
||||
class EmuThread;
|
||||
class AutoUpdaterWindow;
|
||||
class AutoUpdaterDialog;
|
||||
class MemoryCardEditorWindow;
|
||||
class DebuggerWindow;
|
||||
class MemoryScannerWindow;
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; }
|
||||
ALWAYS_INLINE QLabel* getStatusFPSWidget() const { return m_status_fps_widget; }
|
||||
ALWAYS_INLINE QLabel* getStatusVPSWidget() const { return m_status_vps_widget; }
|
||||
ALWAYS_INLINE AutoUpdaterWindow* getAutoUpdaterDialog() const { return m_auto_updater_dialog; }
|
||||
ALWAYS_INLINE AutoUpdaterDialog* getAutoUpdaterDialog() const { return m_auto_updater_dialog; }
|
||||
ALWAYS_INLINE DebuggerWindow* getDebuggerWindow() const { return m_debugger_window; }
|
||||
|
||||
/// Opens the editor for a specific input profile.
|
||||
@@ -344,7 +344,7 @@ private:
|
||||
ControllerSettingsWindow* m_controller_settings_window = nullptr;
|
||||
ControllerSettingsWindow* m_input_profile_editor_window = nullptr;
|
||||
|
||||
AutoUpdaterWindow* m_auto_updater_dialog = nullptr;
|
||||
AutoUpdaterDialog* m_auto_updater_dialog = nullptr;
|
||||
MemoryCardEditorWindow* m_memory_card_editor_window = nullptr;
|
||||
DebuggerWindow* m_debugger_window = nullptr;
|
||||
MemoryScannerWindow* m_memory_scanner_window = nullptr;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include "qthost.h"
|
||||
#include "autoupdaterwindow.h"
|
||||
#include "autoupdaterdialog.h"
|
||||
#include "displaywidget.h"
|
||||
#include "logwindow.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -3405,13 +3405,13 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Remove any previous-version remanants.
|
||||
if (s_state.cleanup_after_update)
|
||||
AutoUpdaterWindow::cleanupAfterUpdate();
|
||||
AutoUpdaterDialog::cleanupAfterUpdate();
|
||||
|
||||
// Set theme before creating any windows.
|
||||
QtHost::UpdateApplicationTheme();
|
||||
|
||||
// Build warning.
|
||||
AutoUpdaterWindow::warnAboutUnofficialBuild();
|
||||
AutoUpdaterDialog::warnAboutUnofficialBuild();
|
||||
|
||||
// Start logging early.
|
||||
LogWindow::updateSettings();
|
||||
|
||||
Reference in New Issue
Block a user