Simplify IndexedVersionType::VersionType -> IndexedVersionType

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-12-07 14:32:58 +00:00
parent fd3ae85d45
commit de5c7bac72
10 changed files with 33 additions and 75 deletions

View File

@@ -74,33 +74,9 @@ struct DonationData {
QString url;
};
struct IndexedVersionType {
enum class VersionType { Release = 1, Beta, Alpha, Unknown };
IndexedVersionType(const QString& type);
IndexedVersionType(const IndexedVersionType::VersionType& type);
IndexedVersionType(const IndexedVersionType& type);
IndexedVersionType() : IndexedVersionType(IndexedVersionType::VersionType::Unknown) {}
static const QString toString(const IndexedVersionType::VersionType& type);
static IndexedVersionType::VersionType enumFromString(const QString& type);
bool isValid() const { return m_type != IndexedVersionType::VersionType::Unknown; }
IndexedVersionType& operator=(const IndexedVersionType& other);
bool operator==(const IndexedVersionType& other) const { return m_type == other.m_type; }
bool operator==(const IndexedVersionType::VersionType& type) const { return m_type == type; }
bool operator!=(const IndexedVersionType& other) const { return m_type != other.m_type; }
bool operator!=(const IndexedVersionType::VersionType& type) const { return m_type != type; }
bool operator<(const IndexedVersionType& other) const { return m_type < other.m_type; }
bool operator<(const IndexedVersionType::VersionType& type) const { return m_type < type; }
bool operator<=(const IndexedVersionType& other) const { return m_type <= other.m_type; }
bool operator<=(const IndexedVersionType::VersionType& type) const { return m_type <= type; }
bool operator>(const IndexedVersionType& other) const { return m_type > other.m_type; }
bool operator>(const IndexedVersionType::VersionType& type) const { return m_type > type; }
bool operator>=(const IndexedVersionType& other) const { return m_type >= other.m_type; }
bool operator>=(const IndexedVersionType::VersionType& type) const { return m_type >= type; }
QString toString() const { return toString(m_type); }
IndexedVersionType::VersionType m_type;
};
enum class IndexedVersionType { Unknown, Release = 1, Beta, Alpha };
IndexedVersionType indexedVersionTypeFromString(const QString& type);
QString indexedVersionTypeToString(IndexedVersionType type);
struct Dependency {
QVariant addonId;
@@ -131,7 +107,7 @@ struct IndexedVersion {
QString getVersionDisplayString() const
{
auto release_type = version_type.isValid() ? QString(" [%1]").arg(version_type.toString()) : "";
auto release_type = version_type != IndexedVersionType::Unknown ? QString(" [%1]").arg(indexedVersionTypeToString(version_type)) : "";
auto versionStr = !version.contains(version_number) ? version_number : "";
QString gameVersion = "";
for (auto v : mcVersion) {