diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-07-10 00:47:08 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-07-10 00:47:08 +0200 |
commit | ff06489fed081ed34af63c6ffbdd61e6f917dd3a (patch) | |
tree | 504bddc2c79395dab5a070b35fae9b193e579f7f /gui/pages | |
parent | 08fbfa7434340fc4820738d3cb2c726b28e1a0f1 (diff) | |
download | MultiMC-ff06489fed081ed34af63c6ffbdd61e6f917dd3a.tar MultiMC-ff06489fed081ed34af63c6ffbdd61e6f917dd3a.tar.gz MultiMC-ff06489fed081ed34af63c6ffbdd61e6f917dd3a.tar.lz MultiMC-ff06489fed081ed34af63c6ffbdd61e6f917dd3a.tar.xz MultiMC-ff06489fed081ed34af63c6ffbdd61e6f917dd3a.zip |
Do not show core mods page for minecraft newer than 1.5.2.
Diffstat (limited to 'gui/pages')
-rw-r--r-- | gui/pages/ModFolderPage.cpp | 26 | ||||
-rw-r--r-- | gui/pages/ModFolderPage.h | 10 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gui/pages/ModFolderPage.cpp b/gui/pages/ModFolderPage.cpp index 7e0eea52..7702dbdd 100644 --- a/gui/pages/ModFolderPage.cpp +++ b/gui/pages/ModFolderPage.cpp @@ -31,6 +31,7 @@ #include "logic/ModList.h" #include "logic/Mod.h" +#include <logic/VersionFilterData.h> QString ModFolderPage::displayName() { @@ -66,6 +67,13 @@ ModFolderPage::ModFolderPage(BaseInstance * inst, std::shared_ptr<ModList> mods, SLOT(modCurrent(QModelIndex, QModelIndex))); } +CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, + QString id, QString iconName, QString displayName, + QString helpPage, QWidget *parent) + : ModFolderPage(inst, mods, id, iconName, displayName, helpPage, parent) +{ +} + ModFolderPage::~ModFolderPage() { m_mods->stopWatching(); @@ -79,6 +87,24 @@ bool ModFolderPage::shouldDisplay() return true; } +bool CoreModFolderPage::shouldDisplay() +{ + if (ModFolderPage::shouldDisplay()) + { + auto inst = dynamic_cast<OneSixInstance*>(m_inst); + if(!inst) + return true; + auto version = inst->getFullVersion(); + if(!version) + return true; + if(version->m_releaseTime < g_VersionFilterData.legacyCutoffDate) + { + return true; + } + } + return false; +} + bool ModFolderPage::modListFilter(QKeyEvent *keyEvent) { switch (keyEvent->key()) diff --git a/gui/pages/ModFolderPage.h b/gui/pages/ModFolderPage.h index c193f4c1..13ae97f5 100644 --- a/gui/pages/ModFolderPage.h +++ b/gui/pages/ModFolderPage.h @@ -61,3 +61,13 @@ private slots: void on_rmModBtn_clicked(); void on_viewModBtn_clicked(); }; + +class CoreModFolderPage : public ModFolderPage +{ +public: + explicit CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id, + QString iconName, QString displayName, QString helpPage = "", + QWidget *parent = 0); + virtual ~CoreModFolderPage(){}; + virtual bool shouldDisplay(); +}; |