From 2660418d58efb33cd3a0ab8ed9d48c359c076905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 19 Mar 2017 02:13:49 +0100 Subject: NOISSUE hack it together enough to get launching back Meta index will now always return valid objects. They just might never load if they don't exist on the server. --- api/logic/meta/Version.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'api/logic/meta/Version.cpp') diff --git a/api/logic/meta/Version.cpp b/api/logic/meta/Version.cpp index f8c865e7..2790b2f3 100644 --- a/api/logic/meta/Version.cpp +++ b/api/logic/meta/Version.cpp @@ -18,38 +18,45 @@ #include #include "JsonFormat.h" +#include "minecraft/MinecraftProfile.h" -namespace Meta +void Meta::Version::applyTo(MinecraftProfile* profile) { -Version::Version(const QString &uid, const QString &version) + if(m_data) + { + m_data->applyTo(profile); + } +} + +Meta::Version::Version(const QString &uid, const QString &version) : BaseVersion(), m_uid(uid), m_version(version) { } -QString Version::descriptor() +QString Meta::Version::descriptor() { return m_version; } -QString Version::name() +QString Meta::Version::name() { return m_version; } -QString Version::typeString() const +QString Meta::Version::typeString() const { return m_type; } -QDateTime Version::time() const +QDateTime Meta::Version::time() const { return QDateTime::fromMSecsSinceEpoch(m_time * 1000, Qt::UTC); } -void Version::parse(const QJsonObject& obj) +void Meta::Version::parse(const QJsonObject& obj) { parseVersion(obj, this); } -void Version::merge(const std::shared_ptr &other) +void Meta::Version::merge(const std::shared_ptr &other) { VersionPtr version = std::dynamic_pointer_cast(other); if (m_type != version->m_type) @@ -68,28 +75,28 @@ void Version::merge(const std::shared_ptr &other) setData(version->m_data); } -QString Version::localFilename() const +QString Meta::Version::localFilename() const { return m_uid + '/' + m_version + ".json"; } -void Version::setType(const QString &type) +void Meta::Version::setType(const QString &type) { m_type = type; emit typeChanged(); } -void Version::setTime(const qint64 time) +void Meta::Version::setTime(const qint64 time) { m_time = time; emit timeChanged(); } -void Version::setRequires(const QVector &requires) +void Meta::Version::setRequires(const QVector &requires) { m_requires = requires; emit requiresChanged(); } -void Version::setData(const VersionFilePtr &data) +void Meta::Version::setData(const VersionFilePtr &data) { m_data = data; } -} + -- cgit v1.2.3