Improves Gem Catalog Search (searches, Name, DisplayName, Creator, Summary, and Features), Gem Display Names now used in Gem Catalog

Signed-off-by: nggieber <nggieber@amazon.com>
monroegm-disable-blank-issue-2
nggieber 4 years ago
parent b4279ab3d8
commit 6eb9273763

@ -117,7 +117,7 @@ namespace O3DE::ProjectManager
gemNames.reserve(gems.size()); gemNames.reserve(gems.size());
for (const QModelIndex& modelIndex : gems) for (const QModelIndex& modelIndex : gems)
{ {
gemNames.push_back(GemModel::GetName(modelIndex)); gemNames.push_back(GemModel::GetDisplayName(modelIndex));
} }
return gemNames; return gemNames;
} }

@ -156,7 +156,7 @@ namespace O3DE::ProjectManager
if (!result.IsSuccess()) if (!result.IsSuccess())
{ {
QMessageBox::critical(nullptr, "Operation failed", QMessageBox::critical(nullptr, "Operation failed",
QString("Cannot add gem %1 to project.\n\nError:\n%2").arg(GemModel::GetName(modelIndex), result.GetError().c_str())); QString("Cannot add gem %1 to project.\n\nError:\n%2").arg(GemModel::GetDisplayName(modelIndex), result.GetError().c_str()));
return false; return false;
} }
@ -169,7 +169,7 @@ namespace O3DE::ProjectManager
if (!result.IsSuccess()) if (!result.IsSuccess())
{ {
QMessageBox::critical(nullptr, "Operation failed", QMessageBox::critical(nullptr, "Operation failed",
QString("Cannot remove gem %1 from project.\n\nError:\n%2").arg(GemModel::GetName(modelIndex), result.GetError().c_str())); QString("Cannot remove gem %1 from project.\n\nError:\n%2").arg(GemModel::GetDisplayName(modelIndex), result.GetError().c_str()));
return false; return false;
} }

@ -58,7 +58,7 @@ namespace O3DE::ProjectManager
m_mainWidget->hide(); m_mainWidget->hide();
} }
m_nameLabel->setText(m_model->GetName(modelIndex)); m_nameLabel->setText(m_model->GetDisplayName(modelIndex));
m_creatorLabel->setText(m_model->GetCreator(modelIndex)); m_creatorLabel->setText(m_model->GetCreator(modelIndex));
m_summaryLabel->setText(m_model->GetSummary(modelIndex)); m_summaryLabel->setText(m_model->GetSummary(modelIndex));

@ -75,7 +75,7 @@ namespace O3DE::ProjectManager
} }
// Gem name // Gem name
QString gemName = GemModel::GetName(modelIndex); QString gemName = GemModel::GetDisplayName(modelIndex);
QFont gemNameFont(options.font); QFont gemNameFont(options.font);
const int firstColumnMaxTextWidth = s_summaryStartX - 30; const int firstColumnMaxTextWidth = s_summaryStartX - 30;
gemNameFont.setPixelSize(static_cast<int>(s_gemNameFontSize)); gemNameFont.setPixelSize(static_cast<int>(s_gemNameFontSize));

@ -30,6 +30,7 @@ namespace O3DE::ProjectManager
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(gemInfo.m_name, RoleName); item->setData(gemInfo.m_name, RoleName);
item->setData(gemInfo.m_displayName, RoleDisplayName);
item->setData(gemInfo.m_creator, RoleCreator); item->setData(gemInfo.m_creator, RoleCreator);
item->setData(gemInfo.m_gemOrigin, RoleGemOrigin); item->setData(gemInfo.m_gemOrigin, RoleGemOrigin);
item->setData(aznumeric_cast<int>(gemInfo.m_platforms), RolePlatforms); item->setData(aznumeric_cast<int>(gemInfo.m_platforms), RolePlatforms);
@ -64,6 +65,20 @@ namespace O3DE::ProjectManager
return modelIndex.data(RoleName).toString(); return modelIndex.data(RoleName).toString();
} }
QString GemModel::GetDisplayName(const QModelIndex& modelIndex)
{
QString displayName = modelIndex.data(RoleDisplayName).toString();
if (displayName.isEmpty())
{
return GetName(modelIndex);
}
else
{
return displayName;
}
}
QString GemModel::GetCreator(const QModelIndex& modelIndex) QString GemModel::GetCreator(const QModelIndex& modelIndex)
{ {
return modelIndex.data(RoleCreator).toString(); return modelIndex.data(RoleCreator).toString();
@ -117,7 +132,7 @@ namespace O3DE::ProjectManager
QModelIndex modelIndex = FindIndexByNameString(dependingGemString); QModelIndex modelIndex = FindIndexByNameString(dependingGemString);
if (modelIndex.isValid()) if (modelIndex.isValid())
{ {
dependingGemString = GetName(modelIndex); dependingGemString = GetDisplayName(modelIndex);
} }
} }
} }

@ -37,6 +37,7 @@ namespace O3DE::ProjectManager
QStringList GetConflictingGemNames(const QModelIndex& modelIndex); QStringList GetConflictingGemNames(const QModelIndex& modelIndex);
static QString GetName(const QModelIndex& modelIndex); static QString GetName(const QModelIndex& modelIndex);
static QString GetDisplayName(const QModelIndex& modelIndex);
static QString GetCreator(const QModelIndex& modelIndex); static QString GetCreator(const QModelIndex& modelIndex);
static GemInfo::GemOrigin GetGemOrigin(const QModelIndex& modelIndex); static GemInfo::GemOrigin GetGemOrigin(const QModelIndex& modelIndex);
static GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex); static GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex);
@ -69,6 +70,7 @@ namespace O3DE::ProjectManager
enum UserRole enum UserRole
{ {
RoleName = Qt::UserRole, RoleName = Qt::UserRole,
RoleDisplayName,
RoleCreator, RoleCreator,
RoleGemOrigin, RoleGemOrigin,
RolePlatforms, RolePlatforms,

@ -51,7 +51,7 @@ namespace O3DE::ProjectManager
painter->fillRect(itemRect, itemBackgroundColor); painter->fillRect(itemRect, itemBackgroundColor);
// Gem name // Gem name
QString gemName = GemModel::GetName(modelIndex); QString gemName = GemModel::GetDisplayName(modelIndex);
QFont gemNameFont(options.font); QFont gemNameFont(options.font);
const int firstColumnMaxTextWidth = s_summaryStartX - 30; const int firstColumnMaxTextWidth = s_summaryStartX - 30;
gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth); gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth);

@ -28,9 +28,26 @@ namespace O3DE::ProjectManager
return false; return false;
} }
if (!m_sourceModel->GetName(sourceIndex).contains(m_searchString, Qt::CaseInsensitive)) // 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))
{ {
return false; bool foundFeature = false;
for (const QString& feature : m_sourceModel->GetFeatures(sourceIndex))
{
if (feature.contains(m_searchString, Qt::CaseInsensitive))
{
foundFeature = true;
break;
}
}
if (!foundFeature)
{
return false;
}
} }
// Gem status // Gem status

Loading…
Cancel
Save