summaryrefslogtreecommitdiffstats
path: root/api/logic/meta/Index.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-03-17 01:48:54 +0100
committerPetr Mrázek <peterix@gmail.com>2017-04-07 00:20:01 +0200
commit0060b506257b906d40ef53d1e23404dba76afcee (patch)
tree19060c5a8d6525bbed6a91afa249a17e678e37fa /api/logic/meta/Index.cpp
parent40cf38bc3225c614e7e81d074f890e6f9da0507b (diff)
downloadMultiMC-0060b506257b906d40ef53d1e23404dba76afcee.tar
MultiMC-0060b506257b906d40ef53d1e23404dba76afcee.tar.gz
MultiMC-0060b506257b906d40ef53d1e23404dba76afcee.tar.lz
MultiMC-0060b506257b906d40ef53d1e23404dba76afcee.tar.xz
MultiMC-0060b506257b906d40ef53d1e23404dba76afcee.zip
NOISSUE simplify.
Diffstat (limited to 'api/logic/meta/Index.cpp')
-rw-r--r--api/logic/meta/Index.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/api/logic/meta/Index.cpp b/api/logic/meta/Index.cpp
index 8a6b1355..e0e8bc5d 100644
--- a/api/logic/meta/Index.cpp
+++ b/api/logic/meta/Index.cpp
@@ -80,29 +80,36 @@ QVariant Index::headerData(int section, Qt::Orientation orientation, int role) c
std::unique_ptr<Task> Index::remoteUpdateTask()
{
- return std::unique_ptr<IndexRemoteLoadTask>(new IndexRemoteLoadTask(this, this));
+ return std::unique_ptr<RemoteLoadTask>(new RemoteLoadTask(this));
}
std::unique_ptr<Task> Index::localUpdateTask()
{
- return std::unique_ptr<IndexLocalLoadTask>(new IndexLocalLoadTask(this, this));
-}
-
-QJsonObject Index::serialized() const
-{
- return Format::serializeIndex(this);
+ return std::unique_ptr<LocalLoadTask>(new LocalLoadTask(this));
}
bool Index::hasUid(const QString &uid) const
{
return m_uids.contains(uid);
}
-VersionListPtr Index::getList(const QString &uid) const
+
+VersionListPtr Index::get(const QString &uid)
{
return m_uids.value(uid, nullptr);
}
-VersionListPtr Index::getListGuaranteed(const QString &uid) const
+
+VersionPtr Index::get(const QString &uid, const QString &version)
+{
+ auto list = get(uid);
+ if(list)
+ {
+ return list->getVersion(version);
+ }
+ return nullptr;
+}
+
+void Index::parse(const QJsonObject& obj)
{
- return m_uids.value(uid, std::make_shared<VersionList>(uid));
+ parseIndex(obj, this);
}
void Index::merge(const Ptr &other)