Do not show core mods page for minecraft newer than 1.5.2.

This commit is contained in:
Petr Mrázek 2014-07-10 00:47:08 +02:00
parent 08fbfa7434
commit ff06489fed
3 changed files with 40 additions and 4 deletions

View File

@ -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())

View File

@ -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();
};

View File

@ -63,10 +63,10 @@ QList<BasePage *> OneSixInstance::getPages()
{
QList<BasePage *> values;
values.append(new VersionPage(this));
values.append(new ModFolderPage(this, loaderModList(), "mods", "plugin-blue", tr("Loader mods"),
"Loader-mods"));
values.append(new ModFolderPage(this, coreModList(), "coremods", "plugin-green", tr("Core mods"),
"Core-mods"));
values.append(new ModFolderPage(this, loaderModList(), "mods", "plugin-blue",
tr("Loader mods"), "Loader-mods"));
values.append(new CoreModFolderPage(this, coreModList(), "coremods", "plugin-green",
tr("Core mods"), "Core-mods"));
values.append(new ResourcePackPage(this));
values.append(new TexturePackPage(this));
values.append(new NotesPage(this));