From cd9d37aac402b0edd0f12b66fd7f2fdd5fe6dff5 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Mon, 2 Feb 2015 02:14:14 +0100 Subject: SCRATCH nuke the overcomplicated logger, use a simple one. --- logic/BaseProcess.cpp | 12 +++--- logic/Env.cpp | 8 ++-- logic/InstanceList.cpp | 32 +++++++-------- logic/JarUtils.cpp | 26 ++++++------ logic/LegacyInstance.cpp | 2 +- logic/LegacyUpdate.cpp | 2 +- logic/LwjglVersionList.cpp | 12 +++--- logic/Mod.cpp | 8 ++-- logic/ModList.cpp | 18 ++++---- logic/OneSixInstance.cpp | 2 +- logic/OneSixUpdate.cpp | 6 +-- logic/assets/AssetsUtils.cpp | 22 +++++----- logic/auth/MojangAccount.cpp | 8 ++-- logic/auth/MojangAccountList.cpp | 28 ++++++------- logic/auth/YggdrasilTask.cpp | 12 +++--- logic/auth/flows/AuthenticateTask.cpp | 18 ++++---- logic/auth/flows/RefreshTask.cpp | 10 ++--- logic/auth/flows/ValidateTask.cpp | 2 +- logic/forge/ForgeInstaller.cpp | 8 ++-- logic/forge/ForgeMirrors.cpp | 6 +-- logic/forge/ForgeVersionList.cpp | 12 +++--- logic/forge/ForgeXzDownload.cpp | 36 ++++++++-------- logic/ftb/FTBProfileStrategy.cpp | 6 +-- logic/ftb/OneSixFTBInstance.cpp | 12 +++--- logic/icons/IconList.cpp | 12 +++--- logic/java/JavaCheckerJob.cpp | 6 +-- logic/java/JavaUtils.cpp | 6 +-- logic/java/JavaVersionList.cpp | 12 +++--- logic/liteloader/LiteLoaderInstaller.cpp | 4 +- logic/liteloader/LiteLoaderVersionList.cpp | 2 +- logic/minecraft/MinecraftProfile.cpp | 2 +- logic/minecraft/MinecraftVersionList.cpp | 34 +++++++-------- logic/minecraft/OneSixProfileStrategy.cpp | 8 ++-- logic/minecraft/ProfileUtils.cpp | 18 ++++---- logic/minecraft/RawLibrary.cpp | 6 +-- logic/minecraft/VersionBuilder.cpp | 2 +- logic/minecraft/VersionFile.cpp | 16 ++++---- logic/net/ByteArrayDownload.cpp | 8 ++-- logic/net/CacheDownload.cpp | 16 ++++---- logic/net/HttpMetaCache.cpp | 6 +-- logic/net/MD5EtagDownload.cpp | 12 +++--- logic/net/NetJob.cpp | 8 ++-- logic/net/PasteUpload.cpp | 6 +-- logic/news/NewsChecker.cpp | 16 ++++---- logic/screenshots/ImgurAlbumCreation.cpp | 10 ++--- logic/screenshots/ImgurUpload.cpp | 10 ++--- logic/settings/SettingsObject.cpp | 8 ++-- logic/status/StatusChecker.cpp | 14 +++---- logic/tasks/Task.cpp | 6 +-- logic/trans/TranslationDownloader.cpp | 12 +++--- logic/updater/DownloadUpdateTask.cpp | 66 +++++++++++++++--------------- logic/updater/NotificationChecker.cpp | 4 +- 52 files changed, 319 insertions(+), 319 deletions(-) (limited to 'logic') diff --git a/logic/BaseProcess.cpp b/logic/BaseProcess.cpp index d65e76d9..eb1bbfdc 100644 --- a/logic/BaseProcess.cpp +++ b/logic/BaseProcess.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ #include "logic/BaseProcess.h" -#include "logger/QsLog.h" +#include #include #include @@ -71,20 +71,20 @@ void BaseProcess::init() // filter out dangerous java crap if(ignored.contains(key)) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } // filter MultiMC-related things if(key.startsWith("QT_")) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } #ifdef LINUX // Do not pass LD_* variables to java. They were intended for MultiMC if(key.startsWith("LD_")) { - QLOG_INFO() << "Env: ignoring" << key << value; + qDebug() << "Env: ignoring" << key << value; continue; } // Strip IBus @@ -93,10 +93,10 @@ void BaseProcess::init() { QString save = value; value.replace(IBUS, ""); - QLOG_INFO() << "Env: stripped" << IBUS << "from" << save << ":" << value; + qDebug() << "Env: stripped" << IBUS << "from" << save << ":" << value; } #endif - QLOG_INFO() << "Env: " << key << value; + qDebug() << "Env: " << key << value; env.insert(key, value); } #ifdef LINUX diff --git a/logic/Env.cpp b/logic/Env.cpp index 68e76e4b..69986be2 100644 --- a/logic/Env.cpp +++ b/logic/Env.cpp @@ -6,7 +6,7 @@ #include #include #include -#include "logger/QsLog.h" +#include #include "logic/tasks/Task.h" #include @@ -175,14 +175,14 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr QNetworkProxyFactory::setUseSystemConfiguration(true); } - QLOG_INFO() << "Detecting proxy settings..."; + qDebug() << "Detecting proxy settings..."; QNetworkProxy proxy = QNetworkProxy::applicationProxy(); if (m_qnam.get()) m_qnam->setProxy(proxy); QString proxyDesc; if (proxy.type() == QNetworkProxy::NoProxy) { - QLOG_INFO() << "Using no proxy is an option!"; + qDebug() << "Using no proxy is an option!"; return; } switch (proxy.type()) @@ -211,7 +211,7 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr .arg(proxy.port()) .arg(proxy.user()) .arg(proxy.password()); - QLOG_INFO() << proxyDesc; + qDebug() << proxyDesc; } #include "Env.moc" \ No newline at end of file diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 657fd5b4..ef6594d9 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -34,7 +34,7 @@ #include "settings/INISettingsObject.h" #include "OneSixInstance.h" #include "LegacyInstance.h" -#include "logger/QsLog.h" +#include const static int GROUP_FILE_FORMAT_VERSION = 1; @@ -138,7 +138,7 @@ void InstanceList::saveGroupList() if (!groupFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { // An error occurred. Ignore it. - QLOG_ERROR() << "Failed to save instance group file."; + qCritical() << "Failed to save instance group file."; return; } QTextStream out(&groupFile); @@ -202,7 +202,7 @@ void InstanceList::loadGroupList(QMap &groupMap) if (!groupFile.open(QIODevice::ReadOnly)) { // An error occurred. Ignore it. - QLOG_ERROR() << "Failed to read instance group file."; + qCritical() << "Failed to read instance group file."; return; } @@ -216,7 +216,7 @@ void InstanceList::loadGroupList(QMap &groupMap) // if the json was bad, fail if (error.error != QJsonParseError::NoError) { - QLOG_ERROR() << QString("Failed to parse instance group file: %1 at offset %2") + qCritical() << QString("Failed to parse instance group file: %1 at offset %2") .arg(error.errorString(), QString::number(error.offset)) .toUtf8(); return; @@ -225,7 +225,7 @@ void InstanceList::loadGroupList(QMap &groupMap) // if the root of the json wasn't an object, fail if (!jsonDoc.isObject()) { - QLOG_WARN() << "Invalid group file. Root entry should be an object."; + qWarning() << "Invalid group file. Root entry should be an object."; return; } @@ -238,7 +238,7 @@ void InstanceList::loadGroupList(QMap &groupMap) // Get the groups. if it's not an object, fail if (!rootObj.value("groups").isObject()) { - QLOG_WARN() << "Invalid group list JSON: 'groups' should be an object."; + qWarning() << "Invalid group list JSON: 'groups' should be an object."; return; } @@ -251,7 +251,7 @@ void InstanceList::loadGroupList(QMap &groupMap) // If not an object, complain and skip to the next one. if (!iter.value().isObject()) { - QLOG_WARN() << QString("Group '%1' in the group list should " + qWarning() << QString("Group '%1' in the group list should " "be an object.") .arg(groupName) .toUtf8(); @@ -261,7 +261,7 @@ void InstanceList::loadGroupList(QMap &groupMap) QJsonObject groupObj = iter.value().toObject(); if (!groupObj.value("instances").isArray()) { - QLOG_WARN() << QString("Group '%1' in the group list is invalid. " + qWarning() << QString("Group '%1' in the group list is invalid. " "It should contain an array " "called 'instances'.") .arg(groupName) @@ -298,7 +298,7 @@ InstanceList::InstListError InstanceList::loadList() QString subDir = iter.next(); if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) continue; - QLOG_INFO() << "Loading MultiMC instance from " << subDir; + qDebug() << "Loading MultiMC instance from " << subDir; InstancePtr instPtr; auto error = loadInstance(instPtr, subDir); if(!continueProcessInstance(instPtr, error, subDir, groupMap)) @@ -410,12 +410,12 @@ bool InstanceList::continueProcessInstance(InstancePtr instPtr, const int error, errorMsg += QString("Unknown instance loader error %1").arg(error); break; } - QLOG_ERROR() << errorMsg.toUtf8(); + qCritical() << errorMsg.toUtf8(); return false; } else if (!instPtr) { - QLOG_ERROR() << QString("Error loading instance %1. Instance loader returned null.") + qCritical() << QString("Error loading instance %1. Instance loader returned null.") .arg(QFileInfo(dir.absolutePath()).baseName()) .toUtf8(); return false; @@ -427,7 +427,7 @@ bool InstanceList::continueProcessInstance(InstancePtr instPtr, const int error, { instPtr->setGroupInitial((*iter)); } - QLOG_INFO() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); + qDebug() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); return true; } } @@ -463,16 +463,16 @@ InstanceList::createInstance(InstancePtr &inst, BaseVersionPtr version, const QS { QDir rootDir(instDir); - QLOG_DEBUG() << instDir.toUtf8(); + qDebug() << instDir.toUtf8(); if (!rootDir.exists() && !rootDir.mkpath(".")) { - QLOG_ERROR() << "Can't create instance folder" << instDir; + qCritical() << "Can't create instance folder" << instDir; return InstanceList::CantCreateDir; } if (!version) { - QLOG_ERROR() << "Can't create instance for non-existing MC version"; + qCritical() << "Can't create instance for non-existing MC version"; return InstanceList::NoSuchVersion; } @@ -497,7 +497,7 @@ InstanceList::copyInstance(InstancePtr &newInstance, InstancePtr &oldInstance, c { QDir rootDir(instDir); - QLOG_DEBUG() << instDir.toUtf8(); + qDebug() << instDir.toUtf8(); if (!copyPath(oldInstance->instanceRoot(), instDir)) { rootDir.removeRecursively(); diff --git a/logic/JarUtils.cpp b/logic/JarUtils.cpp index d4f1ed56..e73af53c 100644 --- a/logic/JarUtils.cpp +++ b/logic/JarUtils.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace JarUtils { @@ -19,13 +19,13 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet &contained, QString filename = modZip.getCurrentFileName(); if (!filter(filename)) { - QLOG_INFO() << "Skipping file " << filename << " from " + qDebug() << "Skipping file " << filename << " from " << from.fileName() << " - filtered"; continue; } if (contained.contains(filename)) { - QLOG_INFO() << "Skipping already contained file " << filename << " from " + qDebug() << "Skipping already contained file " << filename << " from " << from.fileName(); continue; } @@ -33,7 +33,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet &contained, if (!fileInsideMod.open(QIODevice::ReadOnly)) { - QLOG_ERROR() << "Failed to open " << filename << " from " << from.fileName(); + qCritical() << "Failed to open " << filename << " from " << from.fileName(); return false; } @@ -41,7 +41,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet &contained, if (!zipOutFile.open(QIODevice::WriteOnly, info_out)) { - QLOG_ERROR() << "Failed to open " << filename << " in the jar"; + qCritical() << "Failed to open " << filename << " in the jar"; fileInsideMod.close(); return false; } @@ -49,7 +49,7 @@ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet &contained, { zipOutFile.close(); fileInsideMod.close(); - QLOG_ERROR() << "Failed to copy data of " << filename << " into the jar"; + qCritical() << "Failed to copy data of " << filename << " into the jar"; return false; } zipOutFile.close(); @@ -64,7 +64,7 @@ bool createModdedJar(QString sourceJarPath, QString targetJarPath, const QList LegacyInstance::getJarMods() const void LegacyInstance::jarModsChanged() { - QLOG_INFO() << "Jar mods of instance " << name() << " have changed. Jar will be rebuilt."; + qDebug() << "Jar mods of instance " << name() << " have changed. Jar will be rebuilt."; setShouldRebuild(true); } diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp index e12556eb..8b970f08 100644 --- a/logic/LegacyUpdate.cpp +++ b/logic/LegacyUpdate.cpp @@ -28,7 +28,7 @@ #include "logic/Env.h" #include "logic/ModList.h" -#include "logger/QsLog.h" +#include #include "logic/net/URLConstants.h" #include "JarUtils.h" diff --git a/logic/LwjglVersionList.cpp b/logic/LwjglVersionList.cpp index 5bd9faa2..9e101b74 100644 --- a/logic/LwjglVersionList.cpp +++ b/logic/LwjglVersionList.cpp @@ -20,7 +20,7 @@ #include #include -#include "logger/QsLog.h" +#include #define RSS_URL "http://sourceforge.net/projects/java-game-lib/rss" @@ -131,7 +131,7 @@ void LWJGLVersionList::netRequestComplete() QDomElement linkElement = getDomElementByTagName(items.at(i).toElement(), "link"); if (linkElement.isNull()) { - QLOG_INFO() << "Link element" << i << "in RSS feed doesn't exist! Skipping."; + qDebug() << "Link element" << i << "in RSS feed doesn't exist! Skipping."; continue; } @@ -147,10 +147,10 @@ void LWJGLVersionList::netRequestComplete() QUrl url(link); if (!url.isValid()) { - QLOG_WARN() << "LWJGL version URL isn't valid:" << link << "Skipping."; + qWarning() << "LWJGL version URL isn't valid:" << link << "Skipping."; continue; } - QLOG_INFO() << "Discovered LWGL version" << name << "at" << link; + qDebug() << "Discovered LWGL version" << name << "at" << link; tempList.append(std::make_shared(name, link)); } } @@ -159,7 +159,7 @@ void LWJGLVersionList::netRequestComplete() m_vlist.swap(tempList); endResetModel(); - QLOG_INFO() << "Loaded LWJGL list."; + qDebug() << "Loaded LWJGL list."; finished(); } else @@ -173,7 +173,7 @@ void LWJGLVersionList::netRequestComplete() void LWJGLVersionList::failed(QString msg) { - QLOG_ERROR() << msg; + qCritical() << msg; emit loadListFailed(msg); } diff --git a/logic/Mod.cpp b/logic/Mod.cpp index 7fdd2a5e..7fa4905e 100644 --- a/logic/Mod.cpp +++ b/logic/Mod.cpp @@ -25,7 +25,7 @@ #include "Mod.h" #include #include "logic/settings/INIFile.h" -#include "logger/QsLog.h" +#include Mod::Mod(const QFileInfo &file) { @@ -209,8 +209,8 @@ void Mod::ReadMCModInfo(QByteArray contents) int version = val.toDouble(); if (version != 2) { - QLOG_ERROR() << "BAD stuff happened to mod json:"; - QLOG_ERROR() << contents; + qCritical() << "BAD stuff happened to mod json:"; + qCritical() << contents; return; } auto arrVal = jsonDoc.object().value("modlist"); @@ -273,7 +273,7 @@ bool Mod::replace(Mod &with) if (t == MOD_ZIPFILE || t == MOD_SINGLEFILE || t == MOD_LITEMOD) { - QLOG_DEBUG() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath(); + qDebug() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath(); success = QFile::copy(with.m_file.filePath(), m_file.filePath()); } if (t == MOD_FOLDER) diff --git a/logic/ModList.cpp b/logic/ModList.cpp index f6037c95..68d74e79 100644 --- a/logic/ModList.cpp +++ b/logic/ModList.cpp @@ -21,7 +21,7 @@ #include #include #include -#include "logger/QsLog.h" +#include ModList::ModList(const QString &dir, const QString &list_file) : QAbstractListModel(), m_dir(dir), m_list_file(list_file) @@ -42,11 +42,11 @@ void ModList::startWatching() is_watching = m_watcher->addPath(m_dir.absolutePath()); if (is_watching) { - QLOG_INFO() << "Started watching " << m_dir.absolutePath(); + qDebug() << "Started watching " << m_dir.absolutePath(); } else { - QLOG_INFO() << "Failed to start watching " << m_dir.absolutePath(); + qDebug() << "Failed to start watching " << m_dir.absolutePath(); } } @@ -55,11 +55,11 @@ void ModList::stopWatching() is_watching = !m_watcher->removePath(m_dir.absolutePath()); if (!is_watching) { - QLOG_INFO() << "Stopped watching " << m_dir.absolutePath(); + qDebug() << "Stopped watching " << m_dir.absolutePath(); } else { - QLOG_INFO() << "Failed to stop watching " << m_dir.absolutePath(); + qDebug() << "Failed to stop watching " << m_dir.absolutePath(); } } @@ -162,7 +162,7 @@ bool ModList::update() endResetModel(); if (orderOrStateChanged && !m_list_file.isEmpty()) { - QLOG_INFO() << "Mod list " << m_list_file << " changed!"; + qDebug() << "Mod list " << m_list_file << " changed!"; saveListFile(); emit changed(); } @@ -559,7 +559,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row row = rowCount(); if (column == -1) column = 0; - QLOG_INFO() << "Drop row: " << row << " column: " << column; + qDebug() << "Drop row: " << row << " column: " << column; // files dropped from outside? if (data->hasUrls()) @@ -575,7 +575,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row continue; QString filename = url.toLocalFile(); installMod(filename, row); - QLOG_INFO() << "installing: " << filename; + qDebug() << "installing: " << filename; // if there is no ordering, re-sort the list if (m_list_file.isEmpty()) { @@ -596,7 +596,7 @@ bool ModList::dropMimeData(const QMimeData *data, Qt::DropAction action, int row return false; QString remoteId = list[0]; int remoteIndex = list[1].toInt(); - QLOG_INFO() << "move: " << sourcestr; + qDebug() << "move: " << sourcestr; // no moving of things between two lists if (remoteId != m_list_id) return false; diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index bdd47131..642a6aec 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -15,7 +15,7 @@ #include #include -#include "logger/QsLog.h" +#include #include "MMCError.h" #include "logic/OneSixInstance.h" diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index 38e9c0d7..5ec36305 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -60,14 +60,14 @@ void OneSixUpdate::executeTask() } if (m_inst->providesVersionFile() || !targetVersion->needsUpdate()) { - QLOG_DEBUG() << "Instance either provides a version file or doesn't need an update."; + qDebug() << "Instance either provides a version file or doesn't need an update."; jarlibStart(); return; } versionUpdateTask = std::dynamic_pointer_cast(ENV.getVersionList("net.minecraft"))->createUpdateTask(m_inst->intendedVersionId()); if (!versionUpdateTask) { - QLOG_DEBUG() << "Didn't spawn an update task."; + qDebug() << "Didn't spawn an update task."; jarlibStart(); return; } @@ -173,7 +173,7 @@ void OneSixUpdate::assetsFailed() void OneSixUpdate::jarlibStart() { setStatus(tr("Getting the library files from Mojang...")); - QLOG_INFO() << m_inst->name() << ": downloading libraries"; + qDebug() << m_inst->name() << ": downloading libraries"; OneSixInstance *inst = (OneSixInstance *)m_inst; try { diff --git a/logic/assets/AssetsUtils.cpp b/logic/assets/AssetsUtils.cpp index 82a0da95..9f33b1bd 100644 --- a/logic/assets/AssetsUtils.cpp +++ b/logic/assets/AssetsUtils.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "AssetsUtils.h" #include @@ -85,7 +85,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // TODO: We should probably report this error to the user. if (!file.open(QIODevice::ReadOnly)) { - QLOG_ERROR() << "Failed to read assets index file" << path; + qCritical() << "Failed to read assets index file" << path; return false; } @@ -99,7 +99,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // Fail if the JSON is invalid. if (parseError.error != QJsonParseError::NoError) { - QLOG_ERROR() << "Failed to parse assets index file:" << parseError.errorString() + qCritical() << "Failed to parse assets index file:" << parseError.errorString() << "at offset " << QString::number(parseError.offset); return false; } @@ -107,7 +107,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) // Make sure the root is an object. if (!jsonDoc.isObject()) { - QLOG_ERROR() << "Invalid assets index JSON: Root should be an array."; + qCritical() << "Invalid assets index JSON: Root should be an array."; return false; } @@ -124,7 +124,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { - // QLOG_DEBUG() << iter.key(); + // qDebug() << iter.key(); QVariant variant = iter.value(); QVariantMap nested_objects = variant.toMap(); @@ -134,7 +134,7 @@ bool loadAssetsIndexJson(QString path, AssetsIndex *index) for (QVariantMap::const_iterator nested_iter = nested_objects.begin(); nested_iter != nested_objects.end(); ++nested_iter) { - // QLOG_DEBUG() << nested_iter.key() << nested_iter.value().toString(); + // qDebug() << nested_iter.key() << nested_iter.value().toString(); QString key = nested_iter.key(); QVariant value = nested_iter.value(); @@ -167,11 +167,11 @@ QDir reconstructAssets(QString assetsId) if (!indexFile.exists()) { - QLOG_ERROR() << "No assets index file" << indexPath << "; can't reconstruct assets"; + qCritical() << "No assets index file" << indexPath << "; can't reconstruct assets"; return virtualRoot; } - QLOG_DEBUG() << "reconstructAssets" << assetsDir.path() << indexDir.path() + qDebug() << "reconstructAssets" << assetsDir.path() << indexDir.path() << objectDir.path() << virtualDir.path() << virtualRoot.path(); AssetsIndex index; @@ -179,7 +179,7 @@ QDir reconstructAssets(QString assetsId) if (loadAssetsIndex && index.isVirtual) { - QLOG_INFO() << "Reconstructing virtual assets folder at" << virtualRoot.path(); + qDebug() << "Reconstructing virtual assets folder at" << virtualRoot.path(); for (QString map : index.objects.keys()) { @@ -198,12 +198,12 @@ QDir reconstructAssets(QString assetsId) { QFileInfo info(target_path); QDir target_dir = info.dir(); - // QLOG_DEBUG() << target_dir; + // qDebug() << target_dir; if (!target_dir.exists()) QDir("").mkpath(target_dir.path()); bool couldCopy = original.copy(target_path); - QLOG_DEBUG() << " Copying" << original_path << "to" << target_path + qDebug() << " Copying" << original_path << "to" << target_path << QString::number(couldCopy); // << original.errorString(); } } diff --git a/logic/auth/MojangAccount.cpp b/logic/auth/MojangAccount.cpp index 19c56ae6..69a24c09 100644 --- a/logic/auth/MojangAccount.cpp +++ b/logic/auth/MojangAccount.cpp @@ -26,14 +26,14 @@ #include #include -#include +#include MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) { // The JSON object must at least have a username for it to be valid. if (!object.value("username").isString()) { - QLOG_ERROR() << "Can't load Mojang account info from JSON object. Username field is " + qCritical() << "Can't load Mojang account info from JSON object. Username field is " "missing or of the wrong type."; return nullptr; } @@ -45,7 +45,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) QJsonArray profileArray = object.value("profiles").toArray(); if (profileArray.size() < 1) { - QLOG_ERROR() << "Can't load Mojang account with username \"" << username + qCritical() << "Can't load Mojang account with username \"" << username << "\". No profiles found."; return nullptr; } @@ -59,7 +59,7 @@ MojangAccountPtr MojangAccount::loadFromJson(const QJsonObject &object) bool legacy = profileObject.value("legacy").toBool(false); if (id.isEmpty() || name.isEmpty()) { - QLOG_WARN() << "Unable to load a profile because it was missing an ID or a name."; + qWarning() << "Unable to load a profile because it was missing an ID or a name."; continue; } profiles.append({id, name, legacy}); diff --git a/logic/auth/MojangAccountList.cpp b/logic/auth/MojangAccountList.cpp index 94cdf8b5..abed9b24 100644 --- a/logic/auth/MojangAccountList.cpp +++ b/logic/auth/MojangAccountList.cpp @@ -24,7 +24,7 @@ #include #include -#include "logger/QsLog.h" +#include #include "logic/auth/MojangAccount.h" #include @@ -262,7 +262,7 @@ bool MojangAccountList::loadList(const QString &filePath) path = m_listFilePath; if (path.isEmpty()) { - QLOG_ERROR() << "Can't load Mojang account list. No file path given and no default set."; + qCritical() << "Can't load Mojang account list. No file path given and no default set."; return false; } @@ -272,7 +272,7 @@ bool MojangAccountList::loadList(const QString &filePath) // TODO: We should probably report this error to the user. if (!file.open(QIODevice::ReadOnly)) { - QLOG_ERROR() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); + qCritical() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); return false; } @@ -286,7 +286,7 @@ bool MojangAccountList::loadList(const QString &filePath) // Fail if the JSON is invalid. if (parseError.error != QJsonParseError::NoError) { - QLOG_ERROR() << QString("Failed to parse account list file: %1 at offset %2") + qCritical() << QString("Failed to parse account list file: %1 at offset %2") .arg(parseError.errorString(), QString::number(parseError.offset)) .toUtf8(); return false; @@ -295,7 +295,7 @@ bool MojangAccountList::loadList(const QString &filePath) // Make sure the root is an object. if (!jsonDoc.isObject()) { - QLOG_ERROR() << "Invalid account list JSON: Root should be an array."; + qCritical() << "Invalid account list JSON: Root should be an array."; return false; } @@ -305,7 +305,7 @@ bool MojangAccountList::loadList(const QString &filePath) if (root.value("formatVersion").toVariant().toInt() != ACCOUNT_LIST_FORMAT_VERSION) { QString newName = "accounts-old.json"; - QLOG_WARN() << "Format version mismatch when loading account list. Existing one will be renamed to" + qWarning() << "Format version mismatch when loading account list. Existing one will be renamed to" << newName; // Attempt to rename the old version. @@ -327,7 +327,7 @@ bool MojangAccountList::loadList(const QString &filePath) } else { - QLOG_WARN() << "Failed to load an account."; + qWarning() << "Failed to load an account."; } } // Load the active account. @@ -343,7 +343,7 @@ bool MojangAccountList::saveList(const QString &filePath) path = m_listFilePath; if (path.isEmpty()) { - QLOG_ERROR() << "Can't save Mojang account list. No file path given and no default set."; + qCritical() << "Can't save Mojang account list. No file path given and no default set."; return false; } @@ -359,16 +359,16 @@ bool MojangAccountList::saveList(const QString &filePath) badDir.removeRecursively(); } - QLOG_INFO() << "Writing account list to" << path; + qDebug() << "Writing account list to" << path; - QLOG_DEBUG() << "Building JSON data structure."; + qDebug() << "Building JSON data structure."; // Build the JSON document to write to the list file. QJsonObject root; root.insert("formatVersion", ACCOUNT_LIST_FORMAT_VERSION); // Build a list of accounts. - QLOG_DEBUG() << "Building account array."; + qDebug() << "Building account array."; QJsonArray accounts; for (MojangAccountPtr account : m_accounts) { @@ -389,14 +389,14 @@ bool MojangAccountList::saveList(const QString &filePath) QJsonDocument doc(root); // Now that we're done building the JSON object, we can write it to the file. - QLOG_DEBUG() << "Writing account list to file."; + qDebug() << "Writing account list to file."; QFile file(path); // Try to open the file and fail if we can't. // TODO: We should probably report this error to the user. if (!file.open(QIODevice::WriteOnly)) { - QLOG_ERROR() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); + qCritical() << QString("Failed to read the account list file (%1).").arg(path).toUtf8(); return false; } @@ -405,7 +405,7 @@ bool MojangAccountList::saveList(const QString &filePath) file.setPermissions(QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::WriteUser); file.close(); - QLOG_INFO() << "Saved account list to" << path; + qDebug() << "Saved account list to" << path; return true; } diff --git a/logic/auth/YggdrasilTask.cpp b/logic/auth/YggdrasilTask.cpp index 6b5ed256..4d5c2594 100644 --- a/logic/auth/YggdrasilTask.cpp +++ b/logic/auth/YggdrasilTask.cpp @@ -26,7 +26,7 @@ #include #include -#include "logger/QsLog.h" +#include YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent) : Task(parent), m_account(account) @@ -94,9 +94,9 @@ void YggdrasilTask::sslErrors(QList errors) int i = 1; for (auto error : errors) { - QLOG_ERROR() << "LOGIN SSL Error #" << i << " : " << error.errorString(); + qCritical() << "LOGIN SSL Error #" << i << " : " << error.errorString(); auto cert = error.certificate(); - QLOG_ERROR() << "Certificate in question:\n" << cert.toText(); + qCritical() << "Certificate in question:\n" << cert.toText(); i++; } } @@ -163,7 +163,7 @@ void YggdrasilTask::processReply() "JSON response: %1 at offset %2.") .arg(jsonError.errorString()) .arg(jsonError.offset)); - QLOG_ERROR() << replyData; + qCritical() << replyData; } return; } @@ -177,7 +177,7 @@ void YggdrasilTask::processReply() // We were able to parse the server's response. Woo! // Call processError. If a subclass has overridden it then they'll handle their // stuff there. - QLOG_DEBUG() << "The request failed, but the server gave us an error message. " + qDebug() << "The request failed, but the server gave us an error message. " "Processing error."; processError(doc.object()); } @@ -185,7 +185,7 @@ void YggdrasilTask::processReply() { // The server didn't say anything regarding the error. Give the user an unknown // error. - QLOG_DEBUG() + qDebug() << "The request failed and the server gave no error message. Unknown error."; changeState(STATE_FAILED_SOFT, tr("An unknown error occurred when trying to communicate with the " diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp index ed8c52fb..4141f00d 100644 --- a/logic/auth/flows/AuthenticateTask.cpp +++ b/logic/auth/flows/AuthenticateTask.cpp @@ -23,7 +23,7 @@ #include #include -#include "logger/QsLog.h" +#include AuthenticateTask::AuthenticateTask(MojangAccount * account, const QString &password, QObject *parent) @@ -74,11 +74,11 @@ void AuthenticateTask::processResponse(QJsonObject responseData) { // Read the response data. We need to get the client token, access token, and the selected // profile. - QLOG_DEBUG() << "Processing authentication response."; - // QLOG_DEBUG() << responseData; + qDebug() << "Processing authentication response."; + // qDebug() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. - QLOG_DEBUG() << "Getting client token."; + qDebug() << "Getting client token."; QString clientToken = responseData.value("clientToken").toString(""); if (clientToken.isEmpty()) { @@ -95,7 +95,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) m_account->m_clientToken = clientToken; // Now, we set the access token. - QLOG_DEBUG() << "Getting access token."; + qDebug() << "Getting access token."; QString accessToken = responseData.value("accessToken").toString(""); if (accessToken.isEmpty()) { @@ -110,7 +110,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // Mojang hasn't yet implemented the profile system, // but we might as well support what's there so we // don't have trouble implementing it later. - QLOG_DEBUG() << "Loading profile list."; + qDebug() << "Loading profile list."; QJsonArray availableProfiles = responseData.value("availableProfiles").toArray(); QList loadedProfiles; for (auto iter : availableProfiles) @@ -126,7 +126,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // This should never happen, but we might as well // warn about it if it does so we can debug it easily. // You never know when Mojang might do something truly derpy. - QLOG_WARN() << "Found entry in available profiles list with missing ID or name " + qWarning() << "Found entry in available profiles list with missing ID or name " "field. Ignoring it."; } @@ -140,7 +140,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // We do need to make sure that the current profile that the server gave us // is actually in the available profiles list. // If it isn't, we'll just fail horribly (*shouldn't* ever happen, but you never know). - QLOG_DEBUG() << "Setting current profile."; + qDebug() << "Setting current profile."; QJsonObject currentProfile = responseData.value("selectedProfile").toObject(); QString currentProfileId = currentProfile.value("id").toString(""); if (currentProfileId.isEmpty()) @@ -173,7 +173,7 @@ void AuthenticateTask::processResponse(QJsonObject responseData) // We've made it through the minefield of possible errors. Return true to indicate that // we've succeeded. - QLOG_DEBUG() << "Finished reading authentication response."; + qDebug() << "Finished reading authentication response."; changeState(STATE_SUCCEEDED); } diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp index 4ca73b21..2216c7e4 100644 --- a/logic/auth/flows/RefreshTask.cpp +++ b/logic/auth/flows/RefreshTask.cpp @@ -22,7 +22,7 @@ #include #include -#include "logger/QsLog.h" +#include RefreshTask::RefreshTask(MojangAccount *account) : YggdrasilTask(account) { @@ -63,9 +63,9 @@ void RefreshTask::processResponse(QJsonObject responseData) { // Read the response data. We need to get the client token, access token, and the selected // profile. - QLOG_DEBUG() << "Processing authentication response."; + qDebug() << "Processing authentication response."; - // QLOG_DEBUG() << responseData; + // qDebug() << responseData; // If we already have a client token, make sure the one the server gave us matches our // existing one. QString clientToken = responseData.value("clientToken").toString(""); @@ -82,7 +82,7 @@ void RefreshTask::processResponse(QJsonObject responseData) } // Now, we set the access token. - QLOG_DEBUG() << "Getting new access token."; + qDebug() << "Getting new access token."; QString accessToken = responseData.value("accessToken").toString(""); if (accessToken.isEmpty()) { @@ -120,7 +120,7 @@ void RefreshTask::processResponse(QJsonObject responseData) // We've made it through the minefield of possible errors. Return true to indicate that // we've succeeded. - QLOG_DEBUG() << "Finished reading refresh response."; + qDebug() << "Finished reading refresh response."; // Reset the access token. m_account->m_accessToken = accessToken; changeState(STATE_SUCCEEDED); diff --git a/logic/auth/flows/ValidateTask.cpp b/logic/auth/flows/ValidateTask.cpp index f3a8a23e..21afb596 100644 --- a/logic/auth/flows/ValidateTask.cpp +++ b/logic/auth/flows/ValidateTask.cpp @@ -23,7 +23,7 @@ #include #include -#include "logger/QsLog.h" +#include ValidateTask::ValidateTask(MojangAccount * account, QObject *parent) : YggdrasilTask(account, parent) diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp index 19cecaeb..b6fb426a 100644 --- a/logic/forge/ForgeInstaller.cpp +++ b/logic/forge/ForgeInstaller.cpp @@ -181,7 +181,7 @@ bool ForgeInstaller::add(OneSixInstance *to) // mark bad libraries based on the xzlist above for (auto entry : xzlist) { - QLOG_DEBUG() << "Testing " << rawName << " : " << entry; + qDebug() << "Testing " << rawName << " : " << entry; if (rawName.startsWith(entry)) { lib->setHint("forge-pack-xz"); @@ -260,7 +260,7 @@ bool ForgeInstaller::add(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } @@ -314,7 +314,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } @@ -352,7 +352,7 @@ protected: { if (!install(entry, forgeVersion)) { - QLOG_ERROR() << "Failure installing forge"; + qCritical() << "Failure installing forge"; emitFailed(tr("Failure to install forge")); } else diff --git a/logic/forge/ForgeMirrors.cpp b/logic/forge/ForgeMirrors.cpp index bb50d0b7..06abb88f 100644 --- a/logic/forge/ForgeMirrors.cpp +++ b/logic/forge/ForgeMirrors.cpp @@ -1,6 +1,6 @@ #include "logic/Env.h" #include "ForgeMirrors.h" -#include "logger/QsLog.h" +#include #include #include @@ -15,7 +15,7 @@ ForgeMirrors::ForgeMirrors(QList &libs, NetJobPtr parent_job void ForgeMirrors::start() { - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); auto worker = ENV.qnam(); @@ -33,7 +33,7 @@ void ForgeMirrors::start() void ForgeMirrors::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() + qCritical() << "Error getting URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error; m_status = Job_Failed; } diff --git a/logic/forge/ForgeVersionList.cpp b/logic/forge/ForgeVersionList.cpp index d7bb8af2..260f84eb 100644 --- a/logic/forge/ForgeVersionList.cpp +++ b/logic/forge/ForgeVersionList.cpp @@ -23,7 +23,7 @@ #include #include -#include "logger/QsLog.h" +#include ForgeVersionList::ForgeVersionList(QObject *parent) : BaseVersionList(parent) { @@ -338,7 +338,7 @@ bool ForgeListLoadTask::parseForgeGradleList(QList &out) fVersion->m_buildnr = number.value("build").toDouble(); if(fVersion->m_buildnr >= 953 && fVersion->m_buildnr <= 965) { - QLOG_DEBUG() << fVersion->m_buildnr; + qDebug() << fVersion->m_buildnr; } fVersion->jobbuildver = number.value("version").toString(); fVersion->branch = number.value("branch").toString(""); @@ -437,11 +437,11 @@ void ForgeListLoadTask::listFailed() auto reply = listDownload->m_reply; if (reply) { - QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); + qCritical() << "Getting forge version list failed: " << reply->errorString(); } else { - QLOG_ERROR() << "Getting forge version list failed for reasons unknown."; + qCritical() << "Getting forge version list failed for reasons unknown."; } } @@ -450,10 +450,10 @@ void ForgeListLoadTask::gradleListFailed() auto reply = gradleListDownload->m_reply; if (reply) { - QLOG_ERROR() << "Getting forge version list failed: " << reply->errorString(); + qCritical() << "Getting forge version list failed: " << reply->errorString(); } else { - QLOG_ERROR() << "Getting forge version list failed for reasons unknown."; + qCritical() << "Getting forge version list failed for reasons unknown."; } } diff --git a/logic/forge/ForgeXzDownload.cpp b/logic/forge/ForgeXzDownload.cpp index c2e5f76e..ac2c4b1f 100644 --- a/logic/forge/ForgeXzDownload.cpp +++ b/logic/forge/ForgeXzDownload.cpp @@ -21,7 +21,7 @@ #include #include #include -#include "logger/QsLog.h" +#include ForgeXzDownload::ForgeXzDownload(QString relative_path, MetaEntryPtr entry) : NetAction() { @@ -62,7 +62,7 @@ void ForgeXzDownload::start() return; } - QLOG_INFO() << "Downloading " << m_url.toString(); + qDebug() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->etag.toLatin1()); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)"); @@ -108,10 +108,10 @@ void ForgeXzDownload::failAndTryNextMirror() void ForgeXzDownload::updateUrl() { - QLOG_INFO() << "Updating URL for " << m_url_path; + qDebug() << "Updating URL for " << m_url_path; for (auto possible : m_mirrors) { - QLOG_INFO() << "Possible: " << possible.name << " : " << possible.mirror_url; + qDebug() << "Possible: " << possible.name << " : " << possible.mirror_url; } QString aggregate = m_mirrors[m_mirror_index].mirror_url + m_url_path + ".pack.xz"; m_url = QUrl(aggregate); @@ -121,10 +121,10 @@ void ForgeXzDownload::downloadFinished() { //TEST: defer to other possible mirrors (autofail the first one) /* - QLOG_INFO() <<"dl " << index_within_job << " mirror " << m_mirror_index; + qDebug() <<"dl " << index_within_job << " mirror " << m_mirror_index; if( m_mirror_index == 0) { - QLOG_INFO() <<"dl " << index_within_job << " AUTOFAIL"; + qDebug() <<"dl " << index_within_job << " AUTOFAIL"; m_status = Job_Failed; m_pack200_xz_file.close(); m_pack200_xz_file.remove(); @@ -270,38 +270,38 @@ void ForgeXzDownload::decompressAndInstall() break; case XZ_MEM_ERROR: - QLOG_ERROR() << "Memory allocation failed\n"; + qCritical() << "Memory allocation failed\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_MEMLIMIT_ERROR: - QLOG_ERROR() << "Memory usage limit reached\n"; + qCritical() << "Memory usage limit reached\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_FORMAT_ERROR: - QLOG_ERROR() << "Not a .xz file\n"; + qCritical() << "Not a .xz file\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_OPTIONS_ERROR: - QLOG_ERROR() << "Unsupported options in the .xz headers\n"; + qCritical() << "Unsupported options in the .xz headers\n"; xz_dec_end(s); failAndTryNextMirror(); return; case XZ_DATA_ERROR: case XZ_BUF_ERROR: - QLOG_ERROR() << "File is corrupt\n"; + qCritical() << "File is corrupt\n"; xz_dec_end(s); failAndTryNextMirror(); return; default: - QLOG_ERROR() << "Bug!\n"; + qCritical() << "Bug!\n"; xz_dec_end(s); failAndTryNextMirror(); return; @@ -316,35 +316,35 @@ void ForgeXzDownload::decompressAndInstall() // FIXME: dispose of file handles, pointers and the like. Ideally wrap in objects. if(handle_in == -1) { - QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); + qCritical() << "Error reopening " << pack200_file.fileName(); failAndTryNextMirror(); return; } FILE * file_in = fdopen(handle_in,"r"); if(!file_in) { - QLOG_ERROR() << "Error reopening " << pack200_file.fileName(); + qCritical() << "Error reopening " << pack200_file.fileName(); failAndTryNextMirror(); return; } QFile qfile_out(m_target_path); if(!qfile_out.open(QIODevice::WriteOnly)) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } int handle_out = qfile_out.handle(); if(handle_out == -1) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } FILE * file_out = fdopen(handle_out,"w"); if(!file_out) { - QLOG_ERROR() << "Error opening " << qfile_out.fileName(); + qCritical() << "Error opening " << qfile_out.fileName(); failAndTryNextMirror(); return; } @@ -355,7 +355,7 @@ void ForgeXzDownload::decompressAndInstall() catch (std::runtime_error &err) { m_status = Job_Failed; - QLOG_ERROR() << "Error unpacking " << pack200_file.fileName() << " : " << err.what(); + qCritical() << "Error unpacking " << pack200_file.fileName() << " : " << err.what(); QFile f(m_target_path); if (f.exists()) f.remove(); diff --git a/logic/ftb/FTBProfileStrategy.cpp b/logic/ftb/FTBProfileStrategy.cpp index d5b3c90f..87be0ff9 100644 --- a/logic/ftb/FTBProfileStrategy.cpp +++ b/logic/ftb/FTBProfileStrategy.cpp @@ -106,10 +106,10 @@ void FTBProfileStrategy::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) @@ -124,7 +124,7 @@ void FTBProfileStrategy::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") diff --git a/logic/ftb/OneSixFTBInstance.cpp b/logic/ftb/OneSixFTBInstance.cpp index 4de2ce78..4902be08 100644 --- a/logic/ftb/OneSixFTBInstance.cpp +++ b/logic/ftb/OneSixFTBInstance.cpp @@ -21,11 +21,11 @@ void OneSixFTBInstance::copy(const QDir &newDir) QStringList libraryNames; // create patch file { - QLOG_DEBUG() << "Creating patch file for FTB instance..."; + qDebug()<< "Creating patch file for FTB instance..."; QFile f(minecraftRoot() + "/pack.json"); if (!f.open(QFile::ReadOnly)) { - QLOG_ERROR() << "Couldn't open" << f.fileName() << ":" << f.errorString(); + qCritical() << "Couldn't open" << f.fileName() << ":" << f.errorString(); return; } QJsonObject root = QJsonDocument::fromJson(f.readAll()).object(); @@ -68,14 +68,14 @@ void OneSixFTBInstance::copy(const QDir &newDir) QFile out(newDir.absoluteFilePath("patches/ftb.json")); if (!out.open(QFile::WriteOnly | QFile::Truncate)) { - QLOG_ERROR() << "Couldn't open" << out.fileName() << ":" << out.errorString(); + qCritical() << "Couldn't open" << out.fileName() << ":" << out.errorString(); return; } out.write(QJsonDocument(root).toJson()); } // copy libraries { - QLOG_DEBUG() << "Copying FTB libraries"; + qDebug() << "Copying FTB libraries"; for (auto library : libraryNames) { OneSixLibrary *lib = new OneSixLibrary(library); @@ -86,11 +86,11 @@ void OneSixFTBInstance::copy(const QDir &newDir) } if (!ensureFilePathExists(out)) { - QLOG_ERROR() << "Couldn't create folder structure for" << out; + qCritical() << "Couldn't create folder structure for" << out; } if (!QFile::copy(librariesPath().absoluteFilePath(lib->storagePath()), out)) { - QLOG_ERROR() << "Couldn't copy" << lib->rawName(); + qCritical() << "Couldn't copy" << lib->rawName(); } } } diff --git a/logic/icons/IconList.cpp b/logic/icons/IconList.cpp index 964d61e9..40949392 100644 --- a/logic/icons/IconList.cpp +++ b/logic/icons/IconList.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #define MAX_SIZE 1024 @@ -84,7 +84,7 @@ void IconList::directoryChanged(const QString &path) for (auto remove : to_remove) { - QLOG_INFO() << "Removing " << remove; + qDebug() << "Removing " << remove; QFileInfo rmfile(remove); QString key = rmfile.baseName(); int idx = getIconIndex(key); @@ -108,7 +108,7 @@ void IconList::directoryChanged(const QString &path) for (auto add : to_add) { - QLOG_INFO() << "Adding " << add; + qDebug() << "Adding " << add; QFileInfo addfile(add); QString key = addfile.baseName(); if (addIcon(key, QString(), addfile.filePath(), MMCIcon::FileBased)) @@ -121,7 +121,7 @@ void IconList::directoryChanged(const QString &path) void IconList::fileChanged(const QString &path) { - QLOG_INFO() << "Checking " << path; + qDebug() << "Checking " << path; QFileInfo checkfile(path); if (!checkfile.exists()) return; @@ -153,11 +153,11 @@ void IconList::startWatching() is_watching = m_watcher->addPath(abs_path); if (is_watching) { - QLOG_INFO() << "Started watching " << abs_path; + qDebug() << "Started watching " << abs_path; } else { - QLOG_INFO() << "Failed to start watching " << abs_path; + qDebug() << "Failed to start watching " << abs_path; } } diff --git a/logic/java/JavaCheckerJob.cpp b/logic/java/JavaCheckerJob.cpp index 8fd423c1..149024c0 100644 --- a/logic/java/JavaCheckerJob.cpp +++ b/logic/java/JavaCheckerJob.cpp @@ -16,12 +16,12 @@ #include "JavaCheckerJob.h" #include "pathutils.h" -#include "logger/QsLog.h" +#include void JavaCheckerJob::partFinished(JavaCheckResult result) { num_finished++; - QLOG_INFO() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/" + qDebug() << m_job_name.toLocal8Bit() << "progress:" << num_finished << "/" << javacheckers.size(); emit progress(num_finished, javacheckers.size()); @@ -35,7 +35,7 @@ void JavaCheckerJob::partFinished(JavaCheckResult result) void JavaCheckerJob::start() { - QLOG_INFO() << m_job_name.toLocal8Bit() << " started."; + qDebug() << m_job_name.toLocal8Bit() << " started."; m_running = true; for (auto iter : javacheckers) { diff --git a/logic/java/JavaUtils.cpp b/logic/java/JavaUtils.cpp index a522f45c..3cacbbd2 100644 --- a/logic/java/JavaUtils.cpp +++ b/logic/java/JavaUtils.cpp @@ -21,7 +21,7 @@ #include #include -#include "logger/QsLog.h" +#include #include "logic/java/JavaUtils.h" #include "logic/java/JavaCheckerJob.h" #include "logic/java/JavaVersionList.h" @@ -197,7 +197,7 @@ QList JavaUtils::FindJavaPaths() #elif LINUX QList JavaUtils::FindJavaPaths() { - QLOG_INFO() << "Linux Java detection incomplete - defaulting to \"java\""; + qDebug() << "Linux Java detection incomplete - defaulting to \"java\""; QList javas; javas.append(this->GetDefaultJava()->path); @@ -209,7 +209,7 @@ QList JavaUtils::FindJavaPaths() #else QList JavaUtils::FindJavaPaths() { - QLOG_INFO() << "Unknown operating system build - defaulting to \"java\""; + qDebug() << "Unknown operating system build - defaulting to \"java\""; QList javas; javas.append(this->GetDefaultJava()->path); diff --git a/logic/java/JavaVersionList.cpp b/logic/java/JavaVersionList.cpp index 73e8259a..4f8592ce 100644 --- a/logic/java/JavaVersionList.cpp +++ b/logic/java/JavaVersionList.cpp @@ -17,7 +17,7 @@ #include #include -#include "logger/QsLog.h" +#include #include "logic/java/JavaVersionList.h" #include "logic/java/JavaCheckerJob.h" @@ -180,11 +180,11 @@ void JavaListLoadTask::executeTask() connect(m_job.get(), SIGNAL(finished(QList)), this, SLOT(javaCheckerFinished(QList))); connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int))); - QLOG_DEBUG() << "Probing the following Java paths: "; + qDebug() << "Probing the following Java paths: "; int id = 0; for(QString candidate : candidate_paths) { - QLOG_DEBUG() << " " << candidate; + qDebug() << " " << candidate; auto candidate_checker = new JavaChecker(); candidate_checker->path = candidate; @@ -207,7 +207,7 @@ void JavaListLoadTask::javaCheckerFinished(QList results) { QList candidates; - QLOG_DEBUG() << "Found the following valid Java installations:"; + qDebug() << "Found the following valid Java installations:"; for(JavaCheckResult result : results) { if(result.valid) @@ -219,14 +219,14 @@ void JavaListLoadTask::javaCheckerFinished(QList results) javaVersion->path = result.path; candidates.append(javaVersion); - QLOG_DEBUG() << " " << javaVersion->id << javaVersion->arch << javaVersion->path; + qDebug() << " " << javaVersion->id << javaVersion->arch << javaVersion->path; } } QList javas_bvp; for (auto java : candidates) { - //QLOG_INFO() << java->id << java->arch << " at " << java->path; + //qDebug() << java->id << java->arch << " at " << java->path; BaseVersionPtr bp_java = std::dynamic_pointer_cast(java); if (bp_java) diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp index a2728499..b105be08 100644 --- a/logic/liteloader/LiteLoaderInstaller.cpp +++ b/logic/liteloader/LiteLoaderInstaller.cpp @@ -18,7 +18,7 @@ #include #include -#include "logger/QsLog.h" +#include #include "logic/minecraft/MinecraftProfile.h" #include "logic/minecraft/OneSixLibrary.h" @@ -76,7 +76,7 @@ bool LiteLoaderInstaller::add(OneSixInstance *to) QFile file(filename(to->instanceRoot())); if (!file.open(QFile::WriteOnly)) { - QLOG_ERROR() << "Error opening" << file.fileName() + qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString(); return false; } diff --git a/logic/liteloader/LiteLoaderVersionList.cpp b/logic/liteloader/LiteLoaderVersionList.cpp index 48f098d0..89ea5df5 100644 --- a/logic/liteloader/LiteLoaderVersionList.cpp +++ b/logic/liteloader/LiteLoaderVersionList.cpp @@ -220,7 +220,7 @@ void LLListLoadTask::listDownloaded() } catch (MMCError &e) { - QLOG_ERROR() << "Couldn't read JSON object:"; + qCritical() << "Couldn't read JSON object:"; continue; } } diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 3fbfd105..9b97b95f 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -214,7 +214,7 @@ QList > 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; } } diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index 26b51731..2f549752 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -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); diff --git a/logic/minecraft/OneSixProfileStrategy.cpp b/logic/minecraft/OneSixProfileStrategy.cpp index 5c0658d0..9fcd0336 100644 --- a/logic/minecraft/OneSixProfileStrategy.cpp +++ b/logic/minecraft/OneSixProfileStrategy.cpp @@ -116,10 +116,10 @@ void OneSixProfileStrategy::loadUserPatches() QFileInfo finfo(filename); if(!finfo.exists()) { - QLOG_INFO() << "Patch file " << filename << " was de