GemInfo.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <QString>
  11. #include <QStringList>
  12. #include <QVector>
  13. #include <QMetaType>
  14. #endif
  15. namespace O3DE::ProjectManager
  16. {
  17. class GemInfo
  18. {
  19. public:
  20. enum Platform
  21. {
  22. Android = 1 << 0,
  23. iOS = 1 << 1,
  24. Linux = 1 << 2,
  25. macOS = 1 << 3,
  26. Windows = 1 << 4,
  27. NumPlatforms = 5
  28. };
  29. Q_DECLARE_FLAGS(Platforms, Platform)
  30. static QString GetPlatformString(Platform platform);
  31. enum Type
  32. {
  33. Asset = 1 << 0,
  34. Code = 1 << 1,
  35. Tool = 1 << 2,
  36. NumTypes = 3
  37. };
  38. Q_DECLARE_FLAGS(Types, Type)
  39. static QString GetTypeString(Type type);
  40. enum GemOrigin
  41. {
  42. Open3DEngine = 1 << 0,
  43. Local = 1 << 1,
  44. Remote = 1 << 2,
  45. NumGemOrigins = 3
  46. };
  47. Q_DECLARE_FLAGS(GemOrigins, GemOrigin)
  48. static QString GetGemOriginString(GemOrigin origin);
  49. enum DownloadStatus
  50. {
  51. UnknownDownloadStatus = -1,
  52. NotDownloaded,
  53. Downloading,
  54. DownloadSuccessful,
  55. DownloadFailed,
  56. Downloaded
  57. };
  58. static QString GetDownloadStatusString(DownloadStatus status);
  59. static Platforms GetPlatformFromString(const QString& platformText);
  60. static Platforms GetPlatformsFromStringList(const QStringList& platformStrings);
  61. GemInfo() = default;
  62. GemInfo(const QString& name, const QString& creator, const QString& summary, Platforms platforms, bool isAdded);
  63. bool IsPlatformSupported(Platform platform) const;
  64. QString GetNameWithVersionSpecifier(const QString& comparator = "==") const;
  65. bool IsValid() const;
  66. bool IsCompatible() const;
  67. bool operator<(const GemInfo& gemInfo) const;
  68. QStringList GetPlatformsAsStringList() const;
  69. QString m_path;
  70. QString m_name = "Unknown Gem Name";
  71. QString m_displayName;
  72. QString m_origin = "Unknown Creator";
  73. GemOrigin m_gemOrigin = Local;
  74. QString m_originURL;
  75. QString m_iconPath;
  76. bool m_isAdded = false; //! Is the gem explicitly added (not a dependency) and enabled in the project?
  77. bool m_isEngineGem = false;
  78. bool m_isProjectGem = false;
  79. QString m_summary = "No summary provided.";
  80. Platforms m_platforms;
  81. Types m_types; //! Asset and/or Code and/or Tool
  82. DownloadStatus m_downloadStatus = UnknownDownloadStatus;
  83. QStringList m_features;
  84. QString m_requirement;
  85. QString m_licenseText;
  86. QString m_licenseLink;
  87. QString m_directoryLink;
  88. QString m_documentationLink;
  89. QString m_repoUri;
  90. QString m_version = "Unknown Version";
  91. QString m_lastUpdatedDate = "Unknown Date";
  92. int m_binarySizeInKB = 0;
  93. QStringList m_dependencies;
  94. QStringList m_compatibleEngines;
  95. QStringList m_incompatibleEngineDependencies; //! Specific to the current project's engine
  96. QStringList m_incompatibleGemDependencies; //! Specific to the current project and engine
  97. QString m_downloadSourceUri;
  98. QString m_sourceControlUri;
  99. QString m_sourceControlRef;
  100. };
  101. } // namespace O3DE::ProjectManager
  102. Q_DECLARE_METATYPE(O3DE::ProjectManager::GemInfo);
  103. Q_DECLARE_OPERATORS_FOR_FLAGS(O3DE::ProjectManager::GemInfo::Platforms);
  104. Q_DECLARE_OPERATORS_FOR_FLAGS(O3DE::ProjectManager::GemInfo::Types);
  105. Q_DECLARE_OPERATORS_FOR_FLAGS(O3DE::ProjectManager::GemInfo::GemOrigins);