[LYN-2522] Preparation work for the filter pane (#799)

* [LYN-2522] Preparation work for the filter pane

* Added arrow up/down icons.
* Extended the gem info with the type (Asset, Code, Tool).
* Extended the model with the type and a helper for converting gem uuids into display names.
* Extended the link widget to be clickable with a custom action, needed for the "Show all/less" for the filters.
* Converting the uuids we get from Python to AZ::Uuids and then back to strings to have them all in the same format.
This commit is contained in:
Benjamin Jillich
2021-05-20 18:42:37 +02:00
committed by GitHub
parent 525840fb2a
commit 03b41b620d
11 changed files with 111 additions and 21 deletions
@@ -10,7 +10,8 @@
*
*/
#include "GemModel.h"
#include <AzCore/std/string/string.h>
#include <GemCatalog/GemModel.h>
namespace O3DE::ProjectManager
{
@@ -32,8 +33,11 @@ namespace O3DE::ProjectManager
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(gemInfo.m_name, RoleName);
const QString uuidString = gemInfo.m_uuid.ToString<AZStd::string>().c_str();
item->setData(uuidString, RoleUuid);
item->setData(gemInfo.m_creator, RoleCreator);
item->setData(static_cast<int>(gemInfo.m_platforms), RolePlatforms);
item->setData(aznumeric_cast<int>(gemInfo.m_platforms), RolePlatforms);
item->setData(aznumeric_cast<int>(gemInfo.m_types), RoleTypes);
item->setData(gemInfo.m_summary, RoleSummary);
item->setData(gemInfo.m_isAdded, RoleIsAdded);
@@ -48,6 +52,8 @@ namespace O3DE::ProjectManager
item->setData(gemInfo.m_features, RoleFeatures);
appendRow(item);
m_uuidToNameMap[uuidString] = gemInfo.m_displayName;
}
void GemModel::Clear()
@@ -65,11 +71,21 @@ namespace O3DE::ProjectManager
return modelIndex.data(RoleCreator).toString();
}
QString GemModel::GetUuidString(const QModelIndex& modelIndex)
{
return modelIndex.data(RoleUuid).toString();
}
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());
}
QString GemModel::GetSummary(const QModelIndex& modelIndex)
{
return modelIndex.data(RoleSummary).toString();
@@ -90,9 +106,35 @@ namespace O3DE::ProjectManager
return modelIndex.data(RoleDocLink).toString();
}
AZ::Outcome<QString> GemModel::FindGemNameByUuidString(const QString& uuidString) const
{
const auto iterator = m_uuidToNameMap.find(uuidString);
if (iterator != m_uuidToNameMap.end())
{
return AZ::Success(iterator.value());
}
return AZ::Failure();
}
QStringList GemModel::GetDependingGems(const QModelIndex& modelIndex)
{
return modelIndex.data(RoleDependingGems).toStringList();
QStringList result = modelIndex.data(RoleDependingGems).toStringList();
if (result.isEmpty())
{
return {};
}
for (QString& dependingGemString : result)
{
AZ::Outcome<QString> gemNameOutcome = FindGemNameByUuidString(dependingGemString);
if (gemNameOutcome.IsSuccess())
{
dependingGemString = gemNameOutcome.GetValue();
}
}
return result;
}
QStringList GemModel::GetConflictingGems(const QModelIndex& modelIndex)