summaryrefslogtreecommitdiffstats
path: root/api/logic/meta/Version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/meta/Version.cpp')
-rw-r--r--api/logic/meta/Version.cpp55
1 files changed, 32 insertions, 23 deletions
diff --git a/api/logic/meta/Version.cpp b/api/logic/meta/Version.cpp
index b00a29e7..edc70f33 100644
--- a/api/logic/meta/Version.cpp
+++ b/api/logic/meta/Version.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2015-2017 MultiMC Contributors
+/* Copyright 2015-2018 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
#include <QDateTime>
#include "JsonFormat.h"
-#include "minecraft/MinecraftProfile.h"
+#include "minecraft/ComponentList.h"
Meta::Version::Version(const QString &uid, const QString &version)
: BaseVersion(), m_uid(uid), m_version(version)
@@ -54,47 +54,49 @@ void Meta::Version::parse(const QJsonObject& obj)
parseVersion(obj, this);
}
-void Meta::Version::merge(const std::shared_ptr<BaseEntity> &other)
+void Meta::Version::mergeFromList(const Meta::VersionPtr& other)
{
- VersionPtr version = std::dynamic_pointer_cast<Version>(other);
- if(version->m_providesRecommendations)
+ if(other->m_providesRecommendations)
{
- if(m_recommended != version->m_recommended)
+ if(m_recommended != other->m_recommended)
{
- setRecommended(version->m_recommended);
+ setRecommended(other->m_recommended);
}
}
- if (m_type != version->m_type)
+ if (m_type != other->m_type)
{
- setType(version->m_type);
+ setType(other->m_type);
}
- if (m_time != version->m_time)
+ if (m_time != other->m_time)
{
- setTime(version->m_time);
+ setTime(other->m_time);
}
- if (m_requires != version->m_requires)
+ if (m_requires != other->m_requires)
{
- setRequires(version->m_requires);
+ m_requires = other->m_requires;
}
- if (m_parentUid != version->m_parentUid)
+ if (m_conflicts != other->m_conflicts)
{
- setParentUid(version->m_parentUid);
+ m_conflicts = other->m_conflicts;
}
- if(version->m_data)
+ if(m_volatile != other->m_volatile)
{
- setData(version->m_data);
+ setVolatile(other->m_volatile);
}
}
-QString Meta::Version::localFilename() const
+void Meta::Version::merge(const VersionPtr &other)
{
- return m_uid + '/' + m_version + ".json";
+ mergeFromList(other);
+ if(other->m_data)
+ {
+ setData(other->m_data);
+ }
}
-void Meta::Version::setParentUid(const QString& parentUid)
+QString Meta::Version::localFilename() const
{
- m_parentUid = parentUid;
- emit requiresChanged();
+ return m_uid + '/' + m_version + ".json";
}
void Meta::Version::setType(const QString &type)
@@ -109,12 +111,19 @@ void Meta::Version::setTime(const qint64 time)
emit timeChanged();
}
-void Meta::Version::setRequires(const QHash<QString, QString> &requires)
+void Meta::Version::setRequires(const Meta::RequireSet &requires, const Meta::RequireSet &conflicts)
{
m_requires = requires;
+ m_conflicts = conflicts;
emit requiresChanged();
}
+void Meta::Version::setVolatile(bool volatile_)
+{
+ m_volatile = volatile_;
+}
+
+
void Meta::Version::setData(const VersionFilePtr &data)
{
m_data = data;