From 791a8227b6aae6b506d5f6aac2213b73b1ba0c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 10 Jul 2019 22:30:42 +0200 Subject: [PATCH] NOISSUE disable component install buttons in impossible cases --- application/pages/instance/VersionPage.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/pages/instance/VersionPage.cpp b/application/pages/instance/VersionPage.cpp index fc1755e4..6f1b9206 100644 --- a/application/pages/instance/VersionPage.cpp +++ b/application/pages/instance/VersionPage.cpp @@ -41,6 +41,7 @@ #include "minecraft/Mod.h" #include "icons/IconList.h" #include "Exception.h" +#include "Version.h" #include "MultiMC.h" @@ -126,8 +127,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) { disableVersionControls(); } - connect(m_inst, &MinecraftInstance::versionReloaded, this, - &VersionPage::updateVersionControls); + connect(m_inst, &MinecraftInstance::versionReloaded, this, &VersionPage::updateVersionControls); } VersionPage::~VersionPage() @@ -180,9 +180,13 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex & void VersionPage::updateVersionControls() { - ui->fabricBtn->setEnabled(true); - ui->forgeBtn->setEnabled(true); - ui->liteloaderBtn->setEnabled(true); + // FIXME: this is a dirty hack + auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft")); + bool newCraft = minecraftVersion >= Version("1.14"); + bool oldCraft = minecraftVersion <= Version("1.12.2"); + ui->fabricBtn->setEnabled(newCraft); + ui->forgeBtn->setEnabled(oldCraft); + ui->liteloaderBtn->setEnabled(oldCraft); updateButtons(); }