Merge pull request #1035 from Scrumplex/fix-coremods

Make Coremods / Mods seperation more clear
This commit is contained in:
flow 2022-08-20 10:15:50 -03:00 committed by GitHub
commit 2dcff83be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 26 deletions

View File

@ -112,10 +112,6 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel>
} }
} }
CoreModFolderPage::CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent)
: ModFolderPage(inst, mods, parent)
{}
void ModFolderPage::runningStateChanged(bool running) void ModFolderPage::runningStateChanged(bool running)
{ {
ExternalResourcesPage::runningStateChanged(running); ExternalResourcesPage::runningStateChanged(running);
@ -128,27 +124,6 @@ bool ModFolderPage::shouldDisplay() const
return true; return true;
} }
bool CoreModFolderPage::shouldDisplay() const
{
if (ModFolderPage::shouldDisplay()) {
auto inst = dynamic_cast<MinecraftInstance*>(m_instance);
if (!inst)
return true;
auto version = inst->getPackProfile();
if (!version)
return true;
if (!version->getComponent("net.minecraftforge"))
return false;
if (!version->getComponent("net.minecraft"))
return false;
if (version->getComponent("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
return true;
}
return false;
}
void ModFolderPage::installMods() void ModFolderPage::installMods()
{ {
if (!m_controlsEnabled) if (!m_controlsEnabled)
@ -252,3 +227,28 @@ void ModFolderPage::updateMods()
m_model->update(); m_model->update();
} }
} }
CoreModFolderPage::CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent)
: ModFolderPage(inst, mods, parent)
{}
bool CoreModFolderPage::shouldDisplay() const
{
if (ModFolderPage::shouldDisplay()) {
auto inst = dynamic_cast<MinecraftInstance*>(m_instance);
if (!inst)
return true;
auto version = inst->getPackProfile();
if (!version)
return true;
if (!version->getComponent("net.minecraftforge"))
return false;
if (!version->getComponent("net.minecraft"))
return false;
if (version->getComponent("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
return true;
}
return false;
}

View File

@ -64,5 +64,11 @@ class CoreModFolderPage : public ModFolderPage {
public: public:
explicit CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0); explicit CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0);
virtual ~CoreModFolderPage() = default; virtual ~CoreModFolderPage() = default;
virtual bool shouldDisplay() const;
virtual QString displayName() const override { return tr("Core mods"); }
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); }
virtual QString id() const override { return "coremods"; }
virtual QString helpPage() const override { return "Core-mods"; }
virtual bool shouldDisplay() const override;
}; };