Browse Source

Remove unnecessary GemModel roles and functions

Signed-off-by: Alex Peterson <[email protected]>
Alex Peterson 2 years ago
parent
commit
10cbb5d5dc

+ 6 - 5
Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp

@@ -347,10 +347,11 @@ namespace O3DE::ProjectManager
         tags.reserve(gems.size());
         for (const QModelIndex& modelIndex : gems)
         {
-            if(GemModel::IsEngineGem(modelIndex))
+            const GemInfo& gemInfo = GemModel::GetGemInfo(modelIndex);
+            if(gemInfo.m_isEngineGem)
             {
                 // don't show engine gem versions
-                tags.push_back({ GemModel::GetDisplayName(modelIndex), GemModel::GetName(modelIndex) });
+                tags.push_back({ gemInfo.m_displayName, gemInfo.m_name });
             }
             else
             {
@@ -363,12 +364,12 @@ namespace O3DE::ProjectManager
 
                 if (version.isEmpty() || version.contains("Unknown", Qt::CaseInsensitive))
                 {
-                    tags.push_back({ GemModel::GetDisplayName(modelIndex), GemModel::GetName(modelIndex) });
+                    tags.push_back({ gemInfo.m_displayName, gemInfo.m_name });
                 }
                 else
                 {
-                    const QString& title = QString("%1 %2").arg(GemModel::GetDisplayName(modelIndex), version);
-                    tags.push_back({ title, GemModel::GetName(modelIndex) });
+                    const QString& title = QString("%1 %2").arg(gemInfo.m_displayName, version);
+                    tags.push_back({ title, gemInfo.m_name });
                 }
             }
 

+ 10 - 12
Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp

@@ -57,6 +57,7 @@ namespace O3DE::ProjectManager
 
         // default to sort by gem display name 
         m_proxyModel->setSortRole(GemModel::RoleDisplayName);
+        m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
 
         QVBoxLayout* vLayout = new QVBoxLayout();
         vLayout->setMargin(0);
@@ -452,15 +453,12 @@ namespace O3DE::ProjectManager
 
     void GemCatalogScreen::UpdateGem(const QModelIndex& modelIndex)
     {
-        const QString selectedGemName = m_gemModel->GetName(modelIndex);
-        const QString selectedGemLastUpdate = m_gemModel->GetLastUpdated(modelIndex);
-        const QString selectedDisplayGemName = m_gemModel->GetDisplayName(modelIndex);
-        const QString selectedGemRepoUri = m_gemModel->GetRepoUri(modelIndex);
+        const GemInfo& gemInfo = m_gemModel->GetGemInfo(modelIndex);
 
         // Refresh gem repo
-        if (!selectedGemRepoUri.isEmpty())
+        if (!gemInfo.m_repoUri.isEmpty())
         {
-            AZ::Outcome<void, AZStd::string> refreshResult = PythonBindingsInterface::Get()->RefreshGemRepo(selectedGemRepoUri);
+            AZ::Outcome<void, AZStd::string> refreshResult = PythonBindingsInterface::Get()->RefreshGemRepo(gemInfo.m_repoUri);
             if (refreshResult.IsSuccess())
             {
                 Refresh();
@@ -469,7 +467,7 @@ namespace O3DE::ProjectManager
             {
                 QMessageBox::critical(
                     this, tr("Operation failed"),
-                    tr("Failed to refresh gem repository %1<br>Error:<br>%2").arg(selectedGemRepoUri, refreshResult.GetError().c_str()));
+                    tr("Failed to refresh gem repository %1<br>Error:<br>%2").arg(gemInfo.m_repoUri, refreshResult.GetError().c_str()));
             }
         }
         // If repo uri isn't specified warn user that repo might not be refreshed
@@ -479,7 +477,7 @@ namespace O3DE::ProjectManager
                 this, tr("Gem Repository Unspecified"),
                 tr("The repo for %1 is unspecfied. Repository cannot be automatically refreshed. "
                    "Please ensure this gem's repo is refreshed before attempting to update.")
-                    .arg(selectedDisplayGemName),
+                    .arg(gemInfo.m_displayName),
                 QMessageBox::Cancel, QMessageBox::Ok);
 
             // Allow user to cancel update to manually refresh repo
@@ -490,12 +488,12 @@ namespace O3DE::ProjectManager
         }
 
         // Check if there is an update avaliable now that repo is refreshed
-        bool updateAvaliable = PythonBindingsInterface::Get()->IsGemUpdateAvaliable(selectedGemName, selectedGemLastUpdate);
+        bool updateAvaliable = PythonBindingsInterface::Get()->IsGemUpdateAvaliable(gemInfo.m_name, gemInfo.m_lastUpdatedDate);
 
-        GemUpdateDialog* confirmUpdateDialog = new GemUpdateDialog(selectedGemName, updateAvaliable, this);
+        GemUpdateDialog* confirmUpdateDialog = new GemUpdateDialog(gemInfo.m_name, updateAvaliable, this);
         if (confirmUpdateDialog->exec() == QDialog::Accepted)
         {
-            m_downloadController->AddObjectDownload(selectedGemName, "" , DownloadController::DownloadObjectType::Gem);
+            m_downloadController->AddObjectDownload(gemInfo.m_name, "" , DownloadController::DownloadObjectType::Gem);
         }
     }
 
@@ -506,7 +504,7 @@ namespace O3DE::ProjectManager
         GemUninstallDialog* confirmUninstallDialog = new GemUninstallDialog(selectedDisplayGemName, this);
         if (confirmUninstallDialog->exec() == QDialog::Accepted)
         {
-            const QString selectedGemPath = m_gemModel->GetPath(modelIndex);
+            const QString& selectedGemPath = m_gemModel->GetGemInfo(modelIndex).m_path;
 
             const bool wasAdded = GemModel::WasPreviouslyAdded(modelIndex);
             const bool wasAddedDependency = GemModel::WasPreviouslyAddedDependency(modelIndex);

+ 4 - 4
Code/Tools/ProjectManager/Source/GemCatalog/GemFilterWidget.cpp

@@ -402,7 +402,7 @@ namespace O3DE::ProjectManager
             m_originFilter, "Provider", GemInfo::NumGemOrigins,
             [](GemModel* gemModel, GemInfo::GemOrigin origin, int gemIndex)
             {
-                return origin == gemModel->GetGemOrigin(gemModel->index(gemIndex, 0)); 
+                return origin == gemModel->GetGemInfo(gemModel->index(gemIndex, 0)).m_gemOrigin; 
             },
             &GemInfo::GetGemOriginString, &GemSortFilterProxyModel::GetGemOrigins, &GemSortFilterProxyModel::SetGemOrigins
         );
@@ -414,7 +414,7 @@ namespace O3DE::ProjectManager
             m_typeFilter, "Type", GemInfo::NumTypes,
             [](GemModel* gemModel, GemInfo::Type type, int gemIndex)
             {
-                return static_cast<bool>(type & gemModel->GetTypes(gemModel->index(gemIndex, 0)));
+                return static_cast<bool>(type & gemModel->GetGemInfo(gemModel->index(gemIndex, 0)).m_types);
             },
             &GemInfo::GetTypeString, &GemSortFilterProxyModel::GetTypes, &GemSortFilterProxyModel::SetTypes);
     }
@@ -425,7 +425,7 @@ namespace O3DE::ProjectManager
             m_platformFilter, "Platforms", GemInfo::NumPlatforms,
             [](GemModel* gemModel, GemInfo::Platform platform, int gemIndex)
             {
-                return static_cast<bool>(platform & gemModel->GetPlatforms(gemModel->index(gemIndex, 0)));
+                return static_cast<bool>(platform & gemModel->GetGemInfo(gemModel->index(gemIndex, 0)).m_platforms);
             },
             &GemInfo::GetPlatformString, &GemSortFilterProxyModel::GetPlatforms, &GemSortFilterProxyModel::SetPlatforms);
     }
@@ -437,7 +437,7 @@ namespace O3DE::ProjectManager
         const int numGems = m_gemModel->rowCount();
         for (int gemIndex = 0; gemIndex < numGems; ++gemIndex)
         {
-            const QStringList features = m_gemModel->GetFeatures(m_gemModel->index(gemIndex, 0));
+            const QStringList& features = m_gemModel->GetGemInfo(m_gemModel->index(gemIndex, 0)).m_features;
             for (const QString& feature : features)
             {
                 if (!uniqueFeatureCounts.contains(feature))

+ 4 - 5
Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.cpp

@@ -144,9 +144,8 @@ namespace O3DE::ProjectManager
         // Versions
         disconnect(m_versionComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GemInspector::OnVersionChanged);
         m_versionComboBox->clear();
-        const bool isEngineGem = gemInfo.IsEngineGem();
         auto gemVersions = m_model->GetGemVersions(modelIndex);
-        if (isEngineGem || gemVersions.count() < 2)
+        if (gemInfo.m_isEngineGem || gemVersions.count() < 2)
         {
             m_versionComboBox->setVisible(false);
             m_versionLabel->setText(gemInfo.m_version);
@@ -177,9 +176,9 @@ namespace O3DE::ProjectManager
         }
 
         // Compatible engines
-        m_enginesTitleLabel->setVisible(!isEngineGem);
-        m_enginesLabel->setVisible(!isEngineGem);
-        if (!isEngineGem)
+        m_enginesTitleLabel->setVisible(!gemInfo.m_isEngineGem);
+        m_enginesLabel->setVisible(!gemInfo.m_isEngineGem);
+        if (!gemInfo.m_isEngineGem)
         {
             if (gemInfo.m_compatibleEngines.isEmpty())
             {

+ 17 - 20
Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp

@@ -83,6 +83,8 @@ namespace O3DE::ProjectManager
             return;
         }
 
+        const GemInfo& gemInfo = GemModel::GetGemInfo(modelIndex);
+
         QStyleOptionViewItem options(option);
         initStyleOption(&options, modelIndex);
 
@@ -119,7 +121,7 @@ namespace O3DE::ProjectManager
         }
 
         // Gem preview
-        QString previewPath = QDir(GemModel::GetPath(modelIndex)).filePath(ProjectPreviewImagePath);
+        QString previewPath = QDir(gemInfo.m_path).filePath(ProjectPreviewImagePath);
         QPixmap gemPreviewImage(previewPath);
         QRect gemPreviewRect(
             contentRect.left() + AdjustableHeaderWidget::s_headerTextIndent,
@@ -127,8 +129,7 @@ namespace O3DE::ProjectManager
             GemPreviewImageWidth, GemPreviewImageHeight);
         painter->drawPixmap(gemPreviewRect, gemPreviewImage);
 
-        // Gem name
-        QString gemName = GemModel::GetDisplayName(modelIndex);
+        // Gem (dispay) name
         QFont gemNameFont(options.font);
         QPair<int, int> nameXBounds = CalcColumnXBounds(HeaderOrder::Name);
         const int nameStartX = nameXBounds.first;
@@ -136,7 +137,7 @@ namespace O3DE::ProjectManager
         const int nameColumnMaxTextWidth = nameXBounds.second - nameStartX - AdjustableHeaderWidget::s_headerTextIndent;
         gemNameFont.setPixelSize(static_cast<int>(s_gemNameFontSize));
         gemNameFont.setBold(true);
-        gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, nameColumnMaxTextWidth);
+        QString gemName = QFontMetrics(gemNameFont).elidedText(gemInfo.m_displayName, Qt::TextElideMode::ElideRight, nameColumnMaxTextWidth);
         QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize);
         gemNameRect.moveTo(nameColumnTextStartX, contentRect.top());
         painter->setFont(gemNameFont);
@@ -145,7 +146,7 @@ namespace O3DE::ProjectManager
         painter->drawText(gemNameRect, Qt::TextSingleLine, gemName);
 
         // Gem creator
-        QString gemCreator = GemModel::GetCreator(modelIndex);
+        QString gemCreator = gemInfo.m_origin;
         gemCreator = standardFontMetrics.elidedText(gemCreator, Qt::TextElideMode::ElideRight, nameColumnMaxTextWidth);
         QRect gemCreatorRect = GetTextRect(standardFont, gemCreator, s_fontSize);
         gemCreatorRect.moveTo(nameColumnTextStartX, contentRect.top() + gemNameRect.height());
@@ -155,22 +156,19 @@ namespace O3DE::ProjectManager
         painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
 
         // Gem summary
-        const QStringList featureTags = GemModel::GetFeatures(modelIndex);
-        const bool hasTags = !featureTags.isEmpty();
-        const QString summary = GemModel::GetSummary(modelIndex);
+        const bool hasTags = !gemInfo.m_features.isEmpty();
         const QRect summaryRect = CalcSummaryRect(contentRect, hasTags);
-        DrawText(summary, painter, summaryRect, standardFont);
+        DrawText(gemInfo.m_summary, painter, summaryRect, standardFont);
 
         // Gem Version
         // include the version in the name if it isn't unknown
-        QString gemVersion = GemModel::GetVersion(modelIndex);
-        if (!gemVersion.isEmpty() && !gemVersion.contains("unknown", Qt::CaseInsensitive))
+        if (!gemInfo.m_version.isEmpty() && !gemInfo.m_version.contains("unknown", Qt::CaseInsensitive))
         {
             QPair<int, int> versionXBounds = CalcColumnXBounds(HeaderOrder::Version);
             QRect gemVersionRect{ versionXBounds.first, contentRect.top(), versionXBounds.second - versionXBounds.first, contentRect.height() };
             painter->setFont(standardFont);
-            gemVersionRect = painter->boundingRect(gemVersionRect, Qt::TextWordWrap | Qt::AlignRight | Qt::AlignVCenter, gemVersion);
-            painter->drawText(gemVersionRect, Qt::TextWordWrap | Qt::AlignRight | Qt::AlignVCenter, gemVersion);
+            gemVersionRect = painter->boundingRect(gemVersionRect, Qt::TextWordWrap | Qt::AlignRight | Qt::AlignVCenter, gemInfo.m_version);
+            painter->drawText(gemVersionRect, Qt::TextWordWrap | Qt::AlignRight | Qt::AlignVCenter, gemInfo.m_version);
         }
 
         QRect buttonRect = CalcButtonRect(contentRect);
@@ -180,7 +178,7 @@ namespace O3DE::ProjectManager
             DrawButton(painter, buttonRect, modelIndex);
         }
         DrawPlatformText(painter, contentRect, standardFont, modelIndex);
-        DrawFeatureTags(painter, contentRect, featureTags, standardFont, summaryRect);
+        DrawFeatureTags(painter, contentRect, gemInfo.m_features, standardFont, summaryRect);
 
         painter->restore();
     }
@@ -244,13 +242,12 @@ namespace O3DE::ProjectManager
             }
 
             // we must manually handle html links because we aren't using QLabels
-            const QStringList featureTags = GemModel::GetFeatures(modelIndex);
-            const bool hasTags = !featureTags.isEmpty();
+            const GemInfo& gemInfo = GemModel::GetGemInfo(modelIndex);
+            const bool hasTags = !gemInfo.m_features.isEmpty();
             const QRect summaryRect = CalcSummaryRect(contentRect, hasTags);
             if (summaryRect.contains(mouseEvent->pos()))
             {
-                const QString html = GemModel::GetSummary(modelIndex);
-                QString anchor = anchorAt(html, mouseEvent->pos(), summaryRect);
+                QString anchor = anchorAt(gemInfo.m_summary, mouseEvent->pos(), summaryRect);
                 if (!anchor.isEmpty())
                 {
                     QDesktopServices::openUrl(QUrl(anchor));
@@ -362,7 +359,7 @@ namespace O3DE::ProjectManager
 
     void GemItemDelegate::DrawPlatformIcons(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const
     {
-        const GemInfo::Platforms platforms = GemModel::GetPlatforms(modelIndex);
+        const GemInfo::Platforms platforms = GemModel::GetGemInfo(modelIndex).m_platforms;
         int startX = s_itemMargins.left() + CalcColumnXBounds(HeaderOrder::Name).first + AdjustableHeaderWidget::s_headerTextIndent;
 
         // Iterate and draw the platforms in the order they are defined in the enum.
@@ -388,7 +385,7 @@ namespace O3DE::ProjectManager
 
     void GemItemDelegate::DrawPlatformText(QPainter* painter, const QRect& contentRect, const QFont& standardFont, const QModelIndex& modelIndex) const
     {
-        const GemInfo::Platforms platforms = GemModel::GetPlatforms(modelIndex);
+        const GemInfo::Platforms platforms = GemModel::GetGemInfo(modelIndex).m_platforms;
         
         auto xbounds = CalcColumnXBounds(HeaderOrder::Name);
         const int startX = s_platformTextleftMarginCorrection + xbounds.first;

+ 1 - 113
Code/Tools/ProjectManager/Source/GemCatalog/GemModel.cpp

@@ -37,25 +37,9 @@ namespace O3DE::ProjectManager
         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
         item->setData(gemInfo.m_name, GemModel::RoleName);
         item->setData(gemInfo.m_displayName, GemModel::RoleDisplayName);
-        item->setData(gemInfo.m_origin, GemModel::RoleCreator);
-        item->setData(gemInfo.m_gemOrigin, GemModel::RoleGemOrigin);
-        item->setData(aznumeric_cast<int>(gemInfo.m_platforms), GemModel::RolePlatforms);
-        item->setData(aznumeric_cast<int>(gemInfo.m_types), GemModel::RoleTypes);
-        item->setData(gemInfo.m_summary, GemModel::RoleSummary);
-        item->setData(gemInfo.m_directoryLink, GemModel::RoleDirectoryLink);
-        item->setData(gemInfo.m_documentationLink, GemModel::RoleDocLink);
         item->setData(gemInfo.m_dependencies, GemModel::RoleDependingGems);
         item->setData(gemInfo.m_version, GemModel::RoleVersion);
-        item->setData(gemInfo.m_lastUpdatedDate, GemModel::RoleLastUpdated);
-        item->setData(gemInfo.m_binarySizeInKB, GemModel::RoleBinarySize);
-        item->setData(gemInfo.m_features, GemModel::RoleFeatures);
-        item->setData(gemInfo.m_path, GemModel::RolePath);
-        item->setData(gemInfo.m_requirement, GemModel::RoleRequirement);
         item->setData(gemInfo.m_downloadStatus, GemModel::RoleDownloadStatus);
-        item->setData(gemInfo.m_licenseText, GemModel::RoleLicenseText);
-        item->setData(gemInfo.m_licenseLink, GemModel::RoleLicenseLink);
-        item->setData(gemInfo.m_repoUri, GemModel::RoleRepoUri);
-        item->setData(gemInfo.IsEngineGem(), GemModel::RoleIsEngineGem);
 
         if (!metaDataOnly)
         {
@@ -126,11 +110,6 @@ namespace O3DE::ProjectManager
 
                 m_nameToIndexMap[gemInfo.m_name] = modelIndex;
             }
-
-            if (modelIndex.isValid() && !!gemInfo.m_path.isEmpty())
-            {
-                m_pathToIndexMap[gemInfo.m_path] = modelIndex;
-            }
         }
 
         blockSignals(false);
@@ -349,51 +328,11 @@ namespace O3DE::ProjectManager
         }
     }
 
-    QString GemModel::GetCreator(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleCreator).toString();
-    }
-
-    GemInfo::GemOrigin GemModel::GetGemOrigin(const QModelIndex& modelIndex)
-    {
-        return static_cast<GemInfo::GemOrigin>(modelIndex.data(RoleGemOrigin).toInt());
-    }
-
-    GemInfo::Platforms GemModel::GetPlatforms(const QModelIndex& modelIndex)
-    {
-        return static_cast<GemInfo::Platforms>(modelIndex.data(RolePlatforms).toInt());
-    }
-
-    GemInfo::Types GemModel::GetTypes(const QModelIndex& modelIndex)
-    {
-        return static_cast<GemInfo::Types>(modelIndex.data(RoleTypes).toInt());
-    }
-
     GemInfo::DownloadStatus GemModel::GetDownloadStatus(const QModelIndex& modelIndex)
     {
         return static_cast<GemInfo::DownloadStatus>(modelIndex.data(RoleDownloadStatus).toInt());
     }
 
-    bool GemModel::IsEngineGem(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleIsEngineGem).toBool();
-    }
-
-    QString GemModel::GetSummary(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleSummary).toString();
-    }
-
-    QString GemModel::GetDirectoryLink(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleDirectoryLink).toString();
-    }
-
-    QString GemModel::GetDocLink(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleDocLink).toString();
-    }
-
     QModelIndex GemModel::FindIndexByNameString(const QString& nameString) const
     {
         const auto iterator = m_nameToIndexMap.find(nameString);
@@ -405,17 +344,6 @@ namespace O3DE::ProjectManager
         return {};
     }
 
-    QModelIndex GemModel::FindIndexByPath(const QString& path) const
-    {
-        const auto iterator = m_pathToIndexMap.find(path);
-        if (iterator != m_pathToIndexMap.end())
-        {
-            return iterator.value();
-        }
-
-        return {};
-    }
-
     QStringList GemModel::GetDependingGems(const QModelIndex& modelIndex)
     {
         return modelIndex.data(RoleDependingGems).toStringList();
@@ -474,46 +402,6 @@ namespace O3DE::ProjectManager
         return modelIndex.data(RoleNewVersion).toString();
     }
 
-    QString GemModel::GetLastUpdated(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleLastUpdated).toString();
-    }
-
-    int GemModel::GetBinarySizeInKB(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleBinarySize).toInt();
-    }
-
-    QStringList GemModel::GetFeatures(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleFeatures).toStringList();
-    }
-
-    QString GemModel::GetPath(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RolePath).toString();
-    }
-
-    QString GemModel::GetRequirement(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleRequirement).toString();
-    }
-
-    QString GemModel::GetLicenseText(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleLicenseText).toString();
-    }
-
-    QString GemModel::GetLicenseLink(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleLicenseLink).toString();
-    }
-
-    QString GemModel::GetRepoUri(const QModelIndex& modelIndex)
-    {
-        return modelIndex.data(RoleRepoUri).toString();
-    }
-
     GemModel* GemModel::GetSourceModel(QAbstractItemModel* model)
     {
         GemSortFilterProxyModel* proxyModel = qobject_cast<GemSortFilterProxyModel*>(model);
@@ -765,7 +653,7 @@ namespace O3DE::ProjectManager
 
     bool GemModel::HasRequirement(const QModelIndex& modelIndex)
     {
-        return !modelIndex.data(RoleRequirement).toString().isEmpty();
+        return !GemModel::GetGemInfo(modelIndex).m_requirement.isEmpty();
     }
 
     bool GemModel::DoGemsToBeAddedHaveRequirements() const

+ 2 - 35
Code/Tools/ProjectManager/Source/GemCatalog/GemModel.h

@@ -31,31 +31,15 @@ namespace O3DE::ProjectManager
         {
             RoleName = Qt::UserRole,
             RoleDisplayName,
-            RoleCreator,
-            RoleGemOrigin,
-            RolePlatforms,
-            RoleSummary,
             RoleWasPreviouslyAdded,
             RoleWasPreviouslyAddedDependency,
             RoleIsAdded,
             RoleIsAddedDependency,
-            RoleDirectoryLink,
-            RoleDocLink,
             RoleDependingGems,
             RoleVersion,            // the current version
             RoleNewVersion,         // the new version the user wants to use
-            RoleLastUpdated,
-            RoleBinarySize,
-            RoleFeatures,
-            RoleTypes,
-            RolePath,
-            RoleRequirement,
             RoleDownloadStatus,
-            RoleLicenseText,
-            RoleLicenseLink,
-            RoleRepoUri,
-            RoleGemInfoVersions,
-            RoleIsEngineGem
+            RoleGemInfoVersions
         };
 
         QModelIndex AddGem(const GemInfo& gemInfo);
@@ -67,7 +51,6 @@ namespace O3DE::ProjectManager
         void UpdateGemDependencies();
 
         QModelIndex FindIndexByNameString(const QString& nameString) const;
-        QModelIndex FindIndexByPath(const QString& path) const;
         QVector<Tag> GetDependingGemTags(const QModelIndex& modelIndex);
         bool HasDependentGems(const QModelIndex& modelIndex) const;
 
@@ -75,24 +58,9 @@ namespace O3DE::ProjectManager
         static const QStringList GetGemVersions(const QModelIndex& modelIndex);
         static QString GetName(const QModelIndex& modelIndex);
         static QString GetDisplayName(const QModelIndex& modelIndex);
-        static QString GetCreator(const QModelIndex& modelIndex);
-        static GemInfo::GemOrigin GetGemOrigin(const QModelIndex& modelIndex);
-        static GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex);
-        static GemInfo::Types GetTypes(const QModelIndex& modelIndex);
         static GemInfo::DownloadStatus GetDownloadStatus(const QModelIndex& modelIndex);
-        static QString GetSummary(const QModelIndex& modelIndex);
-        static QString GetDirectoryLink(const QModelIndex& modelIndex);
-        static QString GetDocLink(const QModelIndex& modelIndex);
         static QString GetVersion(const QModelIndex& modelIndex);
         static QString GetNewVersion(const QModelIndex& modelIndex);
-        static QString GetLastUpdated(const QModelIndex& modelIndex);
-        static int GetBinarySizeInKB(const QModelIndex& modelIndex);
-        static QStringList GetFeatures(const QModelIndex& modelIndex);
-        static QString GetPath(const QModelIndex& modelIndex);
-        static QString GetRequirement(const QModelIndex& modelIndex);
-        static QString GetLicenseText(const QModelIndex& modelIndex);
-        static QString GetLicenseLink(const QModelIndex& modelIndex);
-        static QString GetRepoUri(const QModelIndex& modelIndex);
         static GemModel* GetSourceModel(QAbstractItemModel* model);
         static const GemModel* GetSourceModel(const QAbstractItemModel* model);
 
@@ -100,6 +68,7 @@ namespace O3DE::ProjectManager
         static bool IsAddedDependency(const QModelIndex& modelIndex);
         static void SetIsAdded(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded, const QString& version = "");
         static void SetIsAddedDependency(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded);
+
         //! Set the version the user confirms they want to use
         static void SetNewVersion(QAbstractItemModel& model, const QModelIndex& modelIndex, const QString& version);
         static void SetWasPreviouslyAdded(QAbstractItemModel& model, const QModelIndex& modelIndex, bool wasAdded);
@@ -113,7 +82,6 @@ namespace O3DE::ProjectManager
         static void UpdateWithVersion(QAbstractItemModel& model, const QModelIndex& modelIndex, const QString& version);
         static void DeactivateDependentGems(QAbstractItemModel& model, const QModelIndex& modelIndex);
         static void SetDownloadStatus(QAbstractItemModel& model, const QModelIndex& modelIndex, GemInfo::DownloadStatus status);
-        static bool IsEngineGem(const QModelIndex& modelIndex);
 
         bool DoGemsToBeAddedHaveRequirements() const;
         bool HasDependentGemsToRemove() const;
@@ -138,7 +106,6 @@ namespace O3DE::ProjectManager
         QStringList GetDependingGems(const QModelIndex& modelIndex);
 
         QHash<QString, QModelIndex> m_nameToIndexMap;
-        QHash<QString, QModelIndex> m_pathToIndexMap;
         QItemSelectionModel* m_selectionModel = nullptr;
         QHash<QString, QSet<QModelIndex>> m_gemDependencyMap;
         QHash<QString, QSet<QModelIndex>> m_gemReverseDependencyMap;

+ 3 - 3
Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp

@@ -67,7 +67,7 @@ namespace O3DE::ProjectManager
 
         // Gem requirement
         const QRect requirementRect = CalcRequirementRect(contentRect);
-        const QString requirement = GemModel::GetRequirement(modelIndex);
+        const QString& requirement = GemModel::GetGemInfo(modelIndex).m_requirement;
         DrawText(requirement, painter, requirementRect, standardFont);
 
         painter->restore();
@@ -100,8 +100,8 @@ namespace O3DE::ProjectManager
             const QRect requirementsRect = CalcRequirementRect(contentRect);
             if (requirementsRect.contains(mouseEvent->pos()))
             {
-                const QString html = GemModel::GetRequirement(modelIndex);
-                QString anchor = anchorAt(html, mouseEvent->pos(), requirementsRect);
+                const QString& requirementHtml = GemModel::GetGemInfo(modelIndex).m_requirement;
+                QString anchor = anchorAt(requirementHtml, mouseEvent->pos(), requirementsRect);
                 if (!anchor.isEmpty())
                 {
                     QDesktopServices::openUrl(QUrl(anchor));

+ 10 - 10
Code/Tools/ProjectManager/Source/GemCatalog/GemSortFilterProxyModel.cpp

@@ -28,14 +28,15 @@ namespace O3DE::ProjectManager
             return false;
         }
 
+        const GemInfo& gemInfo = m_sourceModel->GetGemInfo(sourceIndex);
         // Search Bar
-        if (!m_sourceModel->GetDisplayName(sourceIndex).contains(m_searchString, Qt::CaseInsensitive) &&
-            !m_sourceModel->GetName(sourceIndex).contains(m_searchString, Qt::CaseInsensitive) &&
-            !m_sourceModel->GetCreator(sourceIndex).contains(m_searchString, Qt::CaseInsensitive) &&
-            !m_sourceModel->GetSummary(sourceIndex).contains(m_searchString, Qt::CaseInsensitive))
+        if (!gemInfo.m_displayName.contains(m_searchString, Qt::CaseInsensitive) &&
+            !gemInfo.m_name.contains(m_searchString, Qt::CaseInsensitive) &&
+            !gemInfo.m_origin.contains(m_searchString, Qt::CaseInsensitive) &&
+            !gemInfo.m_summary.contains(m_searchString, Qt::CaseInsensitive))
         {
             bool foundFeature = false;
-            for (const QString& feature : m_sourceModel->GetFeatures(sourceIndex))
+            for (const QString& feature : gemInfo.m_features)
             {
                 if (feature.contains(m_searchString, Qt::CaseInsensitive))
                 {
@@ -94,7 +95,7 @@ namespace O3DE::ProjectManager
                 const GemInfo::GemOrigin filteredGemOrigin = static_cast<GemInfo::GemOrigin>(1 << i);
                 if (m_gemOriginFilter & filteredGemOrigin)
                 {
-                    if ((GemModel::GetGemOrigin(sourceIndex) == filteredGemOrigin))
+                    if ((gemInfo.m_gemOrigin == filteredGemOrigin))
                     {
                         supportsAnyFilteredGemOrigin = true;
                         break;
@@ -116,7 +117,7 @@ namespace O3DE::ProjectManager
                 const GemInfo::Platform filteredPlatform = static_cast<GemInfo::Platform>(1 << i);
                 if (m_platformFilter & filteredPlatform)
                 {
-                    if ((GemModel::GetPlatforms(sourceIndex) & filteredPlatform))
+                    if ((gemInfo.m_platforms & filteredPlatform))
                     {
                         supportsAnyFilteredPlatform = true;
                         break;
@@ -138,7 +139,7 @@ namespace O3DE::ProjectManager
                 const GemInfo::Type filteredType = static_cast<GemInfo::Type>(1 << i);
                 if (m_typeFilter & filteredType)
                 {
-                    if ((GemModel::GetTypes(sourceIndex) & filteredType))
+                    if ((gemInfo.m_types & filteredType))
                     {
                         supportsAnyFilteredType = true;
                         break;
@@ -155,8 +156,7 @@ namespace O3DE::ProjectManager
         if (!m_featureFilter.isEmpty())
         {
             bool containsFilterFeature = false;
-            const QStringList features = m_sourceModel->GetFeatures(sourceIndex);
-            for (const QString& feature : features)
+            for (const QString& feature : gemInfo.m_features)
             {
                 if (m_featureFilter.contains(feature))
                 {

+ 4 - 4
Code/Tools/ProjectManager/Source/ProjectGemCatalogScreen.cpp

@@ -68,8 +68,9 @@ namespace O3DE::ProjectManager
             for (const QModelIndex& modelIndex : toBeAdded)
             {
                 // make sure any remote gems we added were downloaded successfully
+                GemInfo gemInfo = GemModel::GetGemInfo(modelIndex);
                 const GemInfo::DownloadStatus status = GemModel::GetDownloadStatus(modelIndex);
-                if (GemModel::GetGemOrigin(modelIndex) == GemInfo::Remote &&
+                if (gemInfo.m_gemOrigin == GemInfo::Remote &&
                     !(status == GemInfo::Downloaded || status == GemInfo::DownloadSuccessful))
                 {
                     QMessageBox::critical(
@@ -81,10 +82,9 @@ namespace O3DE::ProjectManager
                     return ConfiguredGemsResult::Failed;
                 }
 
-                gemPaths.append(GemModel::GetPath(modelIndex));
+                gemPaths.append(gemInfo.m_path);
 
                 // use the version that was selected if available
-                auto gemInfo = GemModel::GetGemInfo(modelIndex);
                 if (auto gemVersion = GemModel::GetNewVersion(modelIndex); !gemVersion.isEmpty())
                 {
                     gemInfo.m_version = gemVersion;
@@ -133,7 +133,7 @@ namespace O3DE::ProjectManager
                         GemModel::UpdateWithVersion(*m_gemModel, modelIndex, newVersion);
                         GemModel::SetNewVersion(*m_gemModel, modelIndex, "");
                     }
-                    const auto& gemPath = GemModel::GetPath(modelIndex);
+                    const auto& gemPath = GemModel::GetGemInfo(modelIndex).m_path;
 
                     // register external gems that were added with relative paths
                     if (m_gemsToRegisterWithProject.contains(gemPath))