summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-07-10 22:30:42 +0200
committerPetr Mrázek <peterix@gmail.com>2019-07-10 22:30:42 +0200
commit791a8227b6aae6b506d5f6aac2213b73b1ba0c70 (patch)
treee2214b0627d189e11364f6d7f388de34ef1359f3
parent725ec356350175ba08bca0eae8475dc2654dd10a (diff)
downloadMultiMC-791a8227b6aae6b506d5f6aac2213b73b1ba0c70.tar
MultiMC-791a8227b6aae6b506d5f6aac2213b73b1ba0c70.tar.gz
MultiMC-791a8227b6aae6b506d5f6aac2213b73b1ba0c70.tar.lz
MultiMC-791a8227b6aae6b506d5f6aac2213b73b1ba0c70.tar.xz
MultiMC-791a8227b6aae6b506d5f6aac2213b73b1ba0c70.zip
NOISSUE disable component install buttons in impossible cases
-rw-r--r--application/pages/instance/VersionPage.cpp14
1 files 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 &current, 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();
}