summaryrefslogtreecommitdiffstats
path: root/application/pages/VersionPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-28 09:36:58 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-28 09:36:58 +0200
commita98e1df10cef774672e919497c43373e86c77f97 (patch)
treec29b1c33fff9a4ee4281a8ca7f0c1755dbb76bcc /application/pages/VersionPage.cpp
parentf9e186ab704401416832d723c2e70a0f7a7435b3 (diff)
downloadMultiMC-a98e1df10cef774672e919497c43373e86c77f97.tar
MultiMC-a98e1df10cef774672e919497c43373e86c77f97.tar.gz
MultiMC-a98e1df10cef774672e919497c43373e86c77f97.tar.lz
MultiMC-a98e1df10cef774672e919497c43373e86c77f97.tar.xz
MultiMC-a98e1df10cef774672e919497c43373e86c77f97.zip
GH-1011 fetch missing versions when customizing/reverting Minecraft patches
Diffstat (limited to 'application/pages/VersionPage.cpp')
-rw-r--r--application/pages/VersionPage.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index bb310eea..831408f6 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -44,6 +44,8 @@
#include "liteloader/LiteLoaderInstaller.h"
#include "auth/MojangAccountList.h"
#include "minecraft/Mod.h"
+#include <minecraft/MinecraftVersion.h>
+#include <minecraft/MinecraftVersionList.h>
#include "icons/IconList.h"
@@ -224,16 +226,21 @@ void VersionPage::on_changeVersionBtn_clicked()
reloadMinecraftProfile();
}
m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor());
+ doUpdate();
+}
+int VersionPage::doUpdate()
+{
auto updateTask = m_inst->doUpdate();
if (!updateTask)
{
- return;
+ return 1;
}
ProgressDialog tDialog(this);
connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
- tDialog.exec(updateTask.get());
+ int ret = tDialog.exec(updateTask.get());
updateButtons();
+ return ret;
}
void VersionPage::on_forgeBtn_clicked()
@@ -353,6 +360,16 @@ void VersionPage::on_customizeBtn_clicked()
{
return;
}
+ //HACK HACK remove, this is dumb
+ auto patch = m_version->versionPatch(version);
+ auto mc = std::dynamic_pointer_cast<MinecraftVersion>(patch);
+ if(mc && mc->needsUpdate())
+ {
+ if(!doUpdate())
+ {
+ return;
+ }
+ }
if(!m_version->customize(version))
{
// TODO: some error box here
@@ -384,6 +401,15 @@ void VersionPage::on_revertBtn_clicked()
{
return;
}
+ auto mcraw = MMC->minecraftlist()->findVersion(m_inst->intendedVersionId());
+ auto mc = std::dynamic_pointer_cast<MinecraftVersion>(mcraw);
+ if(mc && mc->needsUpdate())
+ {
+ if(!doUpdate())
+ {
+ return;
+ }
+ }
if(!m_version->revert(version))
{
// TODO: some error box here