From ffff2cd3248a574d3d666731580ac7b8c33e1735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 9 Mar 2014 17:38:42 +0100 Subject: Remove version patch reordering. Remove the main class display from onesix edit mods. --- logic/OneSixVersionBuilder.cpp | 10 +++++----- logic/VersionFinal.cpp | 10 +++++----- logic/VersionFinal.h | 5 +---- 3 files changed, 11 insertions(+), 14 deletions(-) (limited to 'logic') diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index a6bc5ec7..8abeb0d8 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -71,6 +71,7 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file->version = QString(); file->mcVersion = QString(); file->applyTo(m_version); + m_version->versionFiles.append(file); } // else, if there's custom json, we just do that. else if (QFile::exists(root.absoluteFilePath("custom.json"))) @@ -82,6 +83,7 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file->fileId = "org.multimc.custom.json"; file->version = QString(); file->applyTo(m_version); + m_version->versionFiles.append(file); // 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.") } @@ -96,6 +98,7 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi file->version = m_instance->intendedVersionId(); file->mcVersion = m_instance->intendedVersionId(); file->applyTo(m_version); + m_version->versionFiles.append(file); // QObject::tr("Error while applying %1. Please check MultiMC-0.log for more info.").arg(root.absoluteFilePath("version.json"))); if (onlyVanilla) @@ -103,17 +106,12 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi // patches/ // load all, put into map for ordering, apply in the right order - QMap overrideOrder = readOverrideOrders(m_instance); QMap> files; for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files)) { QLOG_INFO() << "Reading" << info.fileName(); auto file = parseJsonFile(info, true); - if (overrideOrder.contains(file->fileId)) - { - file->order = overrideOrder.value(file->fileId); - } if (files.contains(file->order)) { throw VersionBuildError(QObject::tr("%1 has the same order as %2").arg(file->fileId, files[file->order].second->fileId)); @@ -125,6 +123,7 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi QLOG_DEBUG() << "Applying file with order" << order; auto & filePair = files[order]; filePair.second->applyTo(m_version); + m_version->versionFiles.append(filePair.second); } } while(0); @@ -167,6 +166,7 @@ void OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj) // QObject::tr("Error while reading. Please check MultiMC-0.log for more info.")); file->applyTo(m_version); + m_version->versionFiles.append(file); // 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")); } diff --git a/logic/VersionFinal.cpp b/logic/VersionFinal.cpp index 8d668014..48601d57 100644 --- a/logic/VersionFinal.cpp +++ b/logic/VersionFinal.cpp @@ -56,7 +56,7 @@ bool VersionFinal::canRemove(const int index) const { if (index < versionFiles.size()) { - return versionFiles.at(index).id != "org.multimc.version.json"; + return versionFiles.at(index)->fileId != "org.multimc.version.json"; } return false; } @@ -67,14 +67,14 @@ QString VersionFinal::versionFileId(const int index) const { return QString(); } - return versionFiles.at(index).id; + return versionFiles.at(index)->fileId; } bool VersionFinal::remove(const int index) { if (canRemove(index)) { - return QFile::remove(versionFiles.at(index).filename); + return QFile::remove(versionFiles.at(index)->filename); } return false; } @@ -135,9 +135,9 @@ QVariant VersionFinal::data(const QModelIndex &index, int role) const switch (column) { case 0: - return versionFiles.at(row).name; + return versionFiles.at(row)->name; case 1: - return versionFiles.at(row).version; + return versionFiles.at(row)->version; default: return QVariant(); } diff --git a/logic/VersionFinal.h b/logic/VersionFinal.h index b19cd6f9..99fd5ff0 100644 --- a/logic/VersionFinal.h +++ b/logic/VersionFinal.h @@ -119,11 +119,8 @@ public: */ // QList rules; - QList versionFiles; + QList versionFiles; private: OneSixInstance *m_instance; }; - -QDebug operator<<(QDebug &dbg, const VersionFinal *version); -QDebug operator<<(QDebug &dbg, const OneSixLibrary *library); -- cgit v1.2.3