diff options
Diffstat (limited to 'backend/MinecraftVersion.h')
-rw-r--r-- | backend/MinecraftVersion.h | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/backend/MinecraftVersion.h b/backend/MinecraftVersion.h index f5cf9805..5cd29925 100644 --- a/backend/MinecraftVersion.h +++ b/backend/MinecraftVersion.h @@ -18,50 +18,61 @@ #include "libmmc_config.h" #include "InstanceVersion.h" +#include <QStringList> -class LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion +struct LIBMULTIMC_EXPORT MinecraftVersion : public InstVersion { - Q_OBJECT + // From InstVersion: + /* + QString m_descriptor; + QString m_name; + qint64 m_timestamp; + */ -public: - explicit MinecraftVersion(QString descriptor, - QString name, - qint64 timestamp, - QString dlUrl, - QString etag, - InstVersionList *parent = 0); - - static InstVersion *mcnVersion(QString rawName, QString niceName); + /// The URL that this version will be downloaded from. maybe. + QString download_url; + /// This version's type. Used internally to identify what kind of version this is. enum VersionType { - OldSnapshot, - Stable, - CurrentStable, - Snapshot, + OneSix, + Legacy, Nostalgia - }; - - virtual QString descriptor() const; - virtual QString name() const; - virtual QString typeName() const; - virtual qint64 timestamp() const; - - virtual VersionType versionType() const; - virtual void setVersionType(VersionType typeName); + } type; - virtual QString downloadURL() const; - virtual QString etag() const; + /// is this the latest version? + bool is_latest = false; - virtual InstVersion *copyVersion(InstVersionList *newParent) const; + /// is this a snapshot? + bool is_snapshot = false; -private: - /// The URL that this version will be downloaded from. maybe. - QString m_dlUrl; - - /// ETag/MD5 Used to verify the integrity of the downloaded minecraft.jar. - QString m_etag; - - /// This version's type. Used internally to identify what kind of version this is. - VersionType m_type; + virtual QString typeString() const + { + QStringList pre_final; + if(is_latest == true) + { + pre_final.append("Latest"); + } + switch (type) + { + case OneSix: + pre_final.append("OneSix"); + break; + case Legacy: + pre_final.append("Legacy"); + break; + case Nostalgia: + pre_final.append("Nostalgia"); + break; + + default: + pre_final.append(QString("Type(%1)").arg(type)); + break; + } + if(is_snapshot == true) + { + pre_final.append("Snapshot"); + } + return pre_final.join(' '); + } }; |