Fix Fabric versions appearing for unsupported MC versions
Also remove an old TODO comment, mentioning an issue that was already fixed.
This commit is contained in:
parent
2cb242e9b3
commit
7577115c3c
@ -44,6 +44,7 @@
|
|||||||
#include "ui/dialogs/NewInstanceDialog.h"
|
#include "ui/dialogs/NewInstanceDialog.h"
|
||||||
#include "Filter.h"
|
#include "Filter.h"
|
||||||
#include "InstanceCreationTask.h"
|
#include "InstanceCreationTask.h"
|
||||||
|
#include "Version.h"
|
||||||
|
|
||||||
VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent)
|
VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent)
|
||||||
: QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage)
|
: QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage)
|
||||||
@ -116,27 +117,31 @@ void VanillaPage::filterChanged()
|
|||||||
|
|
||||||
void VanillaPage::loaderFilterChanged()
|
void VanillaPage::loaderFilterChanged()
|
||||||
{
|
{
|
||||||
|
auto minecraftVersion = m_selectedVersion->descriptor();
|
||||||
if(ui->noneFilter->isChecked())
|
if(ui->noneFilter->isChecked())
|
||||||
{
|
{
|
||||||
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list
|
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list
|
||||||
// TODO: The below message does not show when the add instance window is first opened. This should be fixed.
|
|
||||||
ui->loaderVersionList->setEmptyString(tr("No mod loader is selected."));
|
ui->loaderVersionList->setEmptyString(tr("No mod loader is selected."));
|
||||||
ui->loaderVersionList->setEmptyMode(VersionListView::String);
|
ui->loaderVersionList->setEmptyMode(VersionListView::String);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(ui->forgeFilter->isChecked())
|
else if(ui->forgeFilter->isChecked())
|
||||||
{
|
{
|
||||||
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, m_selectedVersion->descriptor());
|
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion);
|
||||||
m_selectedLoader = "net.minecraftforge";
|
m_selectedLoader = "net.minecraftforge";
|
||||||
}
|
}
|
||||||
else if(ui->fabricFilter->isChecked())
|
else if(ui->fabricFilter->isChecked())
|
||||||
{
|
{
|
||||||
|
// FIXME: dirty hack because the launcher is unaware of Fabric's dependencies
|
||||||
|
if (Version(minecraftVersion) >= Version("1.14")) // Fabric supported
|
||||||
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "");
|
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "");
|
||||||
|
else // Fabric unsupported
|
||||||
|
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // clear list
|
||||||
m_selectedLoader = "net.fabricmc.fabric-loader";
|
m_selectedLoader = "net.fabricmc.fabric-loader";
|
||||||
}
|
}
|
||||||
else if(ui->liteLoaderFilter->isChecked())
|
else if(ui->liteLoaderFilter->isChecked())
|
||||||
{
|
{
|
||||||
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, m_selectedVersion->descriptor());
|
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion);
|
||||||
m_selectedLoader = "com.mumfrey.liteloader";
|
m_selectedLoader = "com.mumfrey.liteloader";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +149,7 @@ void VanillaPage::loaderFilterChanged()
|
|||||||
ui->loaderVersionList->initialize(vlist.get());
|
ui->loaderVersionList->initialize(vlist.get());
|
||||||
ui->loaderVersionList->selectRecommended();
|
ui->loaderVersionList->selectRecommended();
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
ui->loaderVersionList->setEmptyString(tr("No versions are currently available for Minecraft %1").arg(m_selectedVersion->descriptor()));
|
ui->loaderVersionList->setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
VanillaPage::~VanillaPage()
|
VanillaPage::~VanillaPage()
|
||||||
|
Loading…
Reference in New Issue
Block a user