summaryrefslogtreecommitdiffstats
path: root/logic/OneSixFTBInstance.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-03-10 19:24:29 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-03-10 19:24:29 +0100
commitfcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb (patch)
tree851d8f8b6e6734e26fd2e4dc7b7477630329ff01 /logic/OneSixFTBInstance.cpp
parent73fc9c79cff979e9023df0b1a77848c67b590681 (diff)
parentd11f10ea1ed54336254838ff068258d2d42e0774 (diff)
downloadMultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.gz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.lz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.xz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.zip
Merge branch 'develop' into feature_badges
Conflicts: logic/OneSixInstance.cpp
Diffstat (limited to 'logic/OneSixFTBInstance.cpp')
-rw-r--r--logic/OneSixFTBInstance.cpp81
1 files changed, 9 insertions, 72 deletions
diff --git a/logic/OneSixFTBInstance.cpp b/logic/OneSixFTBInstance.cpp
index 07b123b6..172830bb 100644
--- a/logic/OneSixFTBInstance.cpp
+++ b/logic/OneSixFTBInstance.cpp
@@ -1,6 +1,6 @@
#include "OneSixFTBInstance.h"
-#include "OneSixVersion.h"
+#include "VersionFinal.h"
#include "OneSixLibrary.h"
#include "tasks/SequentialTask.h"
#include "ForgeInstaller.h"
@@ -10,76 +10,6 @@
#include "MultiMC.h"
#include "pathutils.h"
-class OneSixFTBInstanceForge : public Task
-{
- Q_OBJECT
-public:
- explicit OneSixFTBInstanceForge(const QString &version, OneSixFTBInstance *inst, QObject *parent = 0) :
- Task(parent), instance(inst), version("Forge " + version)
- {
- }
-
- void executeTask()
- {
- for (int i = 0; i < MMC->forgelist()->count(); ++i)
- {
- if (MMC->forgelist()->at(i)->name() == version)
- {
- forgeVersion = std::dynamic_pointer_cast<ForgeVersion>(MMC->forgelist()->at(i));
- break;
- }
- }
- if (!forgeVersion)
- {
- emitFailed(QString("Couldn't find forge version ") + version );
- return;
- }
- entry = MMC->metacache()->resolveEntry("minecraftforge", forgeVersion->filename);
- if (entry->stale)
- {
- setStatus(tr("Downloading Forge..."));
- fjob = new NetJob("Forge download");
- fjob->addNetAction(CacheDownload::make(forgeVersion->installer_url, entry));
- connect(fjob, &NetJob::failed, [this](){emitFailed(m_failReason);});
- connect(fjob, &NetJob::succeeded, this, &OneSixFTBInstanceForge::installForge);
- connect(fjob, &NetJob::progress, [this](qint64 c, qint64 total){ setProgress(100 * c / total); });
- fjob->start();
- }
- else
- {
- installForge();
- }
- }
-
-private
-slots:
- void installForge()
- {
- setStatus(tr("Installing Forge..."));
- QString forgePath = entry->getFullPath();
- ForgeInstaller forge(forgePath, forgeVersion->universal_url);
- if (!instance->reloadVersion())
- {
- emitFailed(tr("Couldn't load the version config"));
- return;
- }
- auto version = instance->getFullVersion();
- if (!forge.add(instance))
- {
- emitFailed(tr("Couldn't install Forge"));
- return;
- }
- emitSucceeded();
- }
-
-private:
- OneSixFTBInstance *instance;
- QString version;
- ForgeVersionPtr forgeVersion;
- MetaEntryPtr entry;
- NetJob *fjob;
-};
-
OneSixFTBInstance::OneSixFTBInstance(const QString &rootDir, SettingsObject *settings, QObject *parent) :
OneSixInstance(rootDir, settings, parent)
{
@@ -87,7 +17,14 @@ OneSixFTBInstance::OneSixFTBInstance(const QString &rootDir, SettingsObject *set
void OneSixFTBInstance::init()
{
- reloadVersion();
+ try
+ {
+ reloadVersion();
+ }
+ catch(MMCError & e)
+ {
+ // QLOG_ERROR() << "Caught exception on instance init: " << e.cause();
+ }
}
void OneSixFTBInstance::copy(const QDir &newDir)