diff options
Diffstat (limited to 'logic')
-rw-r--r-- | logic/OneSixInstance.cpp | 6 | ||||
-rw-r--r-- | logic/OneSixInstance.h | 2 | ||||
-rw-r--r-- | logic/OneSixVersionBuilder.cpp | 21 | ||||
-rw-r--r-- | logic/OneSixVersionBuilder.h | 4 | ||||
-rw-r--r-- | logic/VersionFinal.cpp | 4 | ||||
-rw-r--r-- | logic/VersionFinal.h | 2 |
6 files changed, 25 insertions, 14 deletions
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index bd5d559e..0e0be4d8 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -316,14 +316,14 @@ QString OneSixInstance::currentVersionId() const return intendedVersionId(); } -bool OneSixInstance::reloadVersion(QWidget *widgetParent) +bool OneSixInstance::reloadVersion() { I_D(OneSixInstance); - bool ret = d->version->reload(widgetParent, false, externalPatches()); + bool ret = d->version->reload(false, externalPatches()); if (ret) { - ret = d->vanillaVersion->reload(widgetParent, true, externalPatches()); + ret = d->vanillaVersion->reload(true, externalPatches()); } if (ret) { diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h index 75edec1e..c7ef2ee8 100644 --- a/logic/OneSixInstance.h +++ b/logic/OneSixInstance.h @@ -54,7 +54,7 @@ public: virtual QDialog *createModEditDialog(QWidget *parent) override; /// reload the full version json files. return true on success! - bool reloadVersion(QWidget *widgetParent = 0); + bool reloadVersion(); /// clears all version information in preparation for an update void clearVersion(); /// get the current full version info diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index 2b05e45a..98e4b54e 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -37,13 +37,11 @@ OneSixVersionBuilder::OneSixVersionBuilder() { } -bool OneSixVersionBuilder::build(VersionFinal *version, OneSixInstance *instance, - QWidget *widgetParent, const bool onlyVanilla, const QStringList &external) +bool OneSixVersionBuilder::build(VersionFinal *version, OneSixInstance *instance, const bool onlyVanilla, const QStringList &external) { OneSixVersionBuilder builder; builder.m_version = version; builder.m_instance = instance; - builder.m_widgetParent = widgetParent; return builder.buildInternal(onlyVanilla, external); } @@ -52,7 +50,6 @@ bool OneSixVersionBuilder::readJsonAndApplyToVersion(VersionFinal *version, cons OneSixVersionBuilder builder; builder.m_version = version; builder.m_instance = 0; - builder.m_widgetParent = 0; return builder.readJsonAndApply(obj); } @@ -117,11 +114,13 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi 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; } @@ -159,10 +158,12 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi 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; } } @@ -206,24 +207,30 @@ bool OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj) 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; } @@ -235,29 +242,35 @@ 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())); + */ return false; } QJsonParseError error; QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &error); if (error.error != QJsonParseError::NoError) { + /* QMessageBox::critical(m_widgetParent, QObject::tr("Error"), QObject::tr("Unable to parse %1: %2 at %3") .arg(file.fileName(), error.errorString()) .arg(error.offset)); + */ 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())); + */ } return true; } diff --git a/logic/OneSixVersionBuilder.h b/logic/OneSixVersionBuilder.h index fe77ed9d..789fe3f1 100644 --- a/logic/OneSixVersionBuilder.h +++ b/logic/OneSixVersionBuilder.h @@ -20,7 +20,6 @@ class VersionFinal; class OneSixInstance; -class QWidget; class QJsonObject; class QFileInfo; class VersionFile; @@ -29,7 +28,7 @@ class OneSixVersionBuilder { OneSixVersionBuilder(); public: - static bool build(VersionFinal *version, OneSixInstance *instance, QWidget *widgetParent, const bool onlyVanilla, const QStringList &external); + static bool build(VersionFinal *version, OneSixInstance *instance, const bool onlyVanilla, const QStringList &external); static bool readJsonAndApplyToVersion(VersionFinal *version, const QJsonObject &obj); static QMap<QString, int> readOverrideOrders(OneSixInstance *instance); @@ -38,7 +37,6 @@ public: private: VersionFinal *m_version; OneSixInstance *m_instance; - QWidget *m_widgetParent; bool buildInternal(const bool onlyVanilla, const QStringList &external); bool readJsonAndApply(const QJsonObject &obj); diff --git a/logic/VersionFinal.cpp b/logic/VersionFinal.cpp index ce78e8e3..3aa95ed7 100644 --- a/logic/VersionFinal.cpp +++ b/logic/VersionFinal.cpp @@ -26,10 +26,10 @@ VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent) clear(); } -bool VersionFinal::reload(QWidget *widgetParent, const bool onlyVanilla, const QStringList &external) +bool VersionFinal::reload(const bool onlyVanilla, const QStringList &external) { beginResetModel(); - bool ret = OneSixVersionBuilder::build(this, m_instance, widgetParent, onlyVanilla, external); + bool ret = OneSixVersionBuilder::build(this, m_instance, onlyVanilla, external); endResetModel(); return ret; } diff --git a/logic/VersionFinal.h b/logic/VersionFinal.h index c9a5f469..e5a38423 100644 --- a/logic/VersionFinal.h +++ b/logic/VersionFinal.h @@ -37,7 +37,7 @@ public: virtual int columnCount(const QModelIndex &parent) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; - bool reload(QWidget *widgetParent, const bool onlyVanilla = false, const QStringList &external = QStringList()); + bool reload(const bool onlyVanilla = false, const QStringList &external = QStringList()); void clear(); void dump() const; |