gui: improve graphic pack download buttons

I made the download URL button work the same as the regular download community buttons did. Also styled it a bit differently to make it less prominent.
This commit is contained in:
Crementif 2026-05-15 00:58:10 +02:00
parent 8e3e961b8e
commit 2fd322ecf7
3 changed files with 15 additions and 14 deletions

View File

@ -121,12 +121,6 @@ DownloadCustomGraphicPackWindow::~DownloadCustomGraphicPackWindow()
int DownloadCustomGraphicPackWindow::ShowModal()
{
if (CafeSystem::IsTitleRunning())
{
wxMessageBox(_("Graphic packs cannot be updated while a game is running."), _("Graphic packs"), 5, this);
return wxID_CANCEL;
}
wxDialog::ShowModal();
return wxID_OK;
}

View File

@ -304,13 +304,13 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil
auto* row = new wxBoxSizer(wxHORIZONTAL);
m_download_from_url = new wxButton(m_right_panel, wxID_ANY, _("Download pack from URL"));
m_download_from_url->Bind(wxEVT_BUTTON, &GraphicPacksWindow2::OnClickCustomDownload, this);
row->Add(m_download_from_url, 0, wxALL, 5);
m_update_graphicPacks = new wxButton(m_right_panel, wxID_ANY, _("Download latest community graphic packs"));
m_update_graphicPacks->Bind(wxEVT_BUTTON, &GraphicPacksWindow2::OnCheckForUpdates, this);
row->Add(m_update_graphicPacks, 0, wxALL, 5);
row->Add(m_update_graphicPacks, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
m_download_from_url = new wxHyperlinkCtrl(m_right_panel, wxID_ANY, _("Or download pack from URL..."), _(""));
m_download_from_url->Bind(wxEVT_HYPERLINK, &GraphicPacksWindow2::OnClickCustomDownload, this);
row->Add(m_download_from_url, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
sizer->Add(row, 0, wxALL | wxEXPAND, 5);
@ -608,7 +608,7 @@ void GraphicPacksWindow2::OnReloadShaders(wxCommandEvent& event)
void GraphicPacksWindow2::OnClickCustomDownload(wxCommandEvent& event)
{
DownloadCustomGraphicPackWindow frame(this);
if (frame.ShowModal() == wxID_OK && !CafeSystem::IsTitleRunning())
if (frame.ShowModal() == wxID_OK)
{
RefreshGraphicPacks();
FillGraphicPackList();
@ -700,10 +700,17 @@ void GraphicPacksWindow2::OnInstalledGamesChanged(wxCommandEvent& event)
void GraphicPacksWindow2::UpdateTitleRunning(bool running)
{
m_update_graphicPacks->Enable(!running);
m_download_from_url->Enable(!running);
if(running)
{
m_download_from_url->SetToolTip(_("Graphic packs cannot be updated while a game is running."));
m_update_graphicPacks->SetToolTip(_("Graphic packs cannot be updated while a game is running."));
}
else
{
m_update_graphicPacks->SetToolTip(nullptr);
m_download_from_url->SetToolTip(nullptr);
}
}
void GraphicPacksWindow2::ReloadPack(const GraphicPackPtr& graphic_pack) const

View File

@ -1,9 +1,9 @@
#pragma once
#include <wx/frame.h>
#include <wx/dialog.h>
#include <wx/scrolwin.h>
#include <wx/infobar.h>
#include <wx/hyperlink.h>
#include "wxcomponents/checktree.h"
@ -46,7 +46,7 @@ private:
wxBoxSizer* m_preset_sizer;
std::vector<wxChoice*> m_active_preset;
wxButton* m_reload_shaders;
wxButton* m_download_from_url;
wxHyperlinkCtrl* m_download_from_url;
wxButton* m_update_graphicPacks;
wxInfoBar* m_info_bar;