diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-03-02 19:12:04 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-03-02 19:12:04 +0100 |
commit | 28ad9befdcac246eb69a434be970abc29a80bc80 (patch) | |
tree | 330451feee32c4163b02132076491ad4fd311e9b /logic/OneSixVersionBuilder.cpp | |
parent | 80d146866c8c5f00c6d790b476a774def71010bf (diff) | |
download | MultiMC-28ad9befdcac246eb69a434be970abc29a80bc80.tar MultiMC-28ad9befdcac246eb69a434be970abc29a80bc80.tar.gz MultiMC-28ad9befdcac246eb69a434be970abc29a80bc80.tar.lz MultiMC-28ad9befdcac246eb69a434be970abc29a80bc80.tar.xz MultiMC-28ad9befdcac246eb69a434be970abc29a80bc80.zip |
Remove a lot of error code and error handling madness.
Diffstat (limited to 'logic/OneSixVersionBuilder.cpp')
-rw-r--r-- | logic/OneSixVersionBuilder.cpp | 90 |
1 files changed, 14 insertions, 76 deletions
diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index 98e4b54e..752f2d8f 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -73,10 +73,7 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file.fileId = "org.multimc.external." + file.name; file.version = QString(); file.mcVersion = QString(); - bool isError = false; - auto errorcode = file.applyTo(m_version); - if(errorcode != VersionFile::NoApplyError) - return false; + file.applyTo(m_version); } // else, if there's custom json, we just do that. else if (QFile::exists(root.absoluteFilePath("custom.json"))) @@ -91,9 +88,7 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file.filename = "custom.json"; file.fileId = "org.multimc.custom.json"; file.version = QString(); - auto errorcode = file.applyTo(m_version); - if(errorcode != VersionFile::NoApplyError) - return false; + file.applyTo(m_version); // QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC")); // QObject::tr("Error while applying %1. Please check MultiMC-0.log for more info.") } @@ -111,18 +106,8 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file.fileId = "org.multimc.version.json"; file.version = m_instance->intendedVersionId(); file.mcVersion = m_instance->intendedVersionId(); - auto error = file.applyTo(m_version); - if (error != VersionFile::NoApplyError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr( - "Error while applying %1. Please check MultiMC-0.log for more info.") - .arg(root.absoluteFilePath("version.json"))); - */ - return false; - } + file.applyTo(m_version); + // QObject::tr("Error while applying %1. Please check MultiMC-0.log for more info.").arg(root.absoluteFilePath("version.json"))); if (onlyVanilla) break; @@ -155,17 +140,8 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi { QLOG_DEBUG() << "Applying file with order" << order; auto filePair = files[order]; - auto error = filePair.second.applyTo(m_version); - if (error != VersionFile::NoApplyError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("Error while applying %1. Please check MultiMC-0.log " - "for more info.").arg(filePair.first)); - */ - return false; - } + filePair.second.applyTo(m_version); + // QObject::tr("Error while applying %1. Please check MultiMC-0.log for more info.").arg(filePair.first)); } } while(0); @@ -203,37 +179,12 @@ bool OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj) { m_version->clear(); - bool isError = false; - VersionFile file = VersionFile::fromJson(QJsonDocument(obj), QString(), false, isError); - if (isError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("Error while reading. Please check MultiMC-0.log for more info.")); - */ - return false; - } - VersionFile::ApplyError error = file.applyTo(m_version); - if (error == VersionFile::OtherError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("Error while applying. Please check MultiMC-0.log for more info.")); - */ - return false; - } - else if (error == VersionFile::LauncherVersionError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC")); - */ - return false; - } + VersionFile file = VersionFile::fromJson(QJsonDocument(obj), QString(), false); + // QObject::tr("Error while reading. Please check MultiMC-0.log for more info.")); + file.applyTo(m_version); + // QObject::tr("Error while applying. Please check MultiMC-0.log for more info.")); + // QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC")); return true; } @@ -242,11 +193,7 @@ bool OneSixVersionBuilder::parseJsonFile(const QFileInfo& fileInfo, const bool r QFile file(fileInfo.absoluteFilePath()); if (!file.open(QFile::ReadOnly)) { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("Unable to open %1: %2").arg(file.fileName(), file.errorString())); - */ + // QObject::tr("Unable to open %1: %2").arg(file.fileName(), file.errorString()); return false; } QJsonParseError error; @@ -261,17 +208,8 @@ bool OneSixVersionBuilder::parseJsonFile(const QFileInfo& fileInfo, const bool r */ return false; } - bool isError = false; - *out = VersionFile::fromJson(doc, file.fileName(), requireOrder, isError, isFTB); - if (isError) - { - /* - QMessageBox::critical( - m_widgetParent, QObject::tr("Error"), - QObject::tr("Error while reading %1. Please check MultiMC-0.log for more info.") - .arg(file.fileName())); - */ - } + *out = VersionFile::fromJson(doc, file.fileName(), requireOrder, isFTB); + // QObject::tr("Error while reading %1. Please check MultiMC-0.log for more info.").arg(file.fileName()); return true; } |