GH-2639 Add simple fabric loader installation support
This commit is contained in:
parent
83c48a0f1a
commit
6c30076b6c
@ -586,6 +586,15 @@ void ComponentUpdateTask::resolveDependencies(bool checkOnly)
|
|||||||
{
|
{
|
||||||
component->m_version = "3.1.2";
|
component->m_version = "3.1.2";
|
||||||
}
|
}
|
||||||
|
else if (add.uid == "net.fabricmc.intermediary")
|
||||||
|
{
|
||||||
|
auto minecraft = std::find_if(components.begin(), components.end(), [](ComponentPtr & cmp){
|
||||||
|
return cmp->getID() == "net.minecraft";
|
||||||
|
});
|
||||||
|
if(minecraft != components.end()) {
|
||||||
|
component->m_version = (*minecraft)->getVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded.
|
// HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded.
|
||||||
// ############################################################################################################
|
// ############################################################################################################
|
||||||
|
@ -180,6 +180,7 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex &
|
|||||||
|
|
||||||
void VersionPage::updateVersionControls()
|
void VersionPage::updateVersionControls()
|
||||||
{
|
{
|
||||||
|
ui->fabricBtn->setEnabled(true);
|
||||||
ui->forgeBtn->setEnabled(true);
|
ui->forgeBtn->setEnabled(true);
|
||||||
ui->liteloaderBtn->setEnabled(true);
|
ui->liteloaderBtn->setEnabled(true);
|
||||||
updateButtons();
|
updateButtons();
|
||||||
@ -187,6 +188,7 @@ void VersionPage::updateVersionControls()
|
|||||||
|
|
||||||
void VersionPage::disableVersionControls()
|
void VersionPage::disableVersionControls()
|
||||||
{
|
{
|
||||||
|
ui->fabricBtn->setEnabled(false);
|
||||||
ui->forgeBtn->setEnabled(false);
|
ui->forgeBtn->setEnabled(false);
|
||||||
ui->liteloaderBtn->setEnabled(false);
|
ui->liteloaderBtn->setEnabled(false);
|
||||||
ui->reloadBtn->setEnabled(false);
|
ui->reloadBtn->setEnabled(false);
|
||||||
@ -389,6 +391,33 @@ void VersionPage::on_forgeBtn_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VersionPage::on_fabricBtn_clicked()
|
||||||
|
{
|
||||||
|
auto vlist = ENV.metadataIndex()->get("net.fabricmc.fabric-loader");
|
||||||
|
if(!vlist)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
VersionSelectDialog vselect(vlist.get(), tr("Select Fabric Loader version"), this);
|
||||||
|
vselect.setEmptyString(tr("No Fabric Loader versions are currently available."));
|
||||||
|
vselect.setEmptyErrorString(tr("Couldn't load or download the Fabric Loader version lists!"));
|
||||||
|
|
||||||
|
auto currentVersion = m_profile->getComponentVersion("net.fabricmc.fabric-loader");
|
||||||
|
if(!currentVersion.isEmpty())
|
||||||
|
{
|
||||||
|
vselect.setCurrentVersion(currentVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vselect.exec() && vselect.selectedVersion())
|
||||||
|
{
|
||||||
|
auto vsn = vselect.selectedVersion();
|
||||||
|
m_profile->setComponentVersion("net.fabricmc.fabric-loader", vsn->descriptor());
|
||||||
|
m_profile->resolve(Net::Mode::Online);
|
||||||
|
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||||
|
m_container->refreshContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VersionPage::on_addEmptyBtn_clicked()
|
void VersionPage::on_addEmptyBtn_clicked()
|
||||||
{
|
{
|
||||||
NewComponentDialog compdialog(QString(), QString(), this);
|
NewComponentDialog compdialog(QString(), QString(), this);
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
virtual bool shouldDisplay() const override;
|
virtual bool shouldDisplay() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_fabricBtn_clicked();
|
||||||
void on_forgeBtn_clicked();
|
void on_forgeBtn_clicked();
|
||||||
void on_addEmptyBtn_clicked();
|
void on_addEmptyBtn_clicked();
|
||||||
void on_liteloaderBtn_clicked();
|
void on_liteloaderBtn_clicked();
|
||||||
|
@ -170,6 +170,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="fabricBtn">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Install the Minecraft Forge package.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Install Fabric</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="liteloaderBtn">
|
<widget class="QPushButton" name="liteloaderBtn">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -298,6 +308,7 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>tabWidget</tabstop>
|
||||||
<tabstop>packageView</tabstop>
|
<tabstop>packageView</tabstop>
|
||||||
<tabstop>changeVersionBtn</tabstop>
|
<tabstop>changeVersionBtn</tabstop>
|
||||||
<tabstop>moveUpBtn</tabstop>
|
<tabstop>moveUpBtn</tabstop>
|
||||||
@ -307,6 +318,7 @@
|
|||||||
<tabstop>editBtn</tabstop>
|
<tabstop>editBtn</tabstop>
|
||||||
<tabstop>revertBtn</tabstop>
|
<tabstop>revertBtn</tabstop>
|
||||||
<tabstop>forgeBtn</tabstop>
|
<tabstop>forgeBtn</tabstop>
|
||||||
|
<tabstop>fabricBtn</tabstop>
|
||||||
<tabstop>liteloaderBtn</tabstop>
|
<tabstop>liteloaderBtn</tabstop>
|
||||||
<tabstop>modBtn</tabstop>
|
<tabstop>modBtn</tabstop>
|
||||||
<tabstop>jarmodBtn</tabstop>
|
<tabstop>jarmodBtn</tabstop>
|
||||||
@ -314,7 +326,6 @@
|
|||||||
<tabstop>addEmptyBtn</tabstop>
|
<tabstop>addEmptyBtn</tabstop>
|
||||||
<tabstop>reloadBtn</tabstop>
|
<tabstop>reloadBtn</tabstop>
|
||||||
<tabstop>downloadBtn</tabstop>
|
<tabstop>downloadBtn</tabstop>
|
||||||
<tabstop>tabWidget</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user