diff options
Diffstat (limited to 'application/pages/instance/VersionPage.cpp')
-rw-r--r-- | application/pages/instance/VersionPage.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/application/pages/instance/VersionPage.cpp b/application/pages/instance/VersionPage.cpp index cbe4a31c..fc1755e4 100644 --- a/application/pages/instance/VersionPage.cpp +++ b/application/pages/instance/VersionPage.cpp @@ -180,6 +180,7 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex & void VersionPage::updateVersionControls() { + ui->fabricBtn->setEnabled(true); ui->forgeBtn->setEnabled(true); ui->liteloaderBtn->setEnabled(true); updateButtons(); @@ -187,6 +188,7 @@ void VersionPage::updateVersionControls() void VersionPage::disableVersionControls() { + ui->fabricBtn->setEnabled(false); ui->forgeBtn->setEnabled(false); ui->liteloaderBtn->setEnabled(false); ui->reloadBtn->setEnabled(false); @@ -316,6 +318,12 @@ void VersionPage::on_changeVersionBtn_clicked() return; } VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this); + if (uid == "net.fabricmc.intermediary") + { + vselect.setEmptyString(tr("No Fabric Loader versions are currently available.")); + vselect.setEmptyErrorString(tr("Couldn't load or download the Fabric Loader version lists!")); + vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft")); + } auto currentVersion = patch->getVersion(); if(!currentVersion.isEmpty()) { @@ -389,6 +397,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() { NewComponentDialog compdialog(QString(), QString(), this); |