Moves Cart to Right Panel with Gem Inspector

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

@ -423,6 +423,8 @@ namespace O3DE::ProjectManager
}); });
m_cartOverlay->show(); m_cartOverlay->show();
emit OverlayUpdate(m_cartOverlay);
/*
const QPoint parentPos = m_dropDownButton->mapToParent(m_dropDownButton->pos()); const QPoint parentPos = m_dropDownButton->mapToParent(m_dropDownButton->pos());
const QPoint globalPos = m_dropDownButton->mapToGlobal(m_dropDownButton->pos()); const QPoint globalPos = m_dropDownButton->mapToGlobal(m_dropDownButton->pos());
const QPoint offset(-4, 10); const QPoint offset(-4, 10);
@ -430,6 +432,7 @@ namespace O3DE::ProjectManager
globalPos.y() + offset.y(), globalPos.y() + offset.y(),
m_cartOverlay->width(), m_cartOverlay->width(),
m_cartOverlay->height()); m_cartOverlay->height());
*/
} }
CartButton::~CartButton() CartButton::~CartButton()
@ -514,6 +517,8 @@ namespace O3DE::ProjectManager
connect(m_downloadController, &DownloadController::GemDownloadAdded, this, &GemCatalogHeaderWidget::GemDownloadAdded); connect(m_downloadController, &DownloadController::GemDownloadAdded, this, &GemCatalogHeaderWidget::GemDownloadAdded);
connect(m_downloadController, &DownloadController::GemDownloadRemoved, this, &GemCatalogHeaderWidget::GemDownloadRemoved); connect(m_downloadController, &DownloadController::GemDownloadRemoved, this, &GemCatalogHeaderWidget::GemDownloadRemoved);
connect(m_cartButton, &CartButton::OverlayUpdate, this, [this](QWidget* cartOverlay) { emit OverlayUpdate(cartOverlay); });
} }
void GemCatalogHeaderWidget::GemDownloadAdded(const QString& /*gemName*/) void GemCatalogHeaderWidget::GemDownloadAdded(const QString& /*gemName*/)

@ -70,6 +70,9 @@ namespace O3DE::ProjectManager
~CartButton(); ~CartButton();
void ShowOverlay(); void ShowOverlay();
signals:
void OverlayUpdate(QWidget* cartOverlay);
private: private:
void mousePressEvent(QMouseEvent* event) override; void mousePressEvent(QMouseEvent* event) override;
void hideEvent(QHideEvent*) override; void hideEvent(QHideEvent*) override;
@ -104,6 +107,7 @@ namespace O3DE::ProjectManager
void AddGem(); void AddGem();
void OpenGemsRepo(); void OpenGemsRepo();
void RefreshGems(); void RefreshGems();
void OverlayUpdate(QWidget* cartOverlay);
private: private:
AzQtComponents::SearchLineEdit* m_filterLineEdit = nullptr; AzQtComponents::SearchLineEdit* m_filterLineEdit = nullptr;

@ -60,14 +60,26 @@ namespace O3DE::ProjectManager
hLayout->setMargin(0); hLayout->setMargin(0);
vLayout->addLayout(hLayout); vLayout->addLayout(hLayout);
m_rightPanelStack = new QStackedWidget(this);
m_rightPanelStack->setFixedWidth(240);
connect(m_headerWidget, &GemCatalogHeaderWidget::OverlayUpdate, this, &GemCatalogScreen::UpdateAndShowGemCart);
m_gemListView = new GemListView(m_proxyModel, m_proxyModel->GetSelectionModel(), this); m_gemListView = new GemListView(m_proxyModel, m_proxyModel->GetSelectionModel(), this);
m_gemInspector = new GemInspector(m_gemModel, this); m_gemInspector = new GemInspector(m_gemModel, this);
m_gemInspector->setFixedWidth(240);
connect(m_gemInspector, &GemInspector::TagClicked, [=](const Tag& tag) { SelectGem(tag.id); }); connect(m_gemInspector, &GemInspector::TagClicked, [=](const Tag& tag) { SelectGem(tag.id); });
connect(m_gemInspector, &GemInspector::UpdateGem, this, &GemCatalogScreen::UpdateGem); connect(m_gemInspector, &GemInspector::UpdateGem, this, &GemCatalogScreen::UpdateGem);
connect(m_gemInspector, &GemInspector::UninstallGem, this, &GemCatalogScreen::UninstallGem); connect(m_gemInspector, &GemInspector::UninstallGem, this, &GemCatalogScreen::UninstallGem);
// Show the inspector if gem selection changes
connect(
m_gemModel->GetSelectionModel(), &QItemSelectionModel::selectionChanged, this,
[this]
{
m_rightPanelStack->setCurrentIndex(RightPanelWidgetOrder::Inspector);
});
QWidget* filterWidget = new QWidget(this); QWidget* filterWidget = new QWidget(this);
filterWidget->setFixedWidth(240); filterWidget->setFixedWidth(240);
m_filterWidgetLayout = new QVBoxLayout(); m_filterWidgetLayout = new QVBoxLayout();
@ -85,7 +97,9 @@ namespace O3DE::ProjectManager
hLayout->addWidget(filterWidget); hLayout->addWidget(filterWidget);
hLayout->addLayout(middleVLayout); hLayout->addLayout(middleVLayout);
hLayout->addWidget(m_gemInspector);
hLayout->addWidget(m_rightPanelStack);
m_rightPanelStack->addWidget(m_gemInspector);
m_notificationsView = AZStd::make_unique<AzToolsFramework::ToastNotificationsView>(this, AZ_CRC("GemCatalogNotificationsView")); m_notificationsView = AZStd::make_unique<AzToolsFramework::ToastNotificationsView>(this, AZ_CRC("GemCatalogNotificationsView"));
m_notificationsView->SetOffset(QPoint(10, 70)); m_notificationsView->SetOffset(QPoint(10, 70));
@ -302,6 +316,8 @@ namespace O3DE::ProjectManager
QModelIndex proxyIndex = m_proxyModel->mapFromSource(modelIndex); QModelIndex proxyIndex = m_proxyModel->mapFromSource(modelIndex);
m_proxyModel->GetSelectionModel()->select(proxyIndex, QItemSelectionModel::ClearAndSelect); m_proxyModel->GetSelectionModel()->select(proxyIndex, QItemSelectionModel::ClearAndSelect);
m_gemListView->scrollTo(proxyIndex); m_gemListView->scrollTo(proxyIndex);
m_rightPanelStack->setCurrentIndex(RightPanelWidgetOrder::Inspector);
} }
void GemCatalogScreen::UpdateGem(const QModelIndex& modelIndex) void GemCatalogScreen::UpdateGem(const QModelIndex& modelIndex)
@ -559,6 +575,18 @@ namespace O3DE::ProjectManager
emit ChangeScreenRequest(ProjectManagerScreen::GemRepos); emit ChangeScreenRequest(ProjectManagerScreen::GemRepos);
} }
void GemCatalogScreen::UpdateAndShowGemCart(QWidget* cartWidget)
{
QWidget* previousCart = m_rightPanelStack->widget(RightPanelWidgetOrder::Cart);
if (previousCart)
{
m_rightPanelStack->removeWidget(previousCart);
}
m_rightPanelStack->insertWidget(RightPanelWidgetOrder::Cart, cartWidget);
m_rightPanelStack->setCurrentIndex(RightPanelWidgetOrder::Cart);
}
void GemCatalogScreen::OnGemDownloadResult(const QString& gemName, bool succeeded) void GemCatalogScreen::OnGemDownloadResult(const QString& gemName, bool succeeded)
{ {
if (succeeded) if (succeeded)

@ -18,8 +18,10 @@
#include <GemCatalog/GemInspector.h> #include <GemCatalog/GemInspector.h>
#include <GemCatalog/GemModel.h> #include <GemCatalog/GemModel.h>
#include <GemCatalog/GemSortFilterProxyModel.h> #include <GemCatalog/GemSortFilterProxyModel.h>
#include <QSet> #include <QSet>
#include <QString> #include <QString>
#include <QStackedWidget>
#endif #endif
namespace O3DE::ProjectManager namespace O3DE::ProjectManager
@ -62,14 +64,21 @@ namespace O3DE::ProjectManager
private slots: private slots:
void HandleOpenGemRepo(); void HandleOpenGemRepo();
void UpdateAndShowGemCart(QWidget* cartWidget);
private: private:
enum RightPanelWidgetOrder
{
Inspector = 0,
Cart
};
void FillModel(const QString& projectPath); void FillModel(const QString& projectPath);
AZStd::unique_ptr<AzToolsFramework::ToastNotificationsView> m_notificationsView; AZStd::unique_ptr<AzToolsFramework::ToastNotificationsView> m_notificationsView;
GemListView* m_gemListView = nullptr; GemListView* m_gemListView = nullptr;
QStackedWidget* m_rightPanelStack = nullptr;
GemInspector* m_gemInspector = nullptr; GemInspector* m_gemInspector = nullptr;
GemModel* m_gemModel = nullptr; GemModel* m_gemModel = nullptr;
GemCatalogHeaderWidget* m_headerWidget = nullptr; GemCatalogHeaderWidget* m_headerWidget = nullptr;

Loading…
Cancel
Save