Get rid of parse flags
This commit is contained in:
parent
7c24bcc834
commit
053b938beb
@ -68,7 +68,7 @@ bool OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
|
|||||||
{
|
{
|
||||||
QLOG_INFO() << "Reading" << fileName;
|
QLOG_INFO() << "Reading" << fileName;
|
||||||
VersionFile file;
|
VersionFile file;
|
||||||
if (!parseJsonFile(QFileInfo(fileName), false, &file, fileName.endsWith("pack.json") ? IsFTBPackJson : NoFlags))
|
if (!parseJsonFile(QFileInfo(fileName), false, &file, fileName.endsWith("pack.json")))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -230,8 +230,7 @@ bool OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OneSixVersionBuilder::parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder,
|
bool OneSixVersionBuilder::parseJsonFile(const QFileInfo& fileInfo, const bool requireOrder, VersionFile* out, bool isFTB)
|
||||||
VersionFile *out, const ParseFlags flags)
|
|
||||||
{
|
{
|
||||||
QFile file(fileInfo.absoluteFilePath());
|
QFile file(fileInfo.absoluteFilePath());
|
||||||
if (!file.open(QFile::ReadOnly))
|
if (!file.open(QFile::ReadOnly))
|
||||||
@ -252,14 +251,13 @@ bool OneSixVersionBuilder::parseJsonFile(const QFileInfo &fileInfo, const bool r
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isError = false;
|
bool isError = false;
|
||||||
*out = VersionFile::fromJson(doc, file.fileName(), requireOrder, isError, flags);
|
*out = VersionFile::fromJson(doc, file.fileName(), requireOrder, isError, isFTB);
|
||||||
if (isError)
|
if (isError)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
m_widgetParent, QObject::tr("Error"),
|
m_widgetParent, QObject::tr("Error"),
|
||||||
QObject::tr("Error while reading %1. Please check MultiMC-0.log for more info.")
|
QObject::tr("Error while reading %1. Please check MultiMC-0.log for more info.")
|
||||||
.arg(file.fileName()));
|
.arg(file.fileName()));
|
||||||
;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,6 @@ public:
|
|||||||
static QMap<QString, int> readOverrideOrders(OneSixInstance *instance);
|
static QMap<QString, int> readOverrideOrders(OneSixInstance *instance);
|
||||||
static bool writeOverrideOrders(const QMap<QString, int> &order, OneSixInstance *instance);
|
static bool writeOverrideOrders(const QMap<QString, int> &order, OneSixInstance *instance);
|
||||||
|
|
||||||
enum ParseFlag
|
|
||||||
{
|
|
||||||
NoFlags = 0x0,
|
|
||||||
IsFTBPackJson = 0x1
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(ParseFlags, ParseFlag)
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VersionFinal *m_version;
|
VersionFinal *m_version;
|
||||||
OneSixInstance *m_instance;
|
OneSixInstance *m_instance;
|
||||||
@ -50,7 +43,5 @@ private:
|
|||||||
bool buildInternal(const bool onlyVanilla, const QStringList &external);
|
bool buildInternal(const bool onlyVanilla, const QStringList &external);
|
||||||
bool readJsonAndApply(const QJsonObject &obj);
|
bool readJsonAndApply(const QJsonObject &obj);
|
||||||
|
|
||||||
bool parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder, VersionFile *out, const ParseFlags flags = NoFlags);
|
bool parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder, VersionFile *out, bool isFTB = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(OneSixVersionBuilder::ParseFlags)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user