diff options
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(); +}; |