diff options
Diffstat (limited to 'application/pages')
-rw-r--r-- | application/pages/BasePage.h | 8 | ||||
-rw-r--r-- | application/pages/BasePageContainer.h | 1 | ||||
-rw-r--r-- | application/pages/LegacyUpgradePage.cpp | 5 | ||||
-rw-r--r-- | application/pages/LogPage.cpp | 7 | ||||
-rw-r--r-- | application/pages/LogPage.h | 2 | ||||
-rw-r--r-- | application/pages/VersionPage.cpp | 5 | ||||
-rw-r--r-- | application/pages/VersionPage.h | 3 |
7 files changed, 12 insertions, 19 deletions
diff --git a/application/pages/BasePage.h b/application/pages/BasePage.h index 1d6e4bd0..6c580a17 100644 --- a/application/pages/BasePage.h +++ b/application/pages/BasePage.h @@ -33,11 +33,15 @@ public: virtual QString helpPage() const { return QString(); } virtual void opened() {} virtual void closed() {} - virtual void setParentContainer(BasePageContainer *) {}; - + virtual void setParentContainer(BasePageContainer * container) + { + m_container = container; + }; public: int stackIndex = -1; int listIndex = -1; +protected: + BasePageContainer * m_container = nullptr; }; typedef std::shared_ptr<BasePage> BasePagePtr; diff --git a/application/pages/BasePageContainer.h b/application/pages/BasePageContainer.h index 660685d3..ff7315c2 100644 --- a/application/pages/BasePageContainer.h +++ b/application/pages/BasePageContainer.h @@ -6,4 +6,5 @@ public: virtual ~BasePageContainer(){}; virtual bool selectPage(QString pageId) = 0; virtual void refreshContainer() = 0; + virtual bool requestClose() = 0; }; diff --git a/application/pages/LegacyUpgradePage.cpp b/application/pages/LegacyUpgradePage.cpp index c1ad0146..a8f4a08c 100644 --- a/application/pages/LegacyUpgradePage.cpp +++ b/application/pages/LegacyUpgradePage.cpp @@ -27,7 +27,10 @@ void LegacyUpgradePage::runModalTask(Task *task) }); ProgressDialog loadDialog(this); loadDialog.setSkipButton(true, tr("Abort")); - loadDialog.execWithTask(task); + if(loadDialog.execWithTask(task) == QDialog::Accepted) + { + m_container->requestClose(); + } } void LegacyUpgradePage::on_upgradeButton_clicked() diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp index 75e1df7d..025d902b 100644 --- a/application/pages/LogPage.cpp +++ b/application/pages/LogPage.cpp @@ -218,7 +218,7 @@ void LogPage::on_btnClear_clicked() if(!m_model) return; m_model->clear(); - m_parentContainer->refreshContainer(); + m_container->refreshContainer(); } void LogPage::on_btnBottom_clicked() @@ -262,8 +262,3 @@ void LogPage::findActivated() ui->searchBar->selectAll(); } } - -void LogPage::setParentContainer(BasePageContainer * container) -{ - m_parentContainer = container; -} diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h index 8dceb94f..7346f93f 100644 --- a/application/pages/LogPage.h +++ b/application/pages/LogPage.h @@ -54,7 +54,6 @@ public: return "Minecraft-Logs"; } virtual bool shouldDisplay() const override; - virtual void setParentContainer(BasePageContainer *) override; private slots: void on_btnPaste_clicked(); @@ -77,7 +76,6 @@ private: InstancePtr m_instance; std::shared_ptr<LaunchTask> m_process; - BasePageContainer * m_parentContainer; LogFormatProxyModel * m_proxy; shared_qobject_ptr <LogModel> m_model; }; diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index 343e1d2a..c915b42b 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -98,11 +98,6 @@ bool VersionPage::shouldDisplay() const return !m_inst->isRunning(); } -void VersionPage::setParentContainer(BasePageContainer * container) -{ - m_container = container; -} - VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) : QWidget(parent), ui(new Ui::VersionPage), m_inst(inst) { diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h index dff3abd6..0017be5c 100644 --- a/application/pages/VersionPage.h +++ b/application/pages/VersionPage.h @@ -48,8 +48,6 @@ public: } virtual bool shouldDisplay() const override; - virtual void setParentContainer(BasePageContainer *) override; - private slots: void on_forgeBtn_clicked(); void on_liteloaderBtn_clicked(); @@ -85,7 +83,6 @@ private: std::shared_ptr<MinecraftProfile> m_profile; MinecraftInstance *m_inst; int currentIdx = 0; - BasePageContainer * m_container = nullptr; public slots: void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous); |