NOISSUE Legacy migration success now closes the instance window
This commit is contained in:
parent
719f112f64
commit
1a38587877
@ -48,6 +48,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent)
|
|||||||
{
|
{
|
||||||
auto provider = std::make_shared<InstancePageProvider>(m_instance);
|
auto provider = std::make_shared<InstancePageProvider>(m_instance);
|
||||||
m_container = new PageContainer(provider, "console", this);
|
m_container = new PageContainer(provider, "console", this);
|
||||||
|
m_container->setParentContainer(this);
|
||||||
setCentralWidget(m_container);
|
setCentralWidget(m_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,3 +214,13 @@ void InstanceWindow::refreshContainer()
|
|||||||
InstanceWindow::~InstanceWindow()
|
InstanceWindow::~InstanceWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InstanceWindow::requestClose()
|
||||||
|
{
|
||||||
|
if(m_container->prepareToClose())
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -40,6 +40,9 @@ public:
|
|||||||
// save all settings and changes (prepare for launch)
|
// save all settings and changes (prepare for launch)
|
||||||
bool saveAll();
|
bool saveAll();
|
||||||
|
|
||||||
|
// request closing the window (from a page)
|
||||||
|
bool requestClose() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void isClosing();
|
void isClosing();
|
||||||
|
|
||||||
|
@ -33,11 +33,15 @@ public:
|
|||||||
virtual QString helpPage() const { return QString(); }
|
virtual QString helpPage() const { return QString(); }
|
||||||
virtual void opened() {}
|
virtual void opened() {}
|
||||||
virtual void closed() {}
|
virtual void closed() {}
|
||||||
virtual void setParentContainer(BasePageContainer *) {};
|
virtual void setParentContainer(BasePageContainer * container)
|
||||||
|
{
|
||||||
|
m_container = container;
|
||||||
|
};
|
||||||
public:
|
public:
|
||||||
int stackIndex = -1;
|
int stackIndex = -1;
|
||||||
int listIndex = -1;
|
int listIndex = -1;
|
||||||
|
protected:
|
||||||
|
BasePageContainer * m_container = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<BasePage> BasePagePtr;
|
typedef std::shared_ptr<BasePage> BasePagePtr;
|
||||||
|
@ -6,4 +6,5 @@ public:
|
|||||||
virtual ~BasePageContainer(){};
|
virtual ~BasePageContainer(){};
|
||||||
virtual bool selectPage(QString pageId) = 0;
|
virtual bool selectPage(QString pageId) = 0;
|
||||||
virtual void refreshContainer() = 0;
|
virtual void refreshContainer() = 0;
|
||||||
|
virtual bool requestClose() = 0;
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,10 @@ void LegacyUpgradePage::runModalTask(Task *task)
|
|||||||
});
|
});
|
||||||
ProgressDialog loadDialog(this);
|
ProgressDialog loadDialog(this);
|
||||||
loadDialog.setSkipButton(true, tr("Abort"));
|
loadDialog.setSkipButton(true, tr("Abort"));
|
||||||
loadDialog.execWithTask(task);
|
if(loadDialog.execWithTask(task) == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
m_container->requestClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegacyUpgradePage::on_upgradeButton_clicked()
|
void LegacyUpgradePage::on_upgradeButton_clicked()
|
||||||
|
@ -218,7 +218,7 @@ void LogPage::on_btnClear_clicked()
|
|||||||
if(!m_model)
|
if(!m_model)
|
||||||
return;
|
return;
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
m_parentContainer->refreshContainer();
|
m_container->refreshContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogPage::on_btnBottom_clicked()
|
void LogPage::on_btnBottom_clicked()
|
||||||
@ -262,8 +262,3 @@ void LogPage::findActivated()
|
|||||||
ui->searchBar->selectAll();
|
ui->searchBar->selectAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogPage::setParentContainer(BasePageContainer * container)
|
|
||||||
{
|
|
||||||
m_parentContainer = container;
|
|
||||||
}
|
|
||||||
|
@ -54,7 +54,6 @@ public:
|
|||||||
return "Minecraft-Logs";
|
return "Minecraft-Logs";
|
||||||
}
|
}
|
||||||
virtual bool shouldDisplay() const override;
|
virtual bool shouldDisplay() const override;
|
||||||
virtual void setParentContainer(BasePageContainer *) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btnPaste_clicked();
|
void on_btnPaste_clicked();
|
||||||
@ -77,7 +76,6 @@ private:
|
|||||||
InstancePtr m_instance;
|
InstancePtr m_instance;
|
||||||
std::shared_ptr<LaunchTask> m_process;
|
std::shared_ptr<LaunchTask> m_process;
|
||||||
|
|
||||||
BasePageContainer * m_parentContainer;
|
|
||||||
LogFormatProxyModel * m_proxy;
|
LogFormatProxyModel * m_proxy;
|
||||||
shared_qobject_ptr <LogModel> m_model;
|
shared_qobject_ptr <LogModel> m_model;
|
||||||
};
|
};
|
||||||
|
@ -98,11 +98,6 @@ bool VersionPage::shouldDisplay() const
|
|||||||
return !m_inst->isRunning();
|
return !m_inst->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VersionPage::setParentContainer(BasePageContainer * container)
|
|
||||||
{
|
|
||||||
m_container = container;
|
|
||||||
}
|
|
||||||
|
|
||||||
VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
|
VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
|
||||||
: QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
|
: QWidget(parent), ui(new Ui::VersionPage), m_inst(inst)
|
||||||
{
|
{
|
||||||
|
@ -48,8 +48,6 @@ public:
|
|||||||
}
|
}
|
||||||
virtual bool shouldDisplay() const override;
|
virtual bool shouldDisplay() const override;
|
||||||
|
|
||||||
virtual void setParentContainer(BasePageContainer *) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_forgeBtn_clicked();
|
void on_forgeBtn_clicked();
|
||||||
void on_liteloaderBtn_clicked();
|
void on_liteloaderBtn_clicked();
|
||||||
@ -85,7 +83,6 @@ private:
|
|||||||
std::shared_ptr<MinecraftProfile> m_profile;
|
std::shared_ptr<MinecraftProfile> m_profile;
|
||||||
MinecraftInstance *m_inst;
|
MinecraftInstance *m_inst;
|
||||||
int currentIdx = 0;
|
int currentIdx = 0;
|
||||||
BasePageContainer * m_container = nullptr;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous);
|
void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
|
@ -47,9 +47,23 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool prepareToClose();
|
bool prepareToClose();
|
||||||
|
|
||||||
|
/* request close - used by individual pages */
|
||||||
|
bool requestClose() override
|
||||||
|
{
|
||||||
|
if(m_container)
|
||||||
|
{
|
||||||
|
return m_container->requestClose();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool selectPage(QString pageId) override;
|
virtual bool selectPage(QString pageId) override;
|
||||||
|
|
||||||
void refreshContainer() override;
|
void refreshContainer() override;
|
||||||
|
virtual void setParentContainer(BasePageContainer * container)
|
||||||
|
{
|
||||||
|
m_container = container;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createUI();
|
void createUI();
|
||||||
@ -60,6 +74,7 @@ slots:
|
|||||||
void help();
|
void help();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BasePageContainer * m_container = nullptr;
|
||||||
BasePage * m_currentPage = 0;
|
BasePage * m_currentPage = 0;
|
||||||
QSortFilterProxyModel *m_proxyModel;
|
QSortFilterProxyModel *m_proxyModel;
|
||||||
PageModel *m_model;
|
PageModel *m_model;
|
||||||
|
Loading…
Reference in New Issue
Block a user