summaryrefslogtreecommitdiffstats
path: root/logic/OneSixUpdate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/OneSixUpdate.cpp')
-rw-r--r--logic/OneSixUpdate.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp
index 750aeabb..65f30cda 100644
--- a/logic/OneSixUpdate.cpp
+++ b/logic/OneSixUpdate.cpp
@@ -48,7 +48,7 @@ void OneSixUpdate::executeTask()
QDir mcDir(m_inst->minecraftRoot());
if (!mcDir.exists() && !mcDir.mkpath("."))
{
- emitFailed("Failed to create bin folder.");
+ emitFailed(tr("Failed to create folder for minecraft binaries."));
return;
}
@@ -60,7 +60,7 @@ void OneSixUpdate::executeTask()
if (targetVersion == nullptr)
{
// don't do anything if it was invalid
- emitFailed("The specified Minecraft version is invalid. Choose a different one.");
+ emitFailed(tr("The specified Minecraft version is invalid. Choose a different one."));
return;
}
versionFileStart();
@@ -108,20 +108,19 @@ void OneSixUpdate::versionFileFinished()
QSaveFile vfile1(version1);
if (!vfile1.open(QIODevice::Truncate | QIODevice::WriteOnly))
{
- emitFailed("Can't open " + version1 + " for writing.");
+ emitFailed(tr("Can't open %1 for writing.").arg(version1));
return;
}
auto data = std::dynamic_pointer_cast<ByteArrayDownload>(DlJob)->m_data;
qint64 actual = 0;
if ((actual = vfile1.write(data)) != data.size())
{
- emitFailed("Failed to write into " + version1 + ". Written " + actual + " out of " +
- data.size() + '.');
+ emitFailed(tr("Failed to write into %1. Written %2 out of %3.").arg(version1).arg(actual).arg(data.size()));
return;
}
if (!vfile1.commit())
{
- emitFailed("Can't commit changes to " + version1);
+ emitFailed(tr("Can't commit changes to %1").arg(version1));
return;
}
}
@@ -136,14 +135,13 @@ void OneSixUpdate::versionFileFinished()
{
finfo.remove();
}
- inst->reloadVersion();
-
+ // NOTE: Version is reloaded in jarlibStart
jarlibStart();
}
void OneSixUpdate::versionFileFailed()
{
- emitFailed("Failed to download the version description. Try again.");
+ emitFailed(tr("Failed to download the version description. Try again."));
}
void OneSixUpdate::assetIndexStart()
@@ -180,7 +178,7 @@ void OneSixUpdate::assetIndexFinished()
QString asset_fname = "assets/indexes/" + assetName + ".json";
if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index))
{
- emitFailed("Failed to read the assets index!");
+ emitFailed(tr("Failed to read the assets index!"));
}
QList<Md5EtagDownloadPtr> dls;
@@ -216,7 +214,7 @@ void OneSixUpdate::assetIndexFinished()
void OneSixUpdate::assetIndexFailed()
{
- emitFailed("Failed to download the assets index!");
+ emitFailed(tr("Failed to download the assets index!"));
}
void OneSixUpdate::assetsFinished()
@@ -226,7 +224,7 @@ void OneSixUpdate::assetsFinished()
void OneSixUpdate::assetsFailed()
{
- emitFailed("Failed to download assets!");
+ emitFailed(tr("Failed to download assets!"));
}
void OneSixUpdate::jarlibStart()
@@ -234,11 +232,18 @@ void OneSixUpdate::jarlibStart()
setStatus(tr("Getting the library files from Mojang..."));
QLOG_INFO() << m_inst->name() << ": downloading libraries";
OneSixInstance *inst = (OneSixInstance *)m_inst;
- bool successful = inst->reloadVersion();
- if (!successful)
+ try
+ {
+ inst->reloadVersion();
+ }
+ catch(MMCError & e)
+ {
+ emitFailed(e.cause());
+ return;
+ }
+ catch(...)
{
- emitFailed("Failed to load the version description file. It might be "
- "corrupted, missing or simply too new.");
+ emitFailed(tr("Failed to load the version description file for reasons unknown."));
return;
}
@@ -326,6 +331,5 @@ void OneSixUpdate::jarlibFailed()
{
QStringList failed = jarlibDownloadJob->getFailedFiles();
QString failed_all = failed.join("\n");
- emitFailed("Failed to download the following files:\n" + failed_all +
- "\n\nPlease try again.");
+ emitFailed(tr("Failed to download the following files:\n%1\n\nPlease try again.").arg(failed_all));
}