diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-09-18 00:08:42 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-09-18 00:08:42 +0200 |
commit | 930b07afd4229e952d0cd47ca62cd94235499a0c (patch) | |
tree | 34cd74c3652da4b3ad0fd008faa2ab67adb4901f /logic/lists/MinecraftVersionList.cpp | |
parent | 5cd3420c46e0b54f1479ddf720a8c9131c460a5e (diff) | |
parent | b979d0ce5da515793a02802a6421ef607a498323 (diff) | |
download | MultiMC-930b07afd4229e952d0cd47ca62cd94235499a0c.tar MultiMC-930b07afd4229e952d0cd47ca62cd94235499a0c.tar.gz MultiMC-930b07afd4229e952d0cd47ca62cd94235499a0c.tar.lz MultiMC-930b07afd4229e952d0cd47ca62cd94235499a0c.tar.xz MultiMC-930b07afd4229e952d0cd47ca62cd94235499a0c.zip |
Merge branch 'feature_library_model' into develop
Diffstat (limited to 'logic/lists/MinecraftVersionList.cpp')
-rw-r--r-- | logic/lists/MinecraftVersionList.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/logic/lists/MinecraftVersionList.cpp b/logic/lists/MinecraftVersionList.cpp index 42fb1b50..86ba0792 100644 --- a/logic/lists/MinecraftVersionList.cpp +++ b/logic/lists/MinecraftVersionList.cpp @@ -34,10 +34,8 @@ #define ASSETS_URLBASE "http://assets.minecraft.net/" #define MCN_URLBASE "http://sonicrules.org/mcnweb.py" -MinecraftVersionList mcVList; - MinecraftVersionList::MinecraftVersionList(QObject *parent) : - InstVersionList(parent) + BaseVersionList(parent) { } @@ -52,7 +50,7 @@ bool MinecraftVersionList::isLoaded() return m_loaded; } -const InstVersionPtr MinecraftVersionList::at(int i) const +const BaseVersionPtr MinecraftVersionList::at(int i) const { return m_vlist.at(i); } @@ -62,11 +60,11 @@ int MinecraftVersionList::count() const return m_vlist.count(); } -bool cmpVersions(InstVersionPtr first, InstVersionPtr second) +bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second) { - const InstVersion & left = *first; - const InstVersion & right = *second; - return left > right; + auto left = first.dynamicCast<MinecraftVersion>(); + auto right = second.dynamicCast<MinecraftVersion>(); + return left->timestamp > right->timestamp; } void MinecraftVersionList::sort() @@ -76,7 +74,7 @@ void MinecraftVersionList::sort() endResetModel(); } -InstVersionPtr MinecraftVersionList::getLatestStable() const +BaseVersionPtr MinecraftVersionList::getLatestStable() const { for (int i = 0; i < m_vlist.length(); i++) { @@ -86,15 +84,10 @@ InstVersionPtr MinecraftVersionList::getLatestStable() const return m_vlist.at(i); } } - return InstVersionPtr(); -} - -MinecraftVersionList &MinecraftVersionList::getMainList() -{ - return mcVList; + return BaseVersionPtr(); } -void MinecraftVersionList::updateListData(QList<InstVersionPtr > versions) +void MinecraftVersionList::updateListData(QList<BaseVersionPtr > versions) { beginResetModel(); m_vlist = versions; @@ -214,7 +207,7 @@ void MCVListLoadTask::list_downloaded() } QJsonArray versions = root.value("versions").toArray(); - QList<InstVersionPtr > tempList; + QList<BaseVersionPtr > tempList; for (int i = 0; i < versions.count(); i++) { bool is_snapshot = false; @@ -280,7 +273,7 @@ void MCVListLoadTask::list_downloaded() // Now, we construct the version object and add it to the list. QSharedPointer<MinecraftVersion> mcVersion(new MinecraftVersion()); - mcVersion->name = mcVersion->descriptor = versionID; + mcVersion->m_name = mcVersion->m_descriptor = versionID; mcVersion->timestamp = versionTime.toMSecsSinceEpoch(); mcVersion->download_url = dlUrl; mcVersion->is_latest = is_latest; @@ -293,8 +286,3 @@ void MCVListLoadTask::list_downloaded() emitSucceeded(); return; } - -// FIXME: we should have a local cache of the version list and a local cache of version data -bool MCVListLoadTask::loadFromVList() -{ -} |