GH-5232 Add Install NeoForge button (WIP)

This commit is contained in:
arthomnix
2024-01-10 22:02:18 +00:00
parent 7450faaf13
commit b69ab34f4b
3 changed files with 39 additions and 0 deletions

View File

@@ -444,6 +444,35 @@ void VersionPage::on_actionInstall_Forge_triggered()
}
}
void VersionPage::on_actionInstall_NeoForge_triggered()
{
auto vlist = APPLICATION->metadataIndex()->get("net.neoforged");
if(!vlist)
{
return;
}
VersionSelectDialog vselect(vlist.get(), tr("Select NeoForge version"), this);
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
vselect.setEmptyString(tr("No NeoForge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
vselect.setEmptyErrorString(tr("Couldn't load or download the NeoForge version lists!"));
auto currentVersion = m_profile->getComponentVersion("net.neoforged");
if(!currentVersion.isEmpty())
{
vselect.setCurrentVersion(currentVersion);
}
if (vselect.exec() && vselect.selectedVersion())
{
auto vsn = vselect.selectedVersion();
m_profile->setComponentVersion("net.neoforged", vsn->descriptor());
m_profile->resolve(Net::Mode::Online);
// m_profile->installVersion();
preselect(m_profile->rowCount(QModelIndex())-1);
m_container->refreshContainer();
}
}
void VersionPage::on_actionInstall_Fabric_triggered()
{
auto vlist = APPLICATION->metadataIndex()->get("net.fabricmc.fabric-loader");