NOISSUE implement LEgacy instance migration
This commit is contained in:
@ -2,8 +2,13 @@
|
||||
#include "ui_LegacyUpgradePage.h"
|
||||
|
||||
#include "minecraft/legacy/LegacyInstance.h"
|
||||
#include "minecraft/legacy/LegacyUpgradeTask.h"
|
||||
#include "MultiMC.h"
|
||||
#include "FolderInstanceProvider.h"
|
||||
#include "dialogs/CustomMessageBox.h"
|
||||
#include "dialogs/ProgressDialog.h"
|
||||
|
||||
LegacyUpgradePage::LegacyUpgradePage(LegacyInstance *inst, QWidget *parent)
|
||||
LegacyUpgradePage::LegacyUpgradePage(InstancePtr inst, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::LegacyUpgradePage), m_inst(inst)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -14,9 +19,21 @@ LegacyUpgradePage::~LegacyUpgradePage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LegacyUpgradePage::runModalTask(Task *task)
|
||||
{
|
||||
connect(task, &Task::failed, [this](QString reason)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Warning)->show();
|
||||
});
|
||||
ProgressDialog loadDialog(this);
|
||||
loadDialog.setSkipButton(true, tr("Abort"));
|
||||
loadDialog.execWithTask(task);
|
||||
}
|
||||
|
||||
void LegacyUpgradePage::on_upgradeButton_clicked()
|
||||
{
|
||||
// now what?
|
||||
std::unique_ptr<Task> task(MMC->folderProvider()->legacyUpgradeTask(m_inst));
|
||||
runModalTask(task.get());
|
||||
}
|
||||
|
||||
bool LegacyUpgradePage::shouldDisplay() const
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "minecraft/legacy/LegacyInstance.h"
|
||||
#include "pages/BasePage.h"
|
||||
#include <MultiMC.h>
|
||||
#include "tasks/Task.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -31,7 +32,7 @@ class LegacyUpgradePage : public QWidget, public BasePage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LegacyUpgradePage(LegacyInstance *inst, QWidget *parent = 0);
|
||||
explicit LegacyUpgradePage(InstancePtr inst, QWidget *parent = 0);
|
||||
virtual ~LegacyUpgradePage();
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
@ -50,11 +51,14 @@ public:
|
||||
return "Legacy-upgrade";
|
||||
}
|
||||
virtual bool shouldDisplay() const override;
|
||||
private
|
||||
slots:
|
||||
|
||||
private slots:
|
||||
void on_upgradeButton_clicked();
|
||||
|
||||
private:
|
||||
void runModalTask(Task *task);
|
||||
|
||||
private:
|
||||
Ui::LegacyUpgradePage *ui;
|
||||
LegacyInstance *m_inst;
|
||||
InstancePtr m_inst;
|
||||
};
|
||||
|
Reference in New Issue
Block a user