diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-05-06 09:00:21 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-05-06 09:00:21 +0200 |
commit | 2a4647125d6fe25237256dd615c8c0338533a2b6 (patch) | |
tree | c5cbf5390557ad89484853b8a69fed7238b2fe9c /logic/minecraft/MinecraftVersionList.cpp | |
parent | 9598f80335ae4136e229cd4c5209dcede284e2b0 (diff) | |
download | MultiMC-2a4647125d6fe25237256dd615c8c0338533a2b6.tar MultiMC-2a4647125d6fe25237256dd615c8c0338533a2b6.tar.gz MultiMC-2a4647125d6fe25237256dd615c8c0338533a2b6.tar.lz MultiMC-2a4647125d6fe25237256dd615c8c0338533a2b6.tar.xz MultiMC-2a4647125d6fe25237256dd615c8c0338533a2b6.zip |
GH-942 fix vanilla version list
Latest release gets the star
Latest snapshot, if it's newer than latest release gets the bug
Diffstat (limited to 'logic/minecraft/MinecraftVersionList.cpp')
-rw-r--r-- | logic/minecraft/MinecraftVersionList.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index 5f29bfec..0e2cbf90 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -364,7 +364,21 @@ QVariant MinecraftVersionList::data(const QModelIndex& index, int role) const return version->descriptor(); case RecommendedRole: - return version->descriptor() == g_VersionFilterData.recommendedMinecraftVersion; + return version->descriptor() == m_latestReleaseID; + + case LatestRole: + { + if(version->descriptor() != m_latestSnapshotID) + return false; + MinecraftVersionPtr latestRelease = std::dynamic_pointer_cast<MinecraftVersion>(getLatestStable()); + /* + if(latestRelease && latestRelease->m_releaseTime > version->m_releaseTime) + { + return false; + } + */ + return true; + } case TypeRole: return version->typeString(); @@ -376,7 +390,7 @@ QVariant MinecraftVersionList::data(const QModelIndex& index, int role) const BaseVersionList::RoleList MinecraftVersionList::providesRoles() { - return {VersionPointerRole, VersionRole, VersionIdRole, RecommendedRole, TypeRole}; + return {VersionPointerRole, VersionRole, VersionIdRole, RecommendedRole, LatestRole, TypeRole}; } BaseVersionPtr MinecraftVersionList::getLatestStable() const @@ -388,14 +402,6 @@ BaseVersionPtr MinecraftVersionList::getLatestStable() const BaseVersionPtr MinecraftVersionList::getRecommended() const { - for(auto item: m_vlist) - { - auto version = std::dynamic_pointer_cast<MinecraftVersion>(item); - if(version->descriptor() == g_VersionFilterData.recommendedMinecraftVersion) - { - return item; - } - } return getLatestStable(); } |