SCRATCH nuke the overcomplicated logger, use a simple one.
This commit is contained in:
		@@ -214,7 +214,7 @@ QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs()
 | 
			
		||||
			{
 | 
			
		||||
				if (other->rawName() == lib->rawName())
 | 
			
		||||
				{
 | 
			
		||||
					QLOG_WARN() << "Multiple libraries with name" << lib->rawName() << "in library list!";
 | 
			
		||||
					qWarning() << "Multiple libraries with name" << lib->rawName() << "in library list!";
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -129,7 +129,7 @@ void MinecraftVersionList::loadCachedList()
 | 
			
		||||
	if (!localIndex.open(QIODevice::ReadOnly))
 | 
			
		||||
	{
 | 
			
		||||
		// FIXME: this is actually a very bad thing! How do we deal with this?
 | 
			
		||||
		QLOG_ERROR() << "The minecraft version cache can't be read.";
 | 
			
		||||
		qCritical() << "The minecraft version cache can't be read.";
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	auto data = localIndex.readAll();
 | 
			
		||||
@@ -146,7 +146,7 @@ void MinecraftVersionList::loadCachedList()
 | 
			
		||||
	catch (MMCError &e)
 | 
			
		||||
	{
 | 
			
		||||
		// the cache has gone bad for some reason... flush it.
 | 
			
		||||
		QLOG_ERROR() << "The minecraft version cache is corrupted. Flushing cache.";
 | 
			
		||||
		qCritical() << "The minecraft version cache is corrupted. Flushing cache.";
 | 
			
		||||
		localIndex.remove();
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
@@ -155,7 +155,7 @@ void MinecraftVersionList::loadCachedList()
 | 
			
		||||
 | 
			
		||||
void MinecraftVersionList::loadBuiltinList()
 | 
			
		||||
{
 | 
			
		||||
	QLOG_INFO() << "Loading builtin version list.";
 | 
			
		||||
	qDebug() << "Loading builtin version list.";
 | 
			
		||||
	// grab the version list data from internal resources.
 | 
			
		||||
	const QJsonDocument doc =
 | 
			
		||||
		MMCJson::parseFile(":/versions/minecraft.json",
 | 
			
		||||
@@ -170,13 +170,13 @@ void MinecraftVersionList::loadBuiltinList()
 | 
			
		||||
		QString versionTypeStr = versionObj.value("type").toString("");
 | 
			
		||||
		if (versionID.isEmpty() || versionTypeStr.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Parsed version is missing ID or type";
 | 
			
		||||
			qCritical() << "Parsed version is missing ID or type";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (g_VersionFilterData.legacyBlacklist.contains(versionID))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID;
 | 
			
		||||
			qWarning() << "Blacklisted legacy version ignored: " << versionID;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -188,7 +188,7 @@ void MinecraftVersionList::loadBuiltinList()
 | 
			
		||||
		if (!parse_timestamp(versionObj.value("releaseTime").toString(""),
 | 
			
		||||
							 mcVersion->m_releaseTimeString, mcVersion->m_releaseTime))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error while parsing version" << versionID
 | 
			
		||||
			qCritical() << "Error while parsing version" << versionID
 | 
			
		||||
						 << ": invalid version timestamp";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
@@ -217,7 +217,7 @@ void MinecraftVersionList::loadBuiltinList()
 | 
			
		||||
 | 
			
		||||
void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source)
 | 
			
		||||
{
 | 
			
		||||
	QLOG_INFO() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list.";
 | 
			
		||||
	qDebug() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list.";
 | 
			
		||||
 | 
			
		||||
	if (!jsonDoc.isObject())
 | 
			
		||||
	{
 | 
			
		||||
@@ -234,7 +234,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
	}
 | 
			
		||||
	catch (MMCError &err)
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_ERROR()
 | 
			
		||||
		qCritical()
 | 
			
		||||
			<< tr("Error parsing version list JSON: couldn't determine latest versions");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -252,7 +252,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
		// Load the version info.
 | 
			
		||||
		if (!version.isObject())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error while parsing version list : invalid JSON structure";
 | 
			
		||||
			qCritical() << "Error while parsing version list : invalid JSON structure";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -260,13 +260,13 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
		QString versionID = versionObj.value("id").toString("");
 | 
			
		||||
		if (versionID.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error while parsing version : version ID is missing";
 | 
			
		||||
			qCritical() << "Error while parsing version : version ID is missing";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (g_VersionFilterData.legacyBlacklist.contains(versionID))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_WARN() << "Blacklisted legacy version ignored: " << versionID;
 | 
			
		||||
			qWarning() << "Blacklisted legacy version ignored: " << versionID;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -277,14 +277,14 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
		if (!parse_timestamp(versionObj.value("releaseTime").toString(""),
 | 
			
		||||
							 mcVersion->m_releaseTimeString, mcVersion->m_releaseTime))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error while parsing version" << versionID
 | 
			
		||||
			qCritical() << "Error while parsing version" << versionID
 | 
			
		||||
						 << ": invalid release timestamp";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		if (!parse_timestamp(versionObj.value("time").toString(""),
 | 
			
		||||
							 mcVersion->m_updateTimeString, mcVersion->m_updateTime))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error while parsing version" << versionID
 | 
			
		||||
			qCritical() << "Error while parsing version" << versionID
 | 
			
		||||
						 << ": invalid update timestamp";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
@@ -302,7 +302,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
		QString versionTypeStr = versionObj.value("type").toString("");
 | 
			
		||||
		if (versionTypeStr.isEmpty())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Ignoring" << versionID
 | 
			
		||||
			qCritical() << "Ignoring" << versionID
 | 
			
		||||
						 << "because it doesn't have the version type set.";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
@@ -321,12 +321,12 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Ignoring" << versionID
 | 
			
		||||
			qCritical() << "Ignoring" << versionID
 | 
			
		||||
						 << "because it has an invalid version type.";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		mcVersion->m_type = versionTypeStr;
 | 
			
		||||
		QLOG_INFO() << "Loaded version" << versionID << "from"
 | 
			
		||||
		qDebug() << "Loaded version" << versionID << "from"
 | 
			
		||||
					<< ((source == Remote) ? "remote" : "local") << "version list.";
 | 
			
		||||
		tempList.append(mcVersion);
 | 
			
		||||
	}
 | 
			
		||||
@@ -494,7 +494,7 @@ void MCVListVersionUpdateTask::json_downloaded()
 | 
			
		||||
	// now dump the file to disk
 | 
			
		||||
	auto doc = file->toJson(false);
 | 
			
		||||
	auto newdata = doc.toBinaryData();
 | 
			
		||||
	QLOG_INFO() << newdata;
 | 
			
		||||
	qDebug() << newdata;
 | 
			
		||||
	QString targetPath = "versions/" + versionToUpdate + "/" + versionToUpdate + ".dat";
 | 
			
		||||
	ensureFilePathExists(targetPath);
 | 
			
		||||
	QSaveFile vfile1(targetPath);
 | 
			
		||||
 
 | 
			
		||||
@@ -116,10 +116,10 @@ void OneSixProfileStrategy::loadUserPatches()
 | 
			
		||||
		QFileInfo finfo(filename);
 | 
			
		||||
		if(!finfo.exists())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_INFO() << "Patch file " << filename << " was deleted by external means...";
 | 
			
		||||
			qDebug() << "Patch file " << filename << " was deleted by external means...";
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		QLOG_INFO() << "Reading" << filename << "by user order";
 | 
			
		||||
		qDebug() << "Reading" << filename << "by user order";
 | 
			
		||||
		auto file = ProfileUtils::parseJsonFile(finfo, false);
 | 
			
		||||
		// sanity check. prevent tampering with files.
 | 
			
		||||
		if (file->fileId != id)
 | 
			
		||||
@@ -134,7 +134,7 @@ void OneSixProfileStrategy::loadUserPatches()
 | 
			
		||||
	for (auto info : patches.entryInfoList(QStringList() << "*.json", QDir::Files))
 | 
			
		||||
	{
 | 
			
		||||
		// parse the file
 | 
			
		||||
		QLOG_INFO() << "Reading" << info.fileName();
 | 
			
		||||
		qDebug() << "Reading" << info.fileName();
 | 
			
		||||
		auto file = ProfileUtils::parseJsonFile(info, true);
 | 
			
		||||
		// ignore builtins
 | 
			
		||||
		if (file->fileId == "net.minecraft")
 | 
			
		||||
@@ -253,7 +253,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
 | 
			
		||||
		QFile file(patchFileName);
 | 
			
		||||
		if (!file.open(QFile::WriteOnly))
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Error opening" << file.fileName()
 | 
			
		||||
			qCritical() << "Error opening" << file.fileName()
 | 
			
		||||
						<< "for reading:" << file.errorString();
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
#include "ProfileUtils.h"
 | 
			
		||||
#include "logic/minecraft/VersionFilterData.h"
 | 
			
		||||
#include "logic/MMCJson.h"
 | 
			
		||||
#include "logger/QsLog.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#include <QJsonDocument>
 | 
			
		||||
#include <QJsonArray>
 | 
			
		||||
@@ -26,7 +26,7 @@ bool writeOverrideOrders(QString path, const PatchOrder &order)
 | 
			
		||||
	QSaveFile orderFile(path);
 | 
			
		||||
	if (!orderFile.open(QFile::WriteOnly))
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_ERROR() << "Couldn't open" << orderFile.fileName()
 | 
			
		||||
		qCritical() << "Couldn't open" << orderFile.fileName()
 | 
			
		||||
					 << "for writing:" << orderFile.errorString();
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
@@ -50,14 +50,14 @@ bool readOverrideOrders(QString path, PatchOrder &order)
 | 
			
		||||
	QFile orderFile(path);
 | 
			
		||||
	if (!orderFile.exists())
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_WARN() << "Order file doesn't exist. Ignoring.";
 | 
			
		||||
		qWarning() << "Order file doesn't exist. Ignoring.";
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (!orderFile.open(QFile::ReadOnly))
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_ERROR() << "Couldn't open" << orderFile.fileName()
 | 
			
		||||
		qCritical() << "Couldn't open" << orderFile.fileName()
 | 
			
		||||
					 << " for reading:" << orderFile.errorString();
 | 
			
		||||
		QLOG_WARN() << "Ignoring overriden order";
 | 
			
		||||
		qWarning() << "Ignoring overriden order";
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -66,8 +66,8 @@ bool readOverrideOrders(QString path, PatchOrder &order)
 | 
			
		||||
	QJsonDocument doc = QJsonDocument::fromJson(orderFile.readAll(), &error);
 | 
			
		||||
	if (error.error != QJsonParseError::NoError)
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString();
 | 
			
		||||
		QLOG_WARN() << "Ignoring overriden order";
 | 
			
		||||
		qCritical() << "Couldn't parse" << orderFile.fileName() << ":" << error.errorString();
 | 
			
		||||
		qWarning() << "Ignoring overriden order";
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -90,8 +90,8 @@ bool readOverrideOrders(QString path, PatchOrder &order)
 | 
			
		||||
	}
 | 
			
		||||
	catch (JSONValidationError &err)
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_ERROR() << "Couldn't parse" << orderFile.fileName() << ": bad file format";
 | 
			
		||||
		QLOG_WARN() << "Ignoring overriden order";
 | 
			
		||||
		qCritical() << "Couldn't parse" << orderFile.fileName() << ": bad file format";
 | 
			
		||||
		qWarning() << "Ignoring overriden order";
 | 
			
		||||
		order.clear();
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
 | 
			
		||||
 | 
			
		||||
		if (!val.isString())
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_WARN() << key << "is not a string in" << filename << "(skipping)";
 | 
			
		||||
			qWarning() << key << "is not a string in" << filename << "(skipping)";
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -49,7 +49,7 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
 | 
			
		||||
		{
 | 
			
		||||
			if (!it.value().isString())
 | 
			
		||||
			{
 | 
			
		||||
				QLOG_WARN() << filename << "contains an invalid native (skipping)";
 | 
			
		||||
				qWarning() << filename << "contains an invalid native (skipping)";
 | 
			
		||||
			}
 | 
			
		||||
			OpSys opSys = OpSys_fromString(it.key());
 | 
			
		||||
			if (opSys != Os_Other)
 | 
			
		||||
@@ -215,7 +215,7 @@ bool RawLibrary::filesExist(const QDir &base) const
 | 
			
		||||
	for(auto file: libFiles)
 | 
			
		||||
	{
 | 
			
		||||
		QFileInfo info(base, file);
 | 
			
		||||
		QLOG_WARN() << info.absoluteFilePath() << "doesn't exist";
 | 
			
		||||
		qWarning() << info.absoluteFilePath() << "doesn't exist";
 | 
			
		||||
		if (!info.exists())
 | 
			
		||||
			return false;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@
 | 
			
		||||
#include "logic/OneSixInstance.h"
 | 
			
		||||
#include "logic/MMCJson.h"
 | 
			
		||||
 | 
			
		||||
#include "logger/QsLog.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
VersionBuilder::VersionBuilder()
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
#include <QJsonDocument>
 | 
			
		||||
#include <modutils.h>
 | 
			
		||||
 | 
			
		||||
#include "logger/QsLog.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#include "logic/minecraft/VersionFile.h"
 | 
			
		||||
#include "logic/minecraft/OneSixLibrary.h"
 | 
			
		||||
@@ -57,7 +57,7 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			// FIXME: evaluate if we don't want to throw exceptions here instead
 | 
			
		||||
			QLOG_ERROR() << filename << "doesn't contain an order field";
 | 
			
		||||
			qCritical() << filename << "doesn't contain an order field";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -364,7 +364,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
 | 
			
		||||
		{
 | 
			
		||||
		case RawLibrary::Apply:
 | 
			
		||||
		{
 | 
			
		||||
			// QLOG_INFO() << "Applying lib " << lib->name;
 | 
			
		||||
			// qDebug() << "Applying lib " << lib->name;
 | 
			
		||||
			int index = findLibraryByName(version->libraries, addedLibrary->rawName());
 | 
			
		||||
			if (index >= 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -396,7 +396,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				QLOG_WARN() << "Couldn't find" << addedLibrary->rawName() << "(skipping)";
 | 
			
		||||
				qWarning() << "Couldn't find" << addedLibrary->rawName() << "(skipping)";
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
@@ -476,7 +476,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
 | 
			
		||||
			{
 | 
			
		||||
				toReplace = addedLibrary->insertData;
 | 
			
		||||
			}
 | 
			
		||||
			// QLOG_INFO() << "Replacing lib " << toReplace << " with " << lib->name;
 | 
			
		||||
			// qDebug() << "Replacing lib " << toReplace << " with " << lib->name;
 | 
			
		||||
			int index = findLibraryByName(version->libraries, toReplace);
 | 
			
		||||
			if (index >= 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -484,7 +484,7 @@ void VersionFile::applyTo(MinecraftProfile *version)
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				QLOG_WARN() << "Couldn't find" << toReplace << "(skipping)";
 | 
			
		||||
				qWarning() << "Couldn't find" << toReplace << "(skipping)";
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
@@ -495,12 +495,12 @@ void VersionFile::applyTo(MinecraftProfile *version)
 | 
			
		||||
		int index = findLibraryByName(version->libraries, lib);
 | 
			
		||||
		if (index >= 0)
 | 
			
		||||
		{
 | 
			
		||||
			// QLOG_INFO() << "Removing lib " << lib;
 | 
			
		||||
			// qDebug() << "Removing lib " << lib;
 | 
			
		||||
			version->libraries.removeAt(index);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_WARN() << "Couldn't find" << lib << "(skipping)";
 | 
			
		||||
			qWarning() << "Couldn't find" << lib << "(skipping)";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user