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");

View File

@ -51,6 +51,7 @@ public:
private slots:
void on_actionChange_version_triggered();
void on_actionInstall_Forge_triggered();
void on_actionInstall_NeoForge_triggered();
void on_actionInstall_Fabric_triggered();
void on_actionInstall_Quilt_triggered();
void on_actionAdd_Empty_triggered();

View File

@ -106,6 +106,7 @@
<addaction name="actionRevert"/>
<addaction name="separator"/>
<addaction name="actionInstall_Forge"/>
<addaction name="actionInstall_NeoForge"/>
<addaction name="actionInstall_Fabric"/>
<addaction name="actionInstall_Quilt"/>
<addaction name="actionInstall_LiteLoader"/>
@ -270,6 +271,14 @@
<string>Open the instance's local libraries folder.</string>
</property>
</action>
<action name="actionInstall_NeoForge">
<property name="text">
<string>Install NeoForge</string>
</property>
<property name="toolTip">
<string>Install the NeoForge package.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>