Merge remote-tracking branch 'upstream/stabilization/2110' into Prism/clouddownloadicon
Signed-off-by: AMZN-Phil <pconroy@amazon.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <AzQtComponents/Utilities/HandleDpiAwareness.h>
|
||||
#include <AzQtComponents/Components/StyleManager.h>
|
||||
#include <AzQtComponents/Components/WindowDecorationWrapper.h>
|
||||
#include <ProjectManager_Traits_Platform.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
@@ -194,8 +195,12 @@ namespace O3DE::ProjectManager
|
||||
// set stylesheet after creating the main window or their styles won't get updated
|
||||
AzQtComponents::StyleManager::setStyleSheet(m_mainWindow.data(), QStringLiteral("style:ProjectManager.qss"));
|
||||
|
||||
// the decoration wrapper is intended to remember window positioning and sizing
|
||||
// the decoration wrapper is intended to remember window positioning and sizing
|
||||
#if AZ_TRAIT_PROJECT_MANAGER_CUSTOM_TITLEBAR
|
||||
auto wrapper = new AzQtComponents::WindowDecorationWrapper();
|
||||
#else
|
||||
auto wrapper = new AzQtComponents::WindowDecorationWrapper(AzQtComponents::WindowDecorationWrapper::OptionDisabled);
|
||||
#endif
|
||||
wrapper->setGuest(m_mainWindow.data());
|
||||
|
||||
// show the main window here to apply the stylesheet before restoring geometry or we
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace O3DE::ProjectManager
|
||||
PythonBindingsInterface::Get()->AddProject(projectInfo.m_path);
|
||||
|
||||
#ifdef TEMPLATE_GEM_CONFIGURATION_ENABLED
|
||||
const GemCatalogScreen::EnableDisableGemsResult gemResult = m_gemCatalogScreen->EnableDisableGemsForProject(m_projectInfo.m_path);
|
||||
const GemCatalogScreen::EnableDisableGemsResult gemResult = m_gemCatalogScreen->EnableDisableGemsForProject(projectInfo.m_path);
|
||||
if (gemResult == GemCatalogScreen::EnableDisableGemsResult::Failed)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Failed to configure gems"), tr("Failed to configure gems for template."));
|
||||
|
||||
@@ -62,9 +62,6 @@ namespace O3DE::ProjectManager
|
||||
QPushButton* m_secondaryButton = nullptr;
|
||||
#endif // TEMPLATE_GEM_CONFIGURATION_ENABLED
|
||||
|
||||
QString m_projectTemplatePath;
|
||||
ProjectInfo m_projectInfo;
|
||||
|
||||
NewProjectSettingsScreen* m_newProjectSettingsScreen = nullptr;
|
||||
GemCatalogScreen* m_gemCatalogScreen = nullptr;
|
||||
};
|
||||
|
||||
@@ -11,19 +11,28 @@
|
||||
#include <FormFolderBrowseEditWidget.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <PathValidator.h>
|
||||
#include <AzQtComponents/Utilities/DesktopUtilities.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
EngineSettingsScreen::EngineSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
auto* layout = new QVBoxLayout();
|
||||
QScrollArea* scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
QWidget* scrollWidget = new QWidget(this);
|
||||
scrollArea->setWidget(scrollWidget);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(scrollWidget);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
scrollWidget->setLayout(layout);
|
||||
|
||||
setObjectName("engineSettingsScreen");
|
||||
|
||||
@@ -39,9 +48,18 @@ namespace O3DE::ProjectManager
|
||||
formTitleLabel->setObjectName("formTitleLabel");
|
||||
layout->addWidget(formTitleLabel);
|
||||
|
||||
m_engineVersion = new FormLineEditWidget(tr("Engine Version"), engineInfo.m_version, this);
|
||||
m_engineVersion->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(m_engineVersion);
|
||||
FormLineEditWidget* engineName = new FormLineEditWidget(tr("Engine Name"), engineInfo.m_name, this);
|
||||
engineName->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(engineName);
|
||||
|
||||
FormLineEditWidget* engineVersion = new FormLineEditWidget(tr("Engine Version"), engineInfo.m_version, this);
|
||||
engineVersion->lineEdit()->setReadOnly(true);
|
||||
layout->addWidget(engineVersion);
|
||||
|
||||
FormBrowseEditWidget* engineFolder = new FormBrowseEditWidget(tr("Engine Folder"), engineInfo.m_path, this);
|
||||
engineFolder->lineEdit()->setReadOnly(true);
|
||||
connect( engineFolder, &FormBrowseEditWidget::OnBrowse, [engineInfo]{ AzQtComponents::ShowFileOnDesktop(engineInfo.m_path); });
|
||||
layout->addWidget(engineFolder);
|
||||
|
||||
m_thirdParty = new FormFolderBrowseEditWidget(tr("3rd Party Software Folder"), engineInfo.m_thirdPartyPath, this);
|
||||
m_thirdParty->lineEdit()->setValidator(new PathValidator(PathValidator::PathMode::ExistingFolder, this));
|
||||
@@ -71,7 +89,11 @@ namespace O3DE::ProjectManager
|
||||
connect(m_defaultProjectTemplates->lineEdit(), &QLineEdit::textChanged, this, &EngineSettingsScreen::OnTextChanged);
|
||||
layout->addWidget(m_defaultProjectTemplates);
|
||||
|
||||
setLayout(layout);
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
mainLayout->setAlignment(Qt::AlignTop);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addWidget(scrollArea);
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
ProjectManagerScreen EngineSettingsScreen::GetScreenEnum()
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace O3DE::ProjectManager
|
||||
void OnTextChanged();
|
||||
|
||||
private:
|
||||
FormLineEditWidget* m_engineVersion;
|
||||
FormBrowseEditWidget* m_thirdParty;
|
||||
FormBrowseEditWidget* m_defaultProjects;
|
||||
FormBrowseEditWidget* m_defaultGems;
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace O3DE::ProjectManager
|
||||
setObjectName("formBrowseEditWidget");
|
||||
|
||||
QPushButton* browseButton = new QPushButton(this);
|
||||
connect(browseButton, &QPushButton::pressed, this, &FormBrowseEditWidget::HandleBrowseButton);
|
||||
connect( browseButton, &QPushButton::pressed, [this]{ emit OnBrowse(); });
|
||||
connect( this, &FormBrowseEditWidget::OnBrowse, this, &FormBrowseEditWidget::HandleBrowseButton);
|
||||
m_frameLayout->addWidget(browseButton);
|
||||
}
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace O3DE::ProjectManager
|
||||
int key = event->key();
|
||||
if (key == Qt::Key_Return || key == Qt::Key_Enter)
|
||||
{
|
||||
HandleBrowseButton();
|
||||
emit OnBrowse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,13 @@ namespace O3DE::ProjectManager
|
||||
explicit FormBrowseEditWidget(const QString& labelText = "", QWidget* parent = nullptr);
|
||||
~FormBrowseEditWidget() = default;
|
||||
|
||||
signals:
|
||||
void OnBrowse();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
virtual void HandleBrowseButton() = 0;
|
||||
virtual void HandleBrowseButton() {};
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace O3DE::ProjectManager
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
m_gemModel = new GemModel(this);
|
||||
m_proxModel = new GemSortFilterProxyModel(m_gemModel, this);
|
||||
m_proxyModel = new GemSortFilterProxyModel(m_gemModel, this);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->setMargin(0);
|
||||
@@ -39,7 +39,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
m_downloadController = new DownloadController();
|
||||
|
||||
m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxModel, m_downloadController);
|
||||
m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxyModel, m_downloadController);
|
||||
vLayout->addWidget(m_headerWidget);
|
||||
|
||||
connect(m_gemModel, &GemModel::gemStatusChanged, this, &GemCatalogScreen::OnGemStatusChanged);
|
||||
@@ -50,10 +50,12 @@ namespace O3DE::ProjectManager
|
||||
hLayout->setMargin(0);
|
||||
vLayout->addLayout(hLayout);
|
||||
|
||||
m_gemListView = new GemListView(m_proxModel, m_proxModel->GetSelectionModel(), this);
|
||||
m_gemListView = new GemListView(m_proxyModel, m_proxyModel->GetSelectionModel(), this);
|
||||
m_gemInspector = new GemInspector(m_gemModel, this);
|
||||
m_gemInspector->setFixedWidth(240);
|
||||
|
||||
connect(m_gemInspector, &GemInspector::TagClicked, this, &GemCatalogScreen::SelectGem);
|
||||
|
||||
QWidget* filterWidget = new QWidget(this);
|
||||
filterWidget->setFixedWidth(240);
|
||||
m_filterWidgetLayout = new QVBoxLayout();
|
||||
@@ -61,7 +63,7 @@ namespace O3DE::ProjectManager
|
||||
m_filterWidgetLayout->setSpacing(0);
|
||||
filterWidget->setLayout(m_filterWidgetLayout);
|
||||
|
||||
GemListHeaderWidget* listHeaderWidget = new GemListHeaderWidget(m_proxModel);
|
||||
GemListHeaderWidget* listHeaderWidget = new GemListHeaderWidget(m_proxyModel);
|
||||
|
||||
QVBoxLayout* middleVLayout = new QVBoxLayout();
|
||||
middleVLayout->setMargin(0);
|
||||
@@ -80,19 +82,21 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemCatalogScreen::ReinitForProject(const QString& projectPath)
|
||||
{
|
||||
m_gemModel->clear();
|
||||
m_gemModel->Clear();
|
||||
m_gemsToRegisterWithProject.clear();
|
||||
FillModel(projectPath);
|
||||
|
||||
m_proxyModel->ResetFilters();
|
||||
|
||||
if (m_filterWidget)
|
||||
{
|
||||
m_filterWidget->hide();
|
||||
m_filterWidget->deleteLater();
|
||||
m_filterWidget->ResetAllFilters();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filterWidget = new GemFilterWidget(m_proxyModel);
|
||||
m_filterWidgetLayout->addWidget(m_filterWidget);
|
||||
}
|
||||
|
||||
m_proxModel->ResetFilters();
|
||||
m_filterWidget = new GemFilterWidget(m_proxModel);
|
||||
m_filterWidgetLayout->addWidget(m_filterWidget);
|
||||
|
||||
m_headerWidget->ReinitForProject();
|
||||
|
||||
@@ -145,10 +149,11 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
void GemCatalogScreen::OnGemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies)
|
||||
void GemCatalogScreen::OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies)
|
||||
{
|
||||
if (m_notificationsEnabled)
|
||||
{
|
||||
QModelIndex modelIndex = m_gemModel->FindIndexByNameString(gemName);
|
||||
bool added = GemModel::IsAdded(modelIndex);
|
||||
bool dependency = GemModel::IsAddedDependency(modelIndex);
|
||||
|
||||
@@ -170,7 +175,7 @@ namespace O3DE::ProjectManager
|
||||
if (added && GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded)
|
||||
{
|
||||
m_downloadController->AddGemDownload(GemModel::GetName(modelIndex));
|
||||
GemModel::SetDownloadStatus(*m_proxModel, modelIndex, GemInfo::DownloadStatus::Downloading);
|
||||
GemModel::SetDownloadStatus(*m_proxyModel, modelIndex, GemInfo::DownloadStatus::Downloading);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +197,20 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
void GemCatalogScreen::SelectGem(const QString& gemName)
|
||||
{
|
||||
QModelIndex modelIndex = m_gemModel->FindIndexByNameString(gemName);
|
||||
if (!m_proxyModel->filterAcceptsRow(modelIndex.row(), QModelIndex()))
|
||||
{
|
||||
m_proxyModel->ResetFilters();
|
||||
m_filterWidget->ResetAllFilters();
|
||||
}
|
||||
|
||||
QModelIndex proxyIndex = m_proxyModel->mapFromSource(modelIndex);
|
||||
m_proxyModel->GetSelectionModel()->select(proxyIndex, QItemSelectionModel::ClearAndSelect);
|
||||
m_gemListView->scrollTo(proxyIndex);
|
||||
}
|
||||
|
||||
void GemCatalogScreen::hideEvent(QHideEvent* event)
|
||||
{
|
||||
ScreenWidget::hideEvent(event);
|
||||
@@ -234,7 +253,11 @@ namespace O3DE::ProjectManager
|
||||
const QVector<GemInfo> allRepoGemInfos = allRepoGemInfosResult.GetValue();
|
||||
for (const GemInfo& gemInfo : allRepoGemInfos)
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
// do not add gems that have already been downloaded
|
||||
if (!m_gemModel->FindIndexByNameString(gemInfo.m_name).isValid())
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -258,7 +281,8 @@ namespace O3DE::ProjectManager
|
||||
GemModel::SetWasPreviouslyAdded(*m_gemModel, modelIndex, true);
|
||||
GemModel::SetIsAdded(*m_gemModel, modelIndex, true);
|
||||
}
|
||||
else
|
||||
// ${Name} is a special name used in templates and is not really an error
|
||||
else if (enabledGemName != "${Name}")
|
||||
{
|
||||
AZ_Warning("ProjectManager::GemCatalog", false,
|
||||
"Cannot find entry for gem with name '%s'. The CMake target name probably does not match the specified name in the gem.json.",
|
||||
|
||||
@@ -46,8 +46,9 @@ namespace O3DE::ProjectManager
|
||||
DownloadController* GetDownloadController() const { return m_downloadController; }
|
||||
|
||||
public slots:
|
||||
void OnGemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies);
|
||||
void OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
|
||||
void OnAddGemClicked();
|
||||
void SelectGem(const QString& gemName);
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
@@ -68,7 +69,7 @@ namespace O3DE::ProjectManager
|
||||
GemInspector* m_gemInspector = nullptr;
|
||||
GemModel* m_gemModel = nullptr;
|
||||
GemCatalogHeaderWidget* m_headerWidget = nullptr;
|
||||
GemSortFilterProxyModel* m_proxModel = nullptr;
|
||||
GemSortFilterProxyModel* m_proxyModel = nullptr;
|
||||
QVBoxLayout* m_filterWidgetLayout = nullptr;
|
||||
GemFilterWidget* m_filterWidget = nullptr;
|
||||
DownloadController* m_downloadController = nullptr;
|
||||
|
||||
@@ -213,11 +213,99 @@ namespace O3DE::ProjectManager
|
||||
m_filterLayout->setContentsMargins(0, 0, 0, 0);
|
||||
filterSection->setLayout(m_filterLayout);
|
||||
|
||||
ResetAllFilters();
|
||||
}
|
||||
|
||||
void GemFilterWidget::ResetAllFilters()
|
||||
{
|
||||
ResetGemStatusFilter();
|
||||
AddGemOriginFilter();
|
||||
AddTypeFilter();
|
||||
AddPlatformFilter();
|
||||
AddFeatureFilter();
|
||||
ResetGemOriginFilter();
|
||||
ResetTypeFilter();
|
||||
ResetPlatformFilter();
|
||||
ResetFeatureFilter();
|
||||
}
|
||||
|
||||
void GemFilterWidget::ResetFilterWidget(
|
||||
FilterCategoryWidget*& filterPtr,
|
||||
const QString& filterName,
|
||||
const QVector<QString>& elementNames,
|
||||
const QVector<int>& elementCounts,
|
||||
int defaultShowCount)
|
||||
{
|
||||
bool wasCollapsed = false;
|
||||
if (filterPtr)
|
||||
{
|
||||
wasCollapsed = filterPtr->IsCollapsed();
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget = new FilterCategoryWidget(
|
||||
filterName, elementNames, elementCounts, /*showAllLessButton=*/defaultShowCount != 4, /*collapsed*/ wasCollapsed,
|
||||
/*defaultShowCount=*/defaultShowCount);
|
||||
if (filterPtr)
|
||||
{
|
||||
m_filterLayout->replaceWidget(filterPtr, filterWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
}
|
||||
|
||||
filterPtr->deleteLater();
|
||||
filterPtr = filterWidget;
|
||||
}
|
||||
|
||||
template<typename filterType, typename filterFlagsType>
|
||||
void GemFilterWidget::ResetSimpleOrFilter(
|
||||
FilterCategoryWidget*& filterPtr,
|
||||
const QString& filterName,
|
||||
int numFilterElements,
|
||||
bool (*filterMatcher)(GemModel*, filterType, int),
|
||||
QString (*typeStringGetter)(filterType),
|
||||
filterFlagsType (GemSortFilterProxyModel::*filterFlagsGetter)() const,
|
||||
void (GemSortFilterProxyModel::*filterFlagsSetter)(const filterFlagsType&))
|
||||
{
|
||||
QVector<QString> elementNames;
|
||||
QVector<int> elementCounts;
|
||||
const int numGems = m_gemModel->rowCount();
|
||||
for (int filterIndex = 0; filterIndex < numFilterElements; ++filterIndex)
|
||||
{
|
||||
const filterType gemFilterToBeCounted = static_cast<filterType>(1 << filterIndex);
|
||||
|
||||
int gemFilterCount = 0;
|
||||
for (int gemIndex = 0; gemIndex < numGems; ++gemIndex)
|
||||
{
|
||||
// If filter matches increment filter count
|
||||
gemFilterCount += filterMatcher(m_gemModel, gemFilterToBeCounted, gemIndex);
|
||||
}
|
||||
elementNames.push_back(typeStringGetter(gemFilterToBeCounted));
|
||||
elementCounts.push_back(gemFilterCount);
|
||||
}
|
||||
|
||||
// Replace existing filter and delete old one
|
||||
ResetFilterWidget(filterPtr, filterName, elementNames, elementCounts);
|
||||
|
||||
const QList<QAbstractButton*> buttons = filterPtr->GetButtonGroup()->buttons();
|
||||
for (int i = 0; i < buttons.size(); ++i)
|
||||
{
|
||||
const filterType gemFilter = static_cast<filterType>(1 << i);
|
||||
QAbstractButton* button = buttons[i];
|
||||
|
||||
connect(
|
||||
button, &QAbstractButton::toggled, this,
|
||||
[=](bool checked)
|
||||
{
|
||||
filterFlagsType gemFilters = (m_filterProxyModel->*filterFlagsGetter)();
|
||||
if (checked)
|
||||
{
|
||||
gemFilters |= gemFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
gemFilters &= ~gemFilter;
|
||||
}
|
||||
(m_filterProxyModel->*filterFlagsSetter)(gemFilters);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void GemFilterWidget::ResetGemStatusFilter()
|
||||
@@ -241,25 +329,7 @@ namespace O3DE::ProjectManager
|
||||
elementNames.push_back(GemSortFilterProxyModel::GetGemActiveString(GemSortFilterProxyModel::GemActive::Inactive));
|
||||
elementCounts.push_back(totalGems - enabledGemTotal);
|
||||
|
||||
bool wasCollapsed = false;
|
||||
if (m_statusFilter)
|
||||
{
|
||||
wasCollapsed = m_statusFilter->IsCollapsed();
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget =
|
||||
new FilterCategoryWidget("Status", elementNames, elementCounts, /*showAllLessButton=*/false, /*collapsed*/wasCollapsed);
|
||||
if (m_statusFilter)
|
||||
{
|
||||
m_filterLayout->replaceWidget(m_statusFilter, filterWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
}
|
||||
|
||||
m_statusFilter->deleteLater();
|
||||
m_statusFilter = filterWidget;
|
||||
ResetFilterWidget(m_statusFilter, "Status", elementNames, elementCounts);
|
||||
|
||||
const QList<QAbstractButton*> buttons = m_statusFilter->GetButtonGroup()->buttons();
|
||||
|
||||
@@ -317,157 +387,42 @@ namespace O3DE::ProjectManager
|
||||
connect(activeButton, &QAbstractButton::toggled, this, updateGemActive);
|
||||
}
|
||||
|
||||
void GemFilterWidget::AddGemOriginFilter()
|
||||
void GemFilterWidget::ResetGemOriginFilter()
|
||||
{
|
||||
QVector<QString> elementNames;
|
||||
QVector<int> elementCounts;
|
||||
const int numGems = m_gemModel->rowCount();
|
||||
for (int originIndex = 0; originIndex < GemInfo::NumGemOrigins; ++originIndex)
|
||||
{
|
||||
const GemInfo::GemOrigin gemOriginToBeCounted = static_cast<GemInfo::GemOrigin>(1 << originIndex);
|
||||
|
||||
int gemOriginCount = 0;
|
||||
for (int gemIndex = 0; gemIndex < numGems; ++gemIndex)
|
||||
ResetSimpleOrFilter<GemInfo::GemOrigin, GemInfo::GemOrigins>
|
||||
(
|
||||
m_originFilter, "Provider", GemInfo::NumGemOrigins,
|
||||
[](GemModel* gemModel, GemInfo::GemOrigin origin, int gemIndex)
|
||||
{
|
||||
const GemInfo::GemOrigin gemOrigin = m_gemModel->GetGemOrigin(m_gemModel->index(gemIndex, 0));
|
||||
|
||||
// Is the gem of the given origin?
|
||||
if (gemOriginToBeCounted == gemOrigin)
|
||||
{
|
||||
gemOriginCount++;
|
||||
}
|
||||
}
|
||||
|
||||
elementNames.push_back(GemInfo::GetGemOriginString(gemOriginToBeCounted));
|
||||
elementCounts.push_back(gemOriginCount);
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget = new FilterCategoryWidget("Provider", elementNames, elementCounts, /*showAllLessButton=*/false);
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
|
||||
const QList<QAbstractButton*> buttons = filterWidget->GetButtonGroup()->buttons();
|
||||
for (int i = 0; i < buttons.size(); ++i)
|
||||
{
|
||||
const GemInfo::GemOrigin gemOrigin = static_cast<GemInfo::GemOrigin>(1 << i);
|
||||
QAbstractButton* button = buttons[i];
|
||||
|
||||
connect(button, &QAbstractButton::toggled, this, [=](bool checked)
|
||||
{
|
||||
GemInfo::GemOrigins gemOrigins = m_filterProxyModel->GetGemOrigins();
|
||||
if (checked)
|
||||
{
|
||||
gemOrigins |= gemOrigin;
|
||||
}
|
||||
else
|
||||
{
|
||||
gemOrigins &= ~gemOrigin;
|
||||
}
|
||||
m_filterProxyModel->SetGemOrigins(gemOrigins);
|
||||
});
|
||||
}
|
||||
return origin == gemModel->GetGemOrigin(gemModel->index(gemIndex, 0));
|
||||
},
|
||||
&GemInfo::GetGemOriginString, &GemSortFilterProxyModel::GetGemOrigins, &GemSortFilterProxyModel::SetGemOrigins
|
||||
);
|
||||
}
|
||||
|
||||
void GemFilterWidget::AddTypeFilter()
|
||||
void GemFilterWidget::ResetTypeFilter()
|
||||
{
|
||||
QVector<QString> elementNames;
|
||||
QVector<int> elementCounts;
|
||||
const int numGems = m_gemModel->rowCount();
|
||||
for (int typeIndex = 0; typeIndex < GemInfo::NumTypes; ++typeIndex)
|
||||
{
|
||||
const GemInfo::Type type = static_cast<GemInfo::Type>(1 << typeIndex);
|
||||
|
||||
int typeGemCount = 0;
|
||||
for (int gemIndex = 0; gemIndex < numGems; ++gemIndex)
|
||||
ResetSimpleOrFilter<GemInfo::Type, GemInfo::Types>(
|
||||
m_typeFilter, "Type", GemInfo::NumTypes,
|
||||
[](GemModel* gemModel, GemInfo::Type type, int gemIndex)
|
||||
{
|
||||
const GemInfo::Types types = m_gemModel->GetTypes(m_gemModel->index(gemIndex, 0));
|
||||
|
||||
// Is type (Asset, Code, Tool) part of the gem?
|
||||
if (types & type)
|
||||
{
|
||||
typeGemCount++;
|
||||
}
|
||||
}
|
||||
|
||||
elementNames.push_back(GemInfo::GetTypeString(type));
|
||||
elementCounts.push_back(typeGemCount);
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget = new FilterCategoryWidget("Type", elementNames, elementCounts, /*showAllLessButton=*/false);
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
|
||||
const QList<QAbstractButton*> buttons = filterWidget->GetButtonGroup()->buttons();
|
||||
for (int i = 0; i < buttons.size(); ++i)
|
||||
{
|
||||
const GemInfo::Type type = static_cast<GemInfo::Type>(1 << i);
|
||||
QAbstractButton* button = buttons[i];
|
||||
|
||||
connect(button, &QAbstractButton::toggled, this, [=](bool checked)
|
||||
{
|
||||
GemInfo::Types types = m_filterProxyModel->GetTypes();
|
||||
if (checked)
|
||||
{
|
||||
types |= type;
|
||||
}
|
||||
else
|
||||
{
|
||||
types &= ~type;
|
||||
}
|
||||
m_filterProxyModel->SetTypes(types);
|
||||
});
|
||||
}
|
||||
return static_cast<bool>(type & gemModel->GetTypes(gemModel->index(gemIndex, 0)));
|
||||
},
|
||||
&GemInfo::GetTypeString, &GemSortFilterProxyModel::GetTypes, &GemSortFilterProxyModel::SetTypes);
|
||||
}
|
||||
|
||||
void GemFilterWidget::AddPlatformFilter()
|
||||
void GemFilterWidget::ResetPlatformFilter()
|
||||
{
|
||||
QVector<QString> elementNames;
|
||||
QVector<int> elementCounts;
|
||||
const int numGems = m_gemModel->rowCount();
|
||||
for (int platformIndex = 0; platformIndex < GemInfo::NumPlatforms; ++platformIndex)
|
||||
{
|
||||
const GemInfo::Platform platform = static_cast<GemInfo::Platform>(1 << platformIndex);
|
||||
|
||||
int platformGemCount = 0;
|
||||
for (int gemIndex = 0; gemIndex < numGems; ++gemIndex)
|
||||
ResetSimpleOrFilter<GemInfo::Platform, GemInfo::Platforms>(
|
||||
m_platformFilter, "Supported Platforms", GemInfo::NumPlatforms,
|
||||
[](GemModel* gemModel, GemInfo::Platform platform, int gemIndex)
|
||||
{
|
||||
const GemInfo::Platforms platforms = m_gemModel->GetPlatforms(m_gemModel->index(gemIndex, 0));
|
||||
|
||||
// Is platform supported?
|
||||
if (platforms & platform)
|
||||
{
|
||||
platformGemCount++;
|
||||
}
|
||||
}
|
||||
|
||||
elementNames.push_back(GemInfo::GetPlatformString(platform));
|
||||
elementCounts.push_back(platformGemCount);
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget = new FilterCategoryWidget("Supported Platforms", elementNames, elementCounts, /*showAllLessButton=*/false);
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
|
||||
const QList<QAbstractButton*> buttons = filterWidget->GetButtonGroup()->buttons();
|
||||
for (int i = 0; i < buttons.size(); ++i)
|
||||
{
|
||||
const GemInfo::Platform platform = static_cast<GemInfo::Platform>(1 << i);
|
||||
QAbstractButton* button = buttons[i];
|
||||
|
||||
connect(button, &QAbstractButton::toggled, this, [=](bool checked)
|
||||
{
|
||||
GemInfo::Platforms platforms = m_filterProxyModel->GetPlatforms();
|
||||
if (checked)
|
||||
{
|
||||
platforms |= platform;
|
||||
}
|
||||
else
|
||||
{
|
||||
platforms &= ~platform;
|
||||
}
|
||||
m_filterProxyModel->SetPlatforms(platforms);
|
||||
});
|
||||
}
|
||||
return static_cast<bool>(platform & gemModel->GetPlatforms(gemModel->index(gemIndex, 0)));
|
||||
},
|
||||
&GemInfo::GetPlatformString, &GemSortFilterProxyModel::GetPlatforms, &GemSortFilterProxyModel::SetPlatforms);
|
||||
}
|
||||
|
||||
void GemFilterWidget::AddFeatureFilter()
|
||||
void GemFilterWidget::ResetFeatureFilter()
|
||||
{
|
||||
// Alphabetically sorted, unique features and their number of occurrences in the gem database.
|
||||
QMap<QString, int> uniqueFeatureCounts;
|
||||
@@ -497,11 +452,15 @@ namespace O3DE::ProjectManager
|
||||
elementCounts.push_back(iterator.value());
|
||||
}
|
||||
|
||||
FilterCategoryWidget* filterWidget = new FilterCategoryWidget("Features", elementNames, elementCounts,
|
||||
/*showAllLessButton=*/true, false, /*defaultShowCount=*/5);
|
||||
m_filterLayout->addWidget(filterWidget);
|
||||
ResetFilterWidget(m_featureFilter, "Features", elementNames, elementCounts, /*defaultShowCount=*/5);
|
||||
|
||||
const QList<QAbstractButton*> buttons = filterWidget->GetButtonGroup()->buttons();
|
||||
for (QMetaObject::Connection& connection : m_featureTagConnections)
|
||||
{
|
||||
disconnect(connection);
|
||||
}
|
||||
m_featureTagConnections.clear();
|
||||
|
||||
const QList<QAbstractButton*> buttons = m_featureFilter->GetButtonGroup()->buttons();
|
||||
for (int i = 0; i < buttons.size(); ++i)
|
||||
{
|
||||
const QString& feature = elementNames[i];
|
||||
@@ -523,13 +482,13 @@ namespace O3DE::ProjectManager
|
||||
});
|
||||
|
||||
// Sync the UI state with the proxy model filtering.
|
||||
connect(m_filterProxyModel, &GemSortFilterProxyModel::OnInvalidated, this, [=]
|
||||
m_featureTagConnections.push_back(connect(m_filterProxyModel, &GemSortFilterProxyModel::OnInvalidated, this, [=]
|
||||
{
|
||||
const QSet<QString>& filteredFeatureTags = m_filterProxyModel->GetFeatures();
|
||||
const bool isChecked = filteredFeatureTags.contains(button->text());
|
||||
QSignalBlocker signalsBlocker(button);
|
||||
button->setChecked(isChecked);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -66,17 +66,41 @@ namespace O3DE::ProjectManager
|
||||
~GemFilterWidget() = default;
|
||||
|
||||
public slots:
|
||||
void ResetAllFilters();
|
||||
void ResetGemStatusFilter();
|
||||
|
||||
private:
|
||||
void AddGemOriginFilter();
|
||||
void AddTypeFilter();
|
||||
void AddPlatformFilter();
|
||||
void AddFeatureFilter();
|
||||
void ResetGemOriginFilter();
|
||||
void ResetTypeFilter();
|
||||
void ResetPlatformFilter();
|
||||
void ResetFeatureFilter();
|
||||
|
||||
void ResetFilterWidget(
|
||||
FilterCategoryWidget*& filterPtr,
|
||||
const QString& filterName,
|
||||
const QVector<QString>& elementNames,
|
||||
const QVector<int>& elementCounts,
|
||||
int defaultShowCount = 4);
|
||||
|
||||
template<typename filterType, typename filterFlagsType>
|
||||
void ResetSimpleOrFilter(
|
||||
FilterCategoryWidget*& filterPtr,
|
||||
const QString& filterName,
|
||||
int numFilterElements,
|
||||
bool (*filterMatcher)(GemModel*, filterType, int),
|
||||
QString (*typeStringGetter)(filterType),
|
||||
filterFlagsType (GemSortFilterProxyModel::*filterFlagsGetter)() const,
|
||||
void (GemSortFilterProxyModel::*filterFlagsSetter)(const filterFlagsType&));
|
||||
|
||||
QVBoxLayout* m_filterLayout = nullptr;
|
||||
GemModel* m_gemModel = nullptr;
|
||||
GemSortFilterProxyModel* m_filterProxyModel = nullptr;
|
||||
FilterCategoryWidget* m_statusFilter = nullptr;
|
||||
FilterCategoryWidget* m_originFilter = nullptr;
|
||||
FilterCategoryWidget* m_typeFilter = nullptr;
|
||||
FilterCategoryWidget* m_platformFilter = nullptr;
|
||||
FilterCategoryWidget* m_featureFilter = nullptr;
|
||||
|
||||
QVector<QMetaObject::Connection> m_featureTagConnections;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace O3DE::ProjectManager
|
||||
DownloadStatus m_downloadStatus = UnknownDownloadStatus;
|
||||
QStringList m_features;
|
||||
QString m_requirement;
|
||||
QString m_licenseText;
|
||||
QString m_licenseLink;
|
||||
QString m_directoryLink;
|
||||
QString m_documentationLink;
|
||||
QString m_version = "Unknown Version";
|
||||
|
||||
@@ -52,6 +52,22 @@ namespace O3DE::ProjectManager
|
||||
Update(selectedIndices[0]);
|
||||
}
|
||||
|
||||
void SetLabelElidedText(QLabel* label, QString text)
|
||||
{
|
||||
QFontMetrics nameFontMetrics(label->font());
|
||||
int labelWidth = label->width();
|
||||
|
||||
// Don't elide if the widgets are sized too small (sometimes occurs when loading gem catalog)
|
||||
if (labelWidth > 100)
|
||||
{
|
||||
label->setText(nameFontMetrics.elidedText(text, Qt::ElideRight, labelWidth));
|
||||
}
|
||||
else
|
||||
{
|
||||
label->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
void GemInspector::Update(const QModelIndex& modelIndex)
|
||||
{
|
||||
if (!modelIndex.isValid())
|
||||
@@ -59,38 +75,52 @@ namespace O3DE::ProjectManager
|
||||
m_mainWidget->hide();
|
||||
}
|
||||
|
||||
m_nameLabel->setText(m_model->GetDisplayName(modelIndex));
|
||||
m_creatorLabel->setText(m_model->GetCreator(modelIndex));
|
||||
SetLabelElidedText(m_nameLabel, m_model->GetDisplayName(modelIndex));
|
||||
SetLabelElidedText(m_creatorLabel, m_model->GetCreator(modelIndex));
|
||||
|
||||
m_summaryLabel->setText(m_model->GetSummary(modelIndex));
|
||||
m_summaryLabel->adjustSize();
|
||||
|
||||
m_licenseLinkLabel->setText(m_model->GetLicenseText(modelIndex));
|
||||
m_licenseLinkLabel->SetUrl(m_model->GetLicenseLink(modelIndex));
|
||||
|
||||
m_directoryLinkLabel->SetUrl(m_model->GetDirectoryLink(modelIndex));
|
||||
m_documentationLinkLabel->SetUrl(m_model->GetDocLink(modelIndex));
|
||||
|
||||
if (m_model->HasRequirement(modelIndex))
|
||||
{
|
||||
m_reqirementsIconLabel->show();
|
||||
m_reqirementsTitleLabel->show();
|
||||
m_reqirementsTextLabel->show();
|
||||
m_requirementsIconLabel->show();
|
||||
m_requirementsTitleLabel->show();
|
||||
m_requirementsTextLabel->show();
|
||||
m_requirementsMainSpacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
m_reqirementsTitleLabel->setText("Requirement");
|
||||
m_reqirementsTextLabel->setText(m_model->GetRequirement(modelIndex));
|
||||
m_requirementsTitleLabel->setText(tr("Requirement"));
|
||||
m_requirementsTextLabel->setText(m_model->GetRequirement(modelIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reqirementsIconLabel->hide();
|
||||
m_reqirementsTitleLabel->hide();
|
||||
m_reqirementsTextLabel->hide();
|
||||
m_requirementsIconLabel->hide();
|
||||
m_requirementsTitleLabel->hide();
|
||||
m_requirementsTextLabel->hide();
|
||||
m_requirementsMainSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
// Depending gems
|
||||
m_dependingGems->Update("Depending Gems", "The following Gems will be automatically enabled with this Gem.", m_model->GetDependingGemNames(modelIndex));
|
||||
QStringList dependingGems = m_model->GetDependingGemNames(modelIndex);
|
||||
if (!dependingGems.isEmpty())
|
||||
{
|
||||
m_dependingGems->Update(tr("Depending Gems"), tr("The following Gems will be automatically enabled with this Gem."), dependingGems);
|
||||
m_dependingGems->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dependingGems->hide();
|
||||
}
|
||||
|
||||
// Additional information
|
||||
m_versionLabel->setText(QString("Gem Version: %1").arg(m_model->GetVersion(modelIndex)));
|
||||
m_lastUpdatedLabel->setText(QString("Last Updated: %1").arg(m_model->GetLastUpdated(modelIndex)));
|
||||
m_binarySizeLabel->setText(QString("Binary Size: %1 KB").arg(m_model->GetBinarySizeInKB(modelIndex)));
|
||||
m_versionLabel->setText(tr("Gem Version: %1").arg(m_model->GetVersion(modelIndex)));
|
||||
m_lastUpdatedLabel->setText(tr("Last Updated: %1").arg(m_model->GetLastUpdated(modelIndex)));
|
||||
m_binarySizeLabel->setText(tr("Binary Size: %1 KB").arg(m_model->GetBinarySizeInKB(modelIndex)));
|
||||
|
||||
m_mainWidget->adjustSize();
|
||||
m_mainWidget->show();
|
||||
@@ -108,35 +138,51 @@ namespace O3DE::ProjectManager
|
||||
{
|
||||
// Gem name, creator and summary
|
||||
m_nameLabel = CreateStyledLabel(m_mainLayout, 18, s_headerColor);
|
||||
m_creatorLabel = CreateStyledLabel(m_mainLayout, 12, s_headerColor);
|
||||
m_creatorLabel = CreateStyledLabel(m_mainLayout, s_baseFontSize, s_headerColor);
|
||||
m_mainLayout->addSpacing(5);
|
||||
|
||||
// TODO: QLabel seems to have issues determining the right sizeHint() for our font with the given font size.
|
||||
// This results into squeezed elements in the layout in case the text is a little longer than a sentence.
|
||||
m_summaryLabel = CreateStyledLabel(m_mainLayout, 12, s_textColor);
|
||||
m_summaryLabel = CreateStyledLabel(m_mainLayout, s_baseFontSize, s_headerColor);
|
||||
m_mainLayout->addWidget(m_summaryLabel);
|
||||
m_summaryLabel->setWordWrap(true);
|
||||
m_summaryLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
m_summaryLabel->setOpenExternalLinks(true);
|
||||
m_mainLayout->addSpacing(5);
|
||||
|
||||
// License
|
||||
{
|
||||
QHBoxLayout* licenseHLayout = new QHBoxLayout();
|
||||
licenseHLayout->setMargin(0);
|
||||
licenseHLayout->setAlignment(Qt::AlignLeft);
|
||||
m_mainLayout->addLayout(licenseHLayout);
|
||||
|
||||
QLabel* licenseLabel = CreateStyledLabel(licenseHLayout, s_baseFontSize, s_headerColor);
|
||||
licenseLabel->setText(tr("License: "));
|
||||
|
||||
m_licenseLinkLabel = new LinkLabel("", QUrl(), s_baseFontSize);
|
||||
licenseHLayout->addWidget(m_licenseLinkLabel);
|
||||
|
||||
licenseHLayout->addStretch();
|
||||
|
||||
m_mainLayout->addSpacing(5);
|
||||
}
|
||||
|
||||
// Directory and documentation links
|
||||
{
|
||||
QHBoxLayout* linksHLayout = new QHBoxLayout();
|
||||
linksHLayout->setMargin(0);
|
||||
m_mainLayout->addLayout(linksHLayout);
|
||||
|
||||
QSpacerItem* spacerLeft = new QSpacerItem(0, 0, QSizePolicy::Expanding);
|
||||
linksHLayout->addSpacerItem(spacerLeft);
|
||||
linksHLayout->addStretch();
|
||||
|
||||
m_directoryLinkLabel = new LinkLabel("View in Directory");
|
||||
m_directoryLinkLabel = new LinkLabel(tr("View in Directory"));
|
||||
linksHLayout->addWidget(m_directoryLinkLabel);
|
||||
linksHLayout->addWidget(new QLabel("|"));
|
||||
m_documentationLinkLabel = new LinkLabel("Read Documentation");
|
||||
m_documentationLinkLabel = new LinkLabel(tr("Read Documentation"));
|
||||
linksHLayout->addWidget(m_documentationLinkLabel);
|
||||
|
||||
QSpacerItem* spacerRight = new QSpacerItem(0, 0, QSizePolicy::Expanding);
|
||||
linksHLayout->addSpacerItem(spacerRight);
|
||||
linksHLayout->addStretch();
|
||||
|
||||
m_mainLayout->addSpacing(8);
|
||||
}
|
||||
@@ -144,46 +190,48 @@ namespace O3DE::ProjectManager
|
||||
// Separating line
|
||||
QFrame* hLine = new QFrame();
|
||||
hLine->setFrameShape(QFrame::HLine);
|
||||
hLine->setStyleSheet("color: #666666;");
|
||||
hLine->setObjectName("horizontalSeparatingLine");
|
||||
m_mainLayout->addWidget(hLine);
|
||||
|
||||
m_mainLayout->addSpacing(10);
|
||||
|
||||
// Requirements
|
||||
m_reqirementsTitleLabel = GemInspector::CreateStyledLabel(m_mainLayout, 16, s_headerColor);
|
||||
m_requirementsTitleLabel = GemInspector::CreateStyledLabel(m_mainLayout, 16, s_headerColor);
|
||||
|
||||
QHBoxLayout* requrementsLayout = new QHBoxLayout();
|
||||
requrementsLayout->setAlignment(Qt::AlignTop);
|
||||
requrementsLayout->setMargin(0);
|
||||
requrementsLayout->setSpacing(0);
|
||||
QHBoxLayout* requirementsLayout = new QHBoxLayout();
|
||||
requirementsLayout->setAlignment(Qt::AlignTop);
|
||||
requirementsLayout->setMargin(0);
|
||||
requirementsLayout->setSpacing(0);
|
||||
|
||||
m_reqirementsIconLabel = new QLabel();
|
||||
m_reqirementsIconLabel->setPixmap(QIcon(":/Warning.svg").pixmap(24, 24));
|
||||
requrementsLayout->addWidget(m_reqirementsIconLabel);
|
||||
m_requirementsIconLabel = new QLabel();
|
||||
m_requirementsIconLabel->setPixmap(QIcon(":/Warning.svg").pixmap(24, 24));
|
||||
requirementsLayout->addWidget(m_requirementsIconLabel);
|
||||
|
||||
m_reqirementsTextLabel = GemInspector::CreateStyledLabel(requrementsLayout, 10, s_textColor);
|
||||
m_reqirementsTextLabel->setWordWrap(true);
|
||||
m_reqirementsTextLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
m_reqirementsTextLabel->setOpenExternalLinks(true);
|
||||
m_requirementsTextLabel = GemInspector::CreateStyledLabel(requirementsLayout, 10, s_textColor);
|
||||
m_requirementsTextLabel->setWordWrap(true);
|
||||
m_requirementsTextLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
m_requirementsTextLabel->setOpenExternalLinks(true);
|
||||
|
||||
QSpacerItem* reqirementsSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding);
|
||||
requrementsLayout->addSpacerItem(reqirementsSpacer);
|
||||
QSpacerItem* requirementsSpacer = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding);
|
||||
requirementsLayout->addSpacerItem(requirementsSpacer);
|
||||
|
||||
m_mainLayout->addLayout(requrementsLayout);
|
||||
m_mainLayout->addLayout(requirementsLayout);
|
||||
|
||||
m_mainLayout->addSpacing(20);
|
||||
m_requirementsMainSpacer = new QSpacerItem(0, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_mainLayout->addSpacerItem(m_requirementsMainSpacer);
|
||||
|
||||
// Depending gems
|
||||
m_dependingGems = new GemsSubWidget();
|
||||
connect(m_dependingGems, &GemsSubWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); });
|
||||
m_mainLayout->addWidget(m_dependingGems);
|
||||
m_mainLayout->addSpacing(20);
|
||||
|
||||
// Additional information
|
||||
QLabel* additionalInfoLabel = CreateStyledLabel(m_mainLayout, 14, s_headerColor);
|
||||
additionalInfoLabel->setText("Additional Information");
|
||||
additionalInfoLabel->setText(tr("Additional Information"));
|
||||
|
||||
m_versionLabel = CreateStyledLabel(m_mainLayout, 12, s_textColor);
|
||||
m_lastUpdatedLabel = CreateStyledLabel(m_mainLayout, 12, s_textColor);
|
||||
m_binarySizeLabel = CreateStyledLabel(m_mainLayout, 12, s_textColor);
|
||||
m_versionLabel = CreateStyledLabel(m_mainLayout, s_baseFontSize, s_textColor);
|
||||
m_lastUpdatedLabel = CreateStyledLabel(m_mainLayout, s_baseFontSize, s_textColor);
|
||||
m_binarySizeLabel = CreateStyledLabel(m_mainLayout, s_baseFontSize, s_textColor);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <QItemSelection>
|
||||
#include <QScrollArea>
|
||||
#include <QWidget>
|
||||
#include <QSpacerItem>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
@@ -36,10 +36,16 @@ namespace O3DE::ProjectManager
|
||||
void Update(const QModelIndex& modelIndex);
|
||||
static QLabel* CreateStyledLabel(QLayout* layout, int fontSize, const QString& colorCodeString);
|
||||
|
||||
// Fonts
|
||||
inline constexpr static int s_baseFontSize = 12;
|
||||
|
||||
// Colors
|
||||
inline constexpr static const char* s_headerColor = "#FFFFFF";
|
||||
inline constexpr static const char* s_textColor = "#DDDDDD";
|
||||
|
||||
signals:
|
||||
void TagClicked(const QString& tag);
|
||||
|
||||
private slots:
|
||||
void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
@@ -54,13 +60,15 @@ namespace O3DE::ProjectManager
|
||||
QLabel* m_nameLabel = nullptr;
|
||||
QLabel* m_creatorLabel = nullptr;
|
||||
QLabel* m_summaryLabel = nullptr;
|
||||
LinkLabel* m_licenseLinkLabel = nullptr;
|
||||
LinkLabel* m_directoryLinkLabel = nullptr;
|
||||
LinkLabel* m_documentationLinkLabel = nullptr;
|
||||
|
||||
// Requirements
|
||||
QLabel* m_reqirementsTitleLabel = nullptr;
|
||||
QLabel* m_reqirementsIconLabel = nullptr;
|
||||
QLabel* m_reqirementsTextLabel = nullptr;
|
||||
QLabel* m_requirementsTitleLabel = nullptr;
|
||||
QLabel* m_requirementsIconLabel = nullptr;
|
||||
QLabel* m_requirementsTextLabel = nullptr;
|
||||
QSpacerItem* m_requirementsMainSpacer = nullptr;
|
||||
|
||||
// Depending and conflicting gems
|
||||
GemsSubWidget* m_dependingGems = nullptr;
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemModel::AddGem(const GemInfo& gemInfo)
|
||||
{
|
||||
if (FindIndexByNameString(gemInfo.m_name).isValid())
|
||||
{
|
||||
// do not add gems with duplicate names
|
||||
// this can happen by mistake or when a gem repo has a gem with the same name as a local gem
|
||||
AZ_TracePrintf("GemModel", "Ignoring duplicate gem: %s", gemInfo.m_name.toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
QStandardItem* item = new QStandardItem();
|
||||
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
@@ -50,16 +58,20 @@ namespace O3DE::ProjectManager
|
||||
item->setData(gemInfo.m_path, RolePath);
|
||||
item->setData(gemInfo.m_requirement, RoleRequirement);
|
||||
item->setData(gemInfo.m_downloadStatus, RoleDownloadStatus);
|
||||
item->setData(gemInfo.m_licenseText, RoleLicenseText);
|
||||
item->setData(gemInfo.m_licenseLink, RoleLicenseLink);
|
||||
|
||||
appendRow(item);
|
||||
|
||||
const QModelIndex modelIndex = index(rowCount()-1, 0);
|
||||
m_nameToIndexMap[gemInfo.m_displayName] = modelIndex;
|
||||
m_nameToIndexMap[gemInfo.m_name] = modelIndex;
|
||||
}
|
||||
|
||||
void GemModel::Clear()
|
||||
{
|
||||
clear();
|
||||
m_nameToIndexMap.clear();
|
||||
}
|
||||
|
||||
void GemModel::UpdateGemDependencies()
|
||||
@@ -238,6 +250,16 @@ namespace O3DE::ProjectManager
|
||||
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();
|
||||
}
|
||||
|
||||
GemModel* GemModel::GetSourceModel(QAbstractItemModel* model)
|
||||
{
|
||||
GemSortFilterProxyModel* proxyModel = qobject_cast<GemSortFilterProxyModel*>(model);
|
||||
@@ -276,9 +298,11 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemModel::SetIsAdded(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded)
|
||||
{
|
||||
// get the gemName first, because the modelIndex data change after adding because of filters
|
||||
QString gemName = modelIndex.data(RoleName).toString();
|
||||
model.setData(modelIndex, isAdded, RoleIsAdded);
|
||||
|
||||
UpdateDependencies(model, modelIndex);
|
||||
UpdateDependencies(model, gemName, isAdded);
|
||||
}
|
||||
|
||||
bool GemModel::HasDependentGems(const QModelIndex& modelIndex) const
|
||||
@@ -294,15 +318,17 @@ namespace O3DE::ProjectManager
|
||||
return false;
|
||||
}
|
||||
|
||||
void GemModel::UpdateDependencies(QAbstractItemModel& model, const QModelIndex& modelIndex)
|
||||
void GemModel::UpdateDependencies(QAbstractItemModel& model, const QString& gemName, bool isAdded)
|
||||
{
|
||||
GemModel* gemModel = GetSourceModel(&model);
|
||||
AZ_Assert(gemModel, "Failed to obtain GemModel");
|
||||
|
||||
QModelIndex modelIndex = gemModel->FindIndexByNameString(gemName);
|
||||
|
||||
QVector<QModelIndex> dependencies = gemModel->GatherGemDependencies(modelIndex);
|
||||
uint32_t numChangedDependencies = 0;
|
||||
|
||||
if (IsAdded(modelIndex))
|
||||
if (isAdded)
|
||||
{
|
||||
for (const QModelIndex& dependency : dependencies)
|
||||
{
|
||||
@@ -324,7 +350,7 @@ namespace O3DE::ProjectManager
|
||||
bool hasDependentGems = gemModel->HasDependentGems(modelIndex);
|
||||
if (IsAddedDependency(modelIndex) != hasDependentGems)
|
||||
{
|
||||
SetIsAddedDependency(model, modelIndex, hasDependentGems);
|
||||
SetIsAddedDependency(*gemModel, modelIndex, hasDependentGems);
|
||||
}
|
||||
|
||||
for (const QModelIndex& dependency : dependencies)
|
||||
@@ -343,7 +369,7 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
gemModel->emit gemStatusChanged(modelIndex, numChangedDependencies);
|
||||
gemModel->emit gemStatusChanged(gemName, numChangedDependencies);
|
||||
}
|
||||
|
||||
void GemModel::SetIsAddedDependency(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded)
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace O3DE::ProjectManager
|
||||
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 GemModel* GetSourceModel(QAbstractItemModel* model);
|
||||
static const GemModel* GetSourceModel(const QAbstractItemModel* model);
|
||||
|
||||
@@ -64,7 +66,7 @@ namespace O3DE::ProjectManager
|
||||
static bool NeedsToBeAdded(const QModelIndex& modelIndex, bool includeDependencies = false);
|
||||
static bool NeedsToBeRemoved(const QModelIndex& modelIndex, bool includeDependencies = false);
|
||||
static bool HasRequirement(const QModelIndex& modelIndex);
|
||||
static void UpdateDependencies(QAbstractItemModel& model, const QModelIndex& modelIndex);
|
||||
static void UpdateDependencies(QAbstractItemModel& model, const QString& gemName, bool isAdded);
|
||||
static void SetDownloadStatus(QAbstractItemModel& model, const QModelIndex& modelIndex, GemInfo::DownloadStatus status);
|
||||
|
||||
bool DoGemsToBeAddedHaveRequirements() const;
|
||||
@@ -78,7 +80,7 @@ namespace O3DE::ProjectManager
|
||||
int TotalAddedGems(bool includeDependencies = false) const;
|
||||
|
||||
signals:
|
||||
void gemStatusChanged(const QModelIndex& modelIndex, uint32_t numChangedDependencies);
|
||||
void gemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
|
||||
|
||||
private:
|
||||
void FindGemDisplayNamesByNameStrings(QStringList& inOutGemNames);
|
||||
@@ -107,7 +109,9 @@ namespace O3DE::ProjectManager
|
||||
RoleTypes,
|
||||
RolePath,
|
||||
RoleRequirement,
|
||||
RoleDownloadStatus
|
||||
RoleDownloadStatus,
|
||||
RoleLicenseText,
|
||||
RoleLicenseLink
|
||||
};
|
||||
|
||||
QHash<QString, QModelIndex> m_nameToIndexMap;
|
||||
|
||||
@@ -207,6 +207,8 @@ namespace O3DE::ProjectManager
|
||||
void GemSortFilterProxyModel::ResetFilters()
|
||||
{
|
||||
m_searchString.clear();
|
||||
m_gemSelectedFilter = GemSelected::NoFilter;
|
||||
m_gemActiveFilter = GemActive::NoFilter;
|
||||
m_gemOriginFilter = {};
|
||||
m_platformFilter = {};
|
||||
m_typeFilter = {};
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace O3DE::ProjectManager
|
||||
m_nameLabel->setObjectName("gemRepoInspectorNameLabel");
|
||||
m_mainLayout->addWidget(m_nameLabel);
|
||||
|
||||
m_repoLinkLabel = new LinkLabel(tr("Repo Url"), QUrl(""), 12, this);
|
||||
m_repoLinkLabel = new LinkLabel(tr("Repo Url"), QUrl(), 12, this);
|
||||
m_mainLayout->addWidget(m_repoLinkLabel);
|
||||
m_mainLayout->addSpacing(5);
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace O3DE::ProjectManager
|
||||
|
||||
QRect fullRect, itemRect, contentRect;
|
||||
CalcRects(options, fullRect, itemRect, contentRect);
|
||||
QRect buttonRect = CalcButtonRect(contentRect);
|
||||
|
||||
QFont standardFont(options.font);
|
||||
standardFont.setPixelSize(static_cast<int>(s_fontSize));
|
||||
@@ -70,15 +69,12 @@ namespace O3DE::ProjectManager
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
// Repo enabled
|
||||
DrawButton(painter, buttonRect, modelIndex);
|
||||
|
||||
// Repo name
|
||||
QString repoName = GemRepoModel::GetName(modelIndex);
|
||||
repoName = QFontMetrics(standardFont).elidedText(repoName, Qt::TextElideMode::ElideRight, s_nameMaxWidth);
|
||||
|
||||
QRect repoNameRect = GetTextRect(standardFont, repoName, s_fontSize);
|
||||
int currentHorizontalOffset = buttonRect.left() + s_buttonWidth + s_buttonSpacing;
|
||||
int currentHorizontalOffset = contentRect.left();
|
||||
repoNameRect.moveTo(currentHorizontalOffset, contentRect.center().y() - repoNameRect.height() / 2);
|
||||
repoNameRect = painter->boundingRect(repoNameRect, Qt::TextSingleLine, repoName);
|
||||
|
||||
@@ -126,7 +122,7 @@ namespace O3DE::ProjectManager
|
||||
initStyleOption(&options, modelIndex);
|
||||
|
||||
int marginsHorizontal = s_itemMargins.left() + s_itemMargins.right() + s_contentMargins.left() + s_contentMargins.right();
|
||||
return QSize(marginsHorizontal + s_buttonWidth + s_buttonSpacing + s_nameMaxWidth + s_creatorMaxWidth + s_updatedMaxWidth + s_contentSpacing * 3, s_height);
|
||||
return QSize(marginsHorizontal + s_nameMaxWidth + s_creatorMaxWidth + s_updatedMaxWidth + s_contentSpacing * 3, s_height);
|
||||
}
|
||||
|
||||
bool GemRepoItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex)
|
||||
@@ -139,13 +135,8 @@ namespace O3DE::ProjectManager
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
auto keyEvent = static_cast<const QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Space)
|
||||
{
|
||||
const bool isAdded = GemRepoModel::IsEnabled(modelIndex);
|
||||
GemRepoModel::SetEnabled(*model, modelIndex, !isAdded);
|
||||
return true;
|
||||
}
|
||||
else if (keyEvent->key() == Qt::Key_X)
|
||||
|
||||
if (keyEvent->key() == Qt::Key_X)
|
||||
{
|
||||
emit RemoveRepo(modelIndex);
|
||||
return true;
|
||||
@@ -163,17 +154,10 @@ namespace O3DE::ProjectManager
|
||||
|
||||
QRect fullRect, itemRect, contentRect;
|
||||
CalcRects(option, fullRect, itemRect, contentRect);
|
||||
const QRect buttonRect = CalcButtonRect(contentRect);
|
||||
const QRect deleteButtonRect = CalcDeleteButtonRect(contentRect);
|
||||
const QRect refreshButtonRect = CalcRefreshButtonRect(contentRect, buttonRect);
|
||||
const QRect refreshButtonRect = CalcRefreshButtonRect(contentRect);
|
||||
|
||||
if (buttonRect.contains(mouseEvent->pos()))
|
||||
{
|
||||
const bool isAdded = GemRepoModel::IsEnabled(modelIndex);
|
||||
GemRepoModel::SetEnabled(*model, modelIndex, !isAdded);
|
||||
return true;
|
||||
}
|
||||
else if (deleteButtonRect.contains(mouseEvent->pos()))
|
||||
if (deleteButtonRect.contains(mouseEvent->pos()))
|
||||
{
|
||||
emit RemoveRepo(modelIndex);
|
||||
return true;
|
||||
@@ -201,50 +185,15 @@ namespace O3DE::ProjectManager
|
||||
return QFontMetrics(font).boundingRect(text);
|
||||
}
|
||||
|
||||
QRect GemRepoItemDelegate::CalcButtonRect(const QRect& contentRect) const
|
||||
{
|
||||
const QPoint topLeft = QPoint(contentRect.left(), contentRect.top() + contentRect.height() / 2 - s_buttonHeight / 2);
|
||||
const QSize size = QSize(s_buttonWidth, s_buttonHeight);
|
||||
return QRect(topLeft, size);
|
||||
}
|
||||
|
||||
void GemRepoItemDelegate::DrawButton(QPainter* painter, const QRect& buttonRect, const QModelIndex& modelIndex) const
|
||||
{
|
||||
painter->save();
|
||||
QPoint circleCenter;
|
||||
|
||||
const bool isEnabled = GemRepoModel::IsEnabled(modelIndex);
|
||||
if (isEnabled)
|
||||
{
|
||||
painter->setBrush(m_buttonEnabledColor);
|
||||
painter->setPen(m_buttonEnabledColor);
|
||||
|
||||
circleCenter = buttonRect.center() + QPoint(buttonRect.width() / 2 - s_buttonBorderRadius + 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
circleCenter = buttonRect.center() + QPoint(-buttonRect.width() / 2 + s_buttonBorderRadius + 1, 1);
|
||||
}
|
||||
|
||||
// Rounded rect
|
||||
painter->drawRoundedRect(buttonRect, s_buttonBorderRadius, s_buttonBorderRadius);
|
||||
|
||||
// Circle
|
||||
painter->setBrush(m_textColor);
|
||||
painter->drawEllipse(circleCenter, s_buttonCircleRadius, s_buttonCircleRadius);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QRect GemRepoItemDelegate::CalcDeleteButtonRect(const QRect& contentRect) const
|
||||
{
|
||||
const QPoint topLeft = QPoint(contentRect.right() - s_iconSize, contentRect.center().y() - s_iconSize / 2);
|
||||
return QRect(topLeft, QSize(s_iconSize, s_iconSize));
|
||||
}
|
||||
|
||||
QRect GemRepoItemDelegate::CalcRefreshButtonRect(const QRect& contentRect, const QRect& buttonRect) const
|
||||
QRect GemRepoItemDelegate::CalcRefreshButtonRect(const QRect& contentRect) const
|
||||
{
|
||||
const int topLeftX = buttonRect.left() + s_buttonWidth + s_buttonSpacing + s_nameMaxWidth + s_creatorMaxWidth + s_updatedMaxWidth + s_contentSpacing * 2 + s_refreshIconSpacing;
|
||||
const int topLeftX = contentRect.left() + s_nameMaxWidth + s_creatorMaxWidth + s_updatedMaxWidth + s_contentSpacing * 2 + s_refreshIconSpacing;
|
||||
const QPoint topLeft = QPoint(topLeftX, contentRect.center().y() - s_refreshIconSize / 3);
|
||||
return QRect(topLeft, QSize(s_refreshIconSize, s_refreshIconSize));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace O3DE::ProjectManager
|
||||
const QColor m_backgroundColor = QColor("#333333"); // Outside of the actual repo item
|
||||
const QColor m_itemBackgroundColor = QColor("#404040"); // Background color of the repo item
|
||||
const QColor m_borderColor = QColor("#1E70EB");
|
||||
const QColor m_buttonEnabledColor = QColor("#1E70EB");
|
||||
|
||||
// Item
|
||||
inline constexpr static int s_height = 72; // Repo item total height
|
||||
@@ -53,13 +52,6 @@ namespace O3DE::ProjectManager
|
||||
inline constexpr static int s_creatorMaxWidth = 115;
|
||||
inline constexpr static int s_updatedMaxWidth = 125;
|
||||
|
||||
// Button
|
||||
inline constexpr static int s_buttonWidth = 32;
|
||||
inline constexpr static int s_buttonHeight = 16;
|
||||
inline constexpr static int s_buttonBorderRadius = 8;
|
||||
inline constexpr static int s_buttonCircleRadius = s_buttonBorderRadius - 2;
|
||||
inline constexpr static int s_buttonSpacing = 20;
|
||||
|
||||
// Icon
|
||||
inline constexpr static int s_iconSize = 24;
|
||||
inline constexpr static int s_iconSpacing = 16;
|
||||
@@ -75,8 +67,7 @@ namespace O3DE::ProjectManager
|
||||
QRect GetTextRect(QFont& font, const QString& text, qreal fontSize) const;
|
||||
QRect CalcButtonRect(const QRect& contentRect) const;
|
||||
QRect CalcDeleteButtonRect(const QRect& contentRect) const;
|
||||
QRect CalcRefreshButtonRect(const QRect& contentRect, const QRect& buttonRect) const;
|
||||
void DrawButton(QPainter* painter, const QRect& contentRect, const QModelIndex& modelIndex) const;
|
||||
QRect CalcRefreshButtonRect(const QRect& contentRect) const;
|
||||
void DrawEditButtons(QPainter* painter, const QRect& contentRect) const;
|
||||
|
||||
QAbstractItemModel* m_model = nullptr;
|
||||
|
||||
@@ -289,23 +289,22 @@ namespace O3DE::ProjectManager
|
||||
m_gemRepoHeaderTable->setObjectName("gemRepoHeaderTable");
|
||||
m_gemRepoListHeader = m_gemRepoHeaderTable->horizontalHeader();
|
||||
m_gemRepoListHeader->setObjectName("gemRepoListHeader");
|
||||
m_gemRepoListHeader->setDefaultAlignment(Qt::AlignLeft);
|
||||
m_gemRepoListHeader->setSectionResizeMode(QHeaderView::ResizeMode::Fixed);
|
||||
|
||||
// Insert columns so the header labels will show up
|
||||
m_gemRepoHeaderTable->insertColumn(0);
|
||||
m_gemRepoHeaderTable->insertColumn(1);
|
||||
m_gemRepoHeaderTable->insertColumn(2);
|
||||
m_gemRepoHeaderTable->insertColumn(3);
|
||||
m_gemRepoHeaderTable->setHorizontalHeaderLabels({ tr("Enabled"), tr("Repository Name"), tr("Creator"), tr("Updated") });
|
||||
m_gemRepoHeaderTable->setHorizontalHeaderLabels({ tr("Repository Name"), tr("Creator"), tr("Updated") });
|
||||
|
||||
const int headerExtraMargin = 10;
|
||||
m_gemRepoListHeader->resizeSection(0, GemRepoItemDelegate::s_buttonWidth + GemRepoItemDelegate::s_buttonSpacing - 3);
|
||||
m_gemRepoListHeader->resizeSection(1, GemRepoItemDelegate::s_nameMaxWidth + GemRepoItemDelegate::s_contentSpacing - headerExtraMargin);
|
||||
m_gemRepoListHeader->resizeSection(2, GemRepoItemDelegate::s_creatorMaxWidth + GemRepoItemDelegate::s_contentSpacing - headerExtraMargin);
|
||||
m_gemRepoListHeader->resizeSection(3, GemRepoItemDelegate::s_updatedMaxWidth + GemRepoItemDelegate::s_contentSpacing - headerExtraMargin);
|
||||
const int headerExtraMargin = 18;
|
||||
m_gemRepoListHeader->resizeSection(0, GemRepoItemDelegate::s_nameMaxWidth + GemRepoItemDelegate::s_contentSpacing + headerExtraMargin);
|
||||
m_gemRepoListHeader->resizeSection(1, GemRepoItemDelegate::s_creatorMaxWidth + GemRepoItemDelegate::s_contentSpacing);
|
||||
m_gemRepoListHeader->resizeSection(2, GemRepoItemDelegate::s_updatedMaxWidth + GemRepoItemDelegate::s_contentSpacing);
|
||||
|
||||
// Required to set stylesheet in code as it will not be respected if set in qss
|
||||
m_gemRepoHeaderTable->horizontalHeader()->setStyleSheet("QHeaderView::section { background-color:transparent; color:white; font-size:12px; text-align:left; border-style:none; }");
|
||||
m_gemRepoHeaderTable->horizontalHeader()->setStyleSheet("QHeaderView::section { background-color:transparent; color:white; font-size:12px; border-style:none; }");
|
||||
middleVLayout->addWidget(m_gemRepoHeaderTable);
|
||||
|
||||
m_gemRepoListView = new GemRepoListView(m_gemRepoModel, m_gemRepoModel->GetSelectionModel(), this);
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace O3DE::ProjectManager
|
||||
m_layout->addWidget(m_textLabel);
|
||||
|
||||
m_tagWidget = new TagContainerWidget();
|
||||
connect(m_tagWidget, &TagContainerWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); });
|
||||
m_layout->addWidget(m_tagWidget);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,15 @@ namespace O3DE::ProjectManager
|
||||
class GemsSubWidget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
GemsSubWidget(QWidget* parent = nullptr);
|
||||
void Update(const QString& title, const QString& text, const QStringList& gemNames);
|
||||
|
||||
signals:
|
||||
void TagClicked(const QString& tag);
|
||||
|
||||
private:
|
||||
QLabel* m_titleLabel = nullptr;
|
||||
QLabel* m_textLabel = nullptr;
|
||||
|
||||
@@ -709,6 +709,8 @@ namespace O3DE::ProjectManager
|
||||
gemInfo.m_requirement = Py_To_String_Optional(data, "requirements", "");
|
||||
gemInfo.m_creator = Py_To_String_Optional(data, "origin", "");
|
||||
gemInfo.m_documentationLink = Py_To_String_Optional(data, "documentation_url", "");
|
||||
gemInfo.m_licenseText = Py_To_String_Optional(data, "license", "Unspecified License");
|
||||
gemInfo.m_licenseLink = Py_To_String_Optional(data, "license_url", "");
|
||||
|
||||
if (gemInfo.m_creator.contains("Open 3D Engine"))
|
||||
{
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace O3DE::ProjectManager
|
||||
setObjectName("TagWidget");
|
||||
}
|
||||
|
||||
void TagWidget::mousePressEvent([[maybe_unused]] QMouseEvent* event)
|
||||
{
|
||||
emit(TagClicked(text()));
|
||||
}
|
||||
|
||||
TagContainerWidget::TagContainerWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@@ -45,7 +50,9 @@ namespace O3DE::ProjectManager
|
||||
|
||||
foreach (const QString& tag, tags)
|
||||
{
|
||||
flowLayout->addWidget(new TagWidget(tag));
|
||||
TagWidget* tagWidget = new TagWidget(tag);
|
||||
connect(tagWidget, &TagWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); });
|
||||
flowLayout->addWidget(tagWidget);
|
||||
}
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace O3DE::ProjectManager
|
||||
public:
|
||||
explicit TagWidget(const QString& text, QWidget* parent = nullptr);
|
||||
~TagWidget() = default;
|
||||
|
||||
signals:
|
||||
void TagClicked(const QString& tag);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
};
|
||||
|
||||
// Widget containing multiple tags, automatically wrapping based on the size
|
||||
@@ -38,5 +44,8 @@ namespace O3DE::ProjectManager
|
||||
~TagContainerWidget() = default;
|
||||
|
||||
void Update(const QStringList& tags);
|
||||
|
||||
signals:
|
||||
void TagClicked(const QString& tag);
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
QLabel* projectPreviewLabel = new QLabel(tr("Select an image (PNG). Minimum %1 x %2 pixels.")
|
||||
.arg(QString::number(ProjectPreviewImageWidth), QString::number(ProjectPreviewImageHeight)));
|
||||
projectPreviewLabel->setObjectName("projectPreviewLabel");
|
||||
previewExtrasLayout->addWidget(projectPreviewLabel);
|
||||
|
||||
m_projectPreviewImage = new QLabel(this);
|
||||
|
||||
Reference in New Issue
Block a user