GraphicPacksWindow: Disable update button when a game is running (#1137)

This commit is contained in:
goeiecool9999 2024-03-26 13:09:24 +01:00 committed by GitHub
parent 111e383d1b
commit 4f3d4624f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 11 deletions

View file

@ -110,14 +110,6 @@ void deleteDownloadedGraphicPacks()
void DownloadGraphicPacksWindow::UpdateThread()
{
if (CafeSystem::IsTitleRunning())
{
wxMessageBox(_("Graphic packs cannot be updated while a game is running."), _("Graphic packs"), 5, this->GetParent());
// cancel update
m_threadState = ThreadFinished;
return;
}
// get github url
std::string githubAPIUrl;
curlDownloadFileState_t tempDownloadState;
@ -326,8 +318,6 @@ DownloadGraphicPacksWindow::DownloadGraphicPacksWindow(wxWindow* parent)
m_downloadState = std::make_unique<curlDownloadFileState_t>();
m_thread = std::thread(&DownloadGraphicPacksWindow::UpdateThread, this);
}
DownloadGraphicPacksWindow::~DownloadGraphicPacksWindow()
@ -344,6 +334,12 @@ const std::string& DownloadGraphicPacksWindow::GetException() const
int DownloadGraphicPacksWindow::ShowModal()
{
if(CafeSystem::IsTitleRunning())
{
wxMessageBox(_("Graphic packs cannot be updated while a game is running."), _("Graphic packs"), 5, this->GetParent());
return wxID_CANCEL;
}
m_thread = std::thread(&DownloadGraphicPacksWindow::UpdateThread, this);
wxDialog::ShowModal();
return m_threadState == ThreadCanceled ? wxID_CANCEL : wxID_OK;
}