Qt: Do not allow updates during emulation

This commit is contained in:
Megamouse 2021-03-06 21:32:36 +01:00 committed by Ivan
parent dab53f4e41
commit 3ae7debc17
2 changed files with 9 additions and 5 deletions

View file

@ -1994,11 +1994,6 @@ void main_window::CreateConnects()
QMessageBox::warning(this, tr("Auto-updater"), tr("The auto-updater currently isn't available for your os.")); QMessageBox::warning(this, tr("Auto-updater"), tr("The auto-updater currently isn't available for your os."));
return; return;
#endif #endif
if(!Emu.IsStopped())
{
QMessageBox::warning(this, tr("Auto-updater"), tr("Please stop the emulation before trying to update."));
return;
}
m_updater.check_for_updates(false, false, this); m_updater.check_for_updates(false, false, this);
}); });

View file

@ -229,6 +229,8 @@ bool update_manager::handle_json(bool automatic, bool check_only, const QByteArr
void update_manager::update() void update_manager::update()
{ {
ensure(m_downloader);
if (m_update_message.isEmpty() || if (m_update_message.isEmpty() ||
QMessageBox::question(m_downloader->get_progress_dialog(), tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) QMessageBox::question(m_downloader->get_progress_dialog(), tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{ {
@ -236,6 +238,13 @@ void update_manager::update()
return; return;
} }
if (!Emu.IsStopped())
{
m_downloader->close_progress_dialog();
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("Please stop the emulation before trying to update."));
return;
}
m_downloader->disconnect(); m_downloader->disconnect();
connect(m_downloader, &downloader::signal_download_error, this, [this](const QString& /*error*/) connect(m_downloader, &downloader::signal_download_error, this, [this](const QString& /*error*/)