mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
fix pack upgrade
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
6b9d2dbb64
commit
b7344af313
2 changed files with 13 additions and 14 deletions
|
|
@ -924,23 +924,23 @@ class InstanceStaging : public Task {
|
||||||
connect(child, &Task::progress, this, &InstanceStaging::setProgress);
|
connect(child, &Task::progress, this, &InstanceStaging::setProgress);
|
||||||
connect(child, &Task::stepProgress, this, &InstanceStaging::propagateStepProgress);
|
connect(child, &Task::stepProgress, this, &InstanceStaging::propagateStepProgress);
|
||||||
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceeded);
|
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceeded);
|
||||||
m_backoffTimer.setSingleShot(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~InstanceStaging() {}
|
~InstanceStaging() override = default;
|
||||||
|
|
||||||
// FIXME/TODO: add ability to abort during instance commit retries
|
// FIXME/TODO: add ability to abort during instance commit retries
|
||||||
bool abort() override
|
bool abort() override
|
||||||
{
|
{
|
||||||
if (!canAbort())
|
if (!canAbort()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return m_child->abort();
|
return m_child->abort();
|
||||||
}
|
}
|
||||||
bool canAbort() const override { return (m_child && m_child->canAbort()); }
|
bool canAbort() const override { return (m_child && m_child->canAbort()); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void executeTask() override
|
void executeTask() override
|
||||||
{
|
{
|
||||||
if (m_stagingPath.isNull()) {
|
if (m_stagingPath.isNull()) {
|
||||||
emitFailed(tr("Could not create staging folder"));
|
emitFailed(tr("Could not create staging folder"));
|
||||||
|
|
@ -954,10 +954,8 @@ class InstanceStaging : public Task {
|
||||||
private slots:
|
private slots:
|
||||||
void childSucceeded()
|
void childSucceeded()
|
||||||
{
|
{
|
||||||
if (!isRunning())
|
|
||||||
return;
|
|
||||||
unsigned sleepTime = backoff();
|
unsigned sleepTime = backoff();
|
||||||
if (m_parent->commitStagedInstance(m_stagingPath, *m_child.get(), m_child->group(), *m_child.get())) {
|
if (m_parent->commitStagedInstance(m_stagingPath, *m_child, m_child->group(), *m_child)) {
|
||||||
m_backoffTimer.stop();
|
m_backoffTimer.stop();
|
||||||
emitSucceeded();
|
emitSucceeded();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -202,23 +202,24 @@ bool ManagedPackPage::runUpdateTask(InstanceTask* task)
|
||||||
|
|
||||||
unique_qobject_ptr<Task> wrapped_task(APPLICATION->instances()->wrapInstanceTask(task));
|
unique_qobject_ptr<Task> wrapped_task(APPLICATION->instances()->wrapInstanceTask(task));
|
||||||
|
|
||||||
connect(task, &Task::failed,
|
connect(wrapped_task.get(), &Task::failed,
|
||||||
[this](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); });
|
[this](const QString& reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); });
|
||||||
connect(task, &Task::succeeded, [this, task]() {
|
connect(wrapped_task.get(), &Task::succeeded, [this, task]() {
|
||||||
QStringList warnings = task->warnings();
|
QStringList warnings = task->warnings();
|
||||||
if (warnings.count())
|
if (warnings.count()) {
|
||||||
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
|
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(task, &Task::aborted, [this] {
|
connect(wrapped_task.get(), &Task::aborted, [this] {
|
||||||
CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)
|
CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)
|
||||||
->show();
|
->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
ProgressDialog loadDialog(this);
|
ProgressDialog loadDialog(this);
|
||||||
loadDialog.setSkipButton(true, tr("Abort"));
|
loadDialog.setSkipButton(true, tr("Abort"));
|
||||||
loadDialog.execWithTask(task);
|
loadDialog.execWithTask(wrapped_task.get());
|
||||||
|
|
||||||
return task->wasSuccessful();
|
return wrapped_task->wasSuccessful();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManagedPackPage::suggestVersion()
|
void ManagedPackPage::suggestVersion()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue