From feb6f285ce427ef218c925e5416ad7dc7ad67602 Mon Sep 17 00:00:00 2001 From: flow Date: Fri, 18 Nov 2022 15:23:28 -0300 Subject: [PATCH] feat(ManagedPackPage): add reload button when in a fail state Signed-off-by: flow --- launcher/ui/pages/instance/ManagedPackPage.cpp | 10 +++++++++- launcher/ui/pages/instance/ManagedPackPage.ui | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index 8b0f715d..10182b8b 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -61,6 +61,14 @@ ManagedPackPage::ManagedPackPage(BaseInstance* inst, InstanceWindow* instance_wi ui->setupUi(this); ui->versionsComboBox->setStyle(new NoBigComboBoxStyle(ui->versionsComboBox->style())); + + ui->reloadButton->setVisible(false); + connect(ui->reloadButton, &QPushButton::clicked, this, [this](bool){ + ui->reloadButton->setVisible(false); + + // Pretend we're opening the page again + openedImpl(); + }); } ManagedPackPage::~ManagedPackPage() @@ -154,7 +162,7 @@ void ManagedPackPage::setFailState() ui->updateButton->setText(tr("Cannot update!")); ui->updateButton->setDisabled(true); - // TODO: Perhaps start a timer here when m_loaded is false to try and reload. + ui->reloadButton->setVisible(true); } ModrinthManagedPackPage::ModrinthManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent) diff --git a/launcher/ui/pages/instance/ManagedPackPage.ui b/launcher/ui/pages/instance/ManagedPackPage.ui index b7c91798..bbe44a94 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.ui +++ b/launcher/ui/pages/instance/ManagedPackPage.ui @@ -179,6 +179,13 @@ + + + + Reload page + + +