diff options
Diffstat (limited to 'logic/minecraft')
-rw-r--r-- | logic/minecraft/MinecraftVersionList.cpp | 15 | ||||
-rw-r--r-- | logic/minecraft/MinecraftVersionList.h | 3 | ||||
-rw-r--r-- | logic/minecraft/VersionFilterData.cpp | 4 | ||||
-rw-r--r-- | logic/minecraft/VersionFilterData.h | 4 |
4 files changed, 24 insertions, 2 deletions
diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index f57478e3..5f29bfec 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -364,7 +364,7 @@ QVariant MinecraftVersionList::data(const QModelIndex& index, int role) const return version->descriptor(); case RecommendedRole: - return version->descriptor() == "1.7.10"; + return version->descriptor() == g_VersionFilterData.recommendedMinecraftVersion; case TypeRole: return version->typeString(); @@ -386,6 +386,19 @@ BaseVersionPtr MinecraftVersionList::getLatestStable() const return BaseVersionPtr(); } +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(); +} + void MinecraftVersionList::updateListData(QList<BaseVersionPtr> versions) { beginResetModel(); diff --git a/logic/minecraft/MinecraftVersionList.h b/logic/minecraft/MinecraftVersionList.h index 7244d453..8e45d35a 100644 --- a/logic/minecraft/MinecraftVersionList.h +++ b/logic/minecraft/MinecraftVersionList.h @@ -53,7 +53,8 @@ public: virtual QVariant data(const QModelIndex & index, int role) const; virtual RoleList providesRoles(); - virtual BaseVersionPtr getLatestStable() const; + virtual BaseVersionPtr getLatestStable() const override; + virtual BaseVersionPtr getRecommended() const override; protected: QList<BaseVersionPtr> m_vlist; diff --git a/logic/minecraft/VersionFilterData.cpp b/logic/minecraft/VersionFilterData.cpp index ef8b049e..8270a490 100644 --- a/logic/minecraft/VersionFilterData.cpp +++ b/logic/minecraft/VersionFilterData.cpp @@ -69,4 +69,8 @@ VersionFilterData::VersionFilterData() QSet<QString>{"net.java.jinput:jinput", "net.java.jinput:jinput-platform", "net.java.jutils:jutils", "org.lwjgl.lwjgl:lwjgl", "org.lwjgl.lwjgl:lwjgl_util", "org.lwjgl.lwjgl:lwjgl-platform"}; + + // Version list magic + recommendedMinecraftVersion = "1.7.10"; + discouragedJavaVersion = "1.9.0"; } diff --git a/logic/minecraft/VersionFilterData.h b/logic/minecraft/VersionFilterData.h index 98ecb36c..339e3891 100644 --- a/logic/minecraft/VersionFilterData.h +++ b/logic/minecraft/VersionFilterData.h @@ -24,5 +24,9 @@ struct VersionFilterData QDateTime legacyCutoffDate; // Libraries that belong to LWJGL QSet<QString> lwjglWhitelist; + // Currently recommended minecraft version + QString recommendedMinecraftVersion; + // Currently discouraged java version (anything equal and above will be discouraged) + QString discouragedJavaVersion; }; extern VersionFilterData g_VersionFilterData; |