Skip to content

Commit 791a822

Browse files
committed
NOISSUE disable component install buttons in impossible cases
1 parent 725ec35 commit 791a822

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

application/pages/instance/VersionPage.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "minecraft/Mod.h"
4242
#include "icons/IconList.h"
4343
#include "Exception.h"
44+
#include "Version.h"
4445

4546
#include "MultiMC.h"
4647

@@ -126,8 +127,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
126127
{
127128
disableVersionControls();
128129
}
129-
connect(m_inst, &MinecraftInstance::versionReloaded, this,
130-
&VersionPage::updateVersionControls);
130+
connect(m_inst, &MinecraftInstance::versionReloaded, this, &VersionPage::updateVersionControls);
131131
}
132132

133133
VersionPage::~VersionPage()
@@ -180,9 +180,13 @@ void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &
180180

181181
void VersionPage::updateVersionControls()
182182
{
183-
ui->fabricBtn->setEnabled(true);
184-
ui->forgeBtn->setEnabled(true);
185-
ui->liteloaderBtn->setEnabled(true);
183+
// FIXME: this is a dirty hack
184+
auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
185+
bool newCraft = minecraftVersion >= Version("1.14");
186+
bool oldCraft = minecraftVersion <= Version("1.12.2");
187+
ui->fabricBtn->setEnabled(newCraft);
188+
ui->forgeBtn->setEnabled(oldCraft);
189+
ui->liteloaderBtn->setEnabled(oldCraft);
186190
updateButtons();
187191
}
188192

0 commit comments

Comments
 (0)