Merge pull request #3389 from aws-lumberyard-dev/Prism/UseGemDisplayNames
Improves Gem Catalog Search, Gem Display Names now used in Gem Catalog
This commit is contained in:
@@ -117,7 +117,7 @@ namespace O3DE::ProjectManager
|
||||
gemNames.reserve(gems.size());
|
||||
for (const QModelIndex& modelIndex : gems)
|
||||
{
|
||||
gemNames.push_back(GemModel::GetName(modelIndex));
|
||||
gemNames.push_back(GemModel::GetDisplayName(modelIndex));
|
||||
}
|
||||
return gemNames;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace O3DE::ProjectManager
|
||||
if (!result.IsSuccess())
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace O3DE::ProjectManager
|
||||
if (!result.IsSuccess())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace O3DE::ProjectManager
|
||||
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_summaryLabel->setText(m_model->GetSummary(modelIndex));
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
|
||||
// Gem name
|
||||
QString gemName = GemModel::GetName(modelIndex);
|
||||
QString gemName = GemModel::GetDisplayName(modelIndex);
|
||||
QFont gemNameFont(options.font);
|
||||
const int firstColumnMaxTextWidth = s_summaryStartX - 30;
|
||||
gemNameFont.setPixelSize(static_cast<int>(s_gemNameFontSize));
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace O3DE::ProjectManager
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
|
||||
item->setData(gemInfo.m_name, RoleName);
|
||||
item->setData(gemInfo.m_displayName, RoleDisplayName);
|
||||
item->setData(gemInfo.m_creator, RoleCreator);
|
||||
item->setData(gemInfo.m_gemOrigin, RoleGemOrigin);
|
||||
item->setData(aznumeric_cast<int>(gemInfo.m_platforms), RolePlatforms);
|
||||
@@ -64,6 +65,20 @@ namespace O3DE::ProjectManager
|
||||
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)
|
||||
{
|
||||
return modelIndex.data(RoleCreator).toString();
|
||||
@@ -117,7 +132,7 @@ namespace O3DE::ProjectManager
|
||||
QModelIndex modelIndex = FindIndexByNameString(dependingGemString);
|
||||
if (modelIndex.isValid())
|
||||
{
|
||||
dependingGemString = GetName(modelIndex);
|
||||
dependingGemString = GetDisplayName(modelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace O3DE::ProjectManager
|
||||
QStringList GetConflictingGemNames(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);
|
||||
@@ -69,6 +70,7 @@ namespace O3DE::ProjectManager
|
||||
enum UserRole
|
||||
{
|
||||
RoleName = Qt::UserRole,
|
||||
RoleDisplayName,
|
||||
RoleCreator,
|
||||
RoleGemOrigin,
|
||||
RolePlatforms,
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace O3DE::ProjectManager
|
||||
painter->fillRect(itemRect, itemBackgroundColor);
|
||||
|
||||
// Gem name
|
||||
QString gemName = GemModel::GetName(modelIndex);
|
||||
QString gemName = GemModel::GetDisplayName(modelIndex);
|
||||
QFont gemNameFont(options.font);
|
||||
const int firstColumnMaxTextWidth = s_summaryStartX - 30;
|
||||
gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth);
|
||||
|
||||
@@ -28,9 +28,26 @@ namespace O3DE::ProjectManager
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user