Full UI Built for Updating and Uninstalling Gems
Signed-off-by: nggieber <nggieber@amazon.com>
This commit is contained in:
@@ -563,6 +563,52 @@ QProgressBar::chunk {
|
||||
margin-top:5px;
|
||||
}
|
||||
|
||||
#gemCatalogUpdateGemButton,
|
||||
#gemCatalogUninstallGemButton
|
||||
{
|
||||
qproperty-flat: true;
|
||||
min-height:24px;
|
||||
max-height:24px;
|
||||
border-radius: 3px;
|
||||
text-align:center;
|
||||
font-size:12px;
|
||||
font-weight:600;
|
||||
}
|
||||
|
||||
#gemCatalogUpdateGemButton {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #888888, stop: 1.0 #555555);
|
||||
}
|
||||
#gemCatalogUpdateGemButton:hover {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #999999, stop: 1.0 #666666);
|
||||
}
|
||||
#gemCatalogUpdateGemButton:pressed {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #555555, stop: 1.0 #777777);
|
||||
}
|
||||
|
||||
#footer > #gemCatalogUninstallGemButton,
|
||||
#gemCatalogUninstallGemButton {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #E32C27, stop: 1.0 #951D21);
|
||||
}
|
||||
#footer > #gemCatalogUninstallGemButton:hover,
|
||||
#gemCatalogUninstallGemButton:hover {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #FD3129, stop: 1.0 #AF2221);
|
||||
}
|
||||
#footer > #gemCatalogUninstallGemButton:pressed,
|
||||
#gemCatalogUninstallGemButton:pressed {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #951D1F, stop: 1.0 #C92724);
|
||||
}
|
||||
|
||||
#gemCatalogDialogSubTitle {
|
||||
font-size:14px;
|
||||
font-weight:600;
|
||||
}
|
||||
|
||||
/************** Filter Tag widget **************/
|
||||
|
||||
#FilterTagWidgetTextLabel {
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
#include <GemCatalog/GemSortFilterProxyModel.h>
|
||||
#include <GemCatalog/GemRequirementDialog.h>
|
||||
#include <GemCatalog/GemDependenciesDialog.h>
|
||||
#include <GemCatalog/GemUpdateDialog.h>
|
||||
#include <GemCatalog/GemUninstallDialog.h>
|
||||
#include <DownloadController.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
@@ -55,6 +58,8 @@ namespace O3DE::ProjectManager
|
||||
m_gemInspector->setFixedWidth(240);
|
||||
|
||||
connect(m_gemInspector, &GemInspector::TagClicked, this, &GemCatalogScreen::SelectGem);
|
||||
connect(m_gemInspector, &GemInspector::UpdateGem, this, &GemCatalogScreen::UpdateGem);
|
||||
connect(m_gemInspector, &GemInspector::UninstallGem, this, &GemCatalogScreen::UninstallGem);
|
||||
|
||||
QWidget* filterWidget = new QWidget(this);
|
||||
filterWidget->setFixedWidth(240);
|
||||
@@ -104,9 +109,10 @@ namespace O3DE::ProjectManager
|
||||
|
||||
// Select the first entry after everything got correctly sized
|
||||
QTimer::singleShot(200, [=]{
|
||||
QModelIndex firstModelIndex = m_gemListView->model()->index(0,0);
|
||||
m_gemListView->selectionModel()->select(firstModelIndex, QItemSelectionModel::ClearAndSelect);
|
||||
});
|
||||
QModelIndex firstModelIndex = m_gemModel->index(0, 0); // m_gemListView->model()->index(0,0);
|
||||
//m_gemListView->selectionModel()->select(firstModelIndex, QItemSelectionModel::ClearAndSelect);
|
||||
m_gemModel->GetSelectionModel()->select(firstModelIndex, QItemSelectionModel::ClearAndSelect);
|
||||
});
|
||||
}
|
||||
|
||||
void GemCatalogScreen::OnAddGemClicked()
|
||||
@@ -170,7 +176,7 @@ namespace O3DE::ProjectManager
|
||||
notification = GemModel::GetDisplayName(modelIndex);
|
||||
if (numChangedDependencies > 0)
|
||||
{
|
||||
notification += " " + tr("and") + " ";
|
||||
notification += tr(" and ");
|
||||
}
|
||||
if (added && GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded)
|
||||
{
|
||||
@@ -178,15 +184,15 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
if (numChangedDependencies == 1 )
|
||||
if (numChangedDependencies == 1)
|
||||
{
|
||||
notification += "1 Gem " + tr("dependency");
|
||||
notification += tr("1 Gem dependency");
|
||||
}
|
||||
else if (numChangedDependencies > 1)
|
||||
{
|
||||
notification += QString("%1 Gem ").arg(numChangedDependencies) + tr("dependencies");
|
||||
notification += tr("%1 Gem %2").arg(QString(numChangedDependencies), tr("dependencies"));
|
||||
}
|
||||
notification += " " + (added ? tr("activated") : tr("deactivated"));
|
||||
notification += (added ? tr(" activated") : tr(" deactivated"));
|
||||
|
||||
AzQtComponents::ToastConfiguration toastConfiguration(AzQtComponents::ToastType::Custom, notification, "");
|
||||
toastConfiguration.m_customIconImage = ":/gem.svg";
|
||||
@@ -210,6 +216,26 @@ namespace O3DE::ProjectManager
|
||||
m_gemListView->scrollTo(proxyIndex);
|
||||
}
|
||||
|
||||
void GemCatalogScreen::UpdateGem(const QModelIndex& modelIndex)
|
||||
{
|
||||
const QString selectedGemName = m_gemModel->GetDisplayName(modelIndex);
|
||||
GemUpdateDialog* confirmUpdateDialog = new GemUpdateDialog(selectedGemName, this);
|
||||
if (confirmUpdateDialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
// Update Gem
|
||||
}
|
||||
}
|
||||
|
||||
void GemCatalogScreen::UninstallGem(const QModelIndex& modelIndex)
|
||||
{
|
||||
const QString selectedGemName = m_gemModel->GetDisplayName(modelIndex);
|
||||
GemUninstallDialog* confirmUninstallDialog = new GemUninstallDialog(selectedGemName, this);
|
||||
if (confirmUninstallDialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
// Uninstall Gem
|
||||
}
|
||||
}
|
||||
|
||||
void GemCatalogScreen::hideEvent(QHideEvent* event)
|
||||
{
|
||||
ScreenWidget::hideEvent(event);
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace O3DE::ProjectManager
|
||||
void OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
|
||||
void OnAddGemClicked();
|
||||
void SelectGem(const QString& gemName);
|
||||
void UpdateGem(const QModelIndex& modelIndex);
|
||||
void UninstallGem(const QModelIndex& modelIndex);
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
@@ -62,6 +64,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
private:
|
||||
void FillModel(const QString& projectPath);
|
||||
QModelIndex GetCurrentlySelectedGem();
|
||||
|
||||
AZStd::unique_ptr<AzToolsFramework::ToastNotificationsView> m_notificationsView;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace O3DE::ProjectManager
|
||||
UnknownDownloadStatus = -1,
|
||||
NotDownloaded,
|
||||
Downloading,
|
||||
Downloaded,
|
||||
Downloaded
|
||||
};
|
||||
static QString GetDownloadStatusString(DownloadStatus status);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QSpacerItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
@@ -70,6 +71,8 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void GemInspector::Update(const QModelIndex& modelIndex)
|
||||
{
|
||||
m_curModelIndex = modelIndex;
|
||||
|
||||
if (!modelIndex.isValid())
|
||||
{
|
||||
m_mainWidget->hide();
|
||||
@@ -122,6 +125,18 @@ namespace O3DE::ProjectManager
|
||||
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)));
|
||||
|
||||
// Update and Uninstall buttons
|
||||
if (m_model->GetGemOrigin(modelIndex) == GemInfo::Remote && m_model->GetDownloadStatus(modelIndex) == GemInfo::Downloaded)
|
||||
{
|
||||
m_updateGemButton->show();
|
||||
m_uninstallGemButton->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_updateGemButton->hide();
|
||||
m_uninstallGemButton->hide();
|
||||
}
|
||||
|
||||
m_mainWidget->adjustSize();
|
||||
m_mainWidget->show();
|
||||
}
|
||||
@@ -222,7 +237,7 @@ namespace O3DE::ProjectManager
|
||||
|
||||
// Depending gems
|
||||
m_dependingGems = new GemsSubWidget();
|
||||
connect(m_dependingGems, &GemsSubWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); });
|
||||
connect(m_dependingGems, &GemsSubWidget::TagClicked, this, [this](const QString& tag){ emit TagClicked(tag); });
|
||||
m_mainLayout->addWidget(m_dependingGems);
|
||||
m_mainLayout->addSpacing(20);
|
||||
|
||||
@@ -233,5 +248,20 @@ namespace O3DE::ProjectManager
|
||||
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);
|
||||
|
||||
m_mainLayout->addSpacing(20);
|
||||
|
||||
// Update and Uninstall buttons
|
||||
m_updateGemButton = new QPushButton(tr("Update Gem"));
|
||||
m_updateGemButton->setObjectName("gemCatalogUpdateGemButton");
|
||||
m_mainLayout->addWidget(m_updateGemButton);
|
||||
connect(m_updateGemButton, &QPushButton::clicked, this , [this]{ emit UpdateGem(m_curModelIndex); });
|
||||
|
||||
m_mainLayout->addSpacing(10);
|
||||
|
||||
m_uninstallGemButton = new QPushButton(tr("Uninstall Gem"));
|
||||
m_uninstallGemButton->setObjectName("gemCatalogUninstallGemButton");
|
||||
m_mainLayout->addWidget(m_uninstallGemButton);
|
||||
connect(m_uninstallGemButton, &QPushButton::clicked, this , [this]{ emit UninstallGem(m_curModelIndex); });
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
#include <QItemSelection>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
QT_FORWARD_DECLARE_CLASS(QSpacerItem)
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
@@ -45,6 +46,8 @@ namespace O3DE::ProjectManager
|
||||
|
||||
signals:
|
||||
void TagClicked(const QString& tag);
|
||||
void UpdateGem(const QModelIndex& modelIndex);
|
||||
void UninstallGem(const QModelIndex& modelIndex);
|
||||
|
||||
private slots:
|
||||
void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
@@ -55,6 +58,7 @@ namespace O3DE::ProjectManager
|
||||
GemModel* m_model = nullptr;
|
||||
QWidget* m_mainWidget = nullptr;
|
||||
QVBoxLayout* m_mainLayout = nullptr;
|
||||
QModelIndex m_curModelIndex;
|
||||
|
||||
// General info (top) section
|
||||
QLabel* m_nameLabel = nullptr;
|
||||
@@ -77,5 +81,8 @@ namespace O3DE::ProjectManager
|
||||
QLabel* m_versionLabel = nullptr;
|
||||
QLabel* m_lastUpdatedLabel = nullptr;
|
||||
QLabel* m_binarySizeLabel = nullptr;
|
||||
|
||||
QPushButton* m_updateGemButton = nullptr;
|
||||
QPushButton* m_uninstallGemButton = nullptr;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GemCatalog/GemUninstallDialog.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QVariant>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemUninstallDialog::GemUninstallDialog(const QString& gemName, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Uninstall Remote Gem"));
|
||||
setObjectName("GemUninstallDialog");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setModal(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setMargin(30);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
// Body
|
||||
QLabel* subTitleLabel = new QLabel(tr("Are you sure you want to uninstall %1?").arg(gemName));
|
||||
subTitleLabel->setObjectName("gemCatalogDialogSubTitle");
|
||||
layout->addWidget(subTitleLabel);
|
||||
|
||||
layout->addSpacing(10);
|
||||
|
||||
QLabel* bodyLabel = new QLabel(tr("The Gem and its related files will be uninstalled. This does not affect the Gem’s repository. "
|
||||
"You can reinstall this Gem from the Catalog, but its contents may be subject to change."));
|
||||
bodyLabel->setWordWrap(true);
|
||||
bodyLabel->setFixedWidth(440);
|
||||
layout->addWidget(bodyLabel);
|
||||
|
||||
layout->addSpacing(60);
|
||||
|
||||
// Buttons
|
||||
QDialogButtonBox* dialogButtons = new QDialogButtonBox();
|
||||
dialogButtons->setObjectName("footer");
|
||||
layout->addWidget(dialogButtons);
|
||||
|
||||
QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
|
||||
cancelButton->setProperty("secondary", true);
|
||||
QPushButton* uninstallButton = dialogButtons->addButton(tr("Uninstall Gem"), QDialogButtonBox::ApplyRole);
|
||||
uninstallButton->setObjectName("gemCatalogUninstallGemButton");
|
||||
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
connect(uninstallButton, &QPushButton::clicked, this, &QDialog::accept);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemUninstallDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
public:
|
||||
explicit GemUninstallDialog(const QString& gemName, QWidget *parent = nullptr);
|
||||
~GemUninstallDialog() = default;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GemCatalog/GemUpdateDialog.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QVariant>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemUpdateDialog::GemUpdateDialog(const QString& gemName, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Update Remote Gem"));
|
||||
setObjectName("GemUpdateDialog");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setModal(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setMargin(30);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
// Body
|
||||
QLabel* subTitleLabel = new QLabel(tr("Update to the latest version of %1?").arg(gemName));
|
||||
subTitleLabel->setObjectName("gemCatalogDialogSubTitle");
|
||||
layout->addWidget(subTitleLabel);
|
||||
|
||||
layout->addSpacing(10);
|
||||
|
||||
QLabel* bodyLabel = new QLabel(tr("The latest version of this Gem may not be compatible with your engine. "
|
||||
"Updating this Gem will remove any local changes made to this Gem, "
|
||||
"and may remove old features that are in use."));
|
||||
bodyLabel->setWordWrap(true);
|
||||
bodyLabel->setFixedWidth(440);
|
||||
layout->addWidget(bodyLabel);
|
||||
|
||||
layout->addSpacing(60);
|
||||
|
||||
// Buttons
|
||||
QDialogButtonBox* dialogButtons = new QDialogButtonBox();
|
||||
dialogButtons->setObjectName("footer");
|
||||
layout->addWidget(dialogButtons);
|
||||
|
||||
QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
|
||||
cancelButton->setProperty("secondary", true);
|
||||
QPushButton* updateButton = dialogButtons->addButton(tr("Update Gem"), QDialogButtonBox::ApplyRole);
|
||||
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
connect(updateButton, &QPushButton::clicked, this, &QDialog::accept);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemUpdateDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
public :
|
||||
explicit GemUpdateDialog(const QString& gemName, QWidget* parent = nullptr);
|
||||
~GemUpdateDialog() = default;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -96,6 +96,10 @@ set(FILES
|
||||
Source/GemCatalog/GemListHeaderWidget.cpp
|
||||
Source/GemCatalog/GemModel.h
|
||||
Source/GemCatalog/GemModel.cpp
|
||||
Source/GemCatalog/GemUninstallDialog.h
|
||||
Source/GemCatalog/GemUninstallDialog.cpp
|
||||
Source/GemCatalog/GemUpdateDialog.h
|
||||
Source/GemCatalog/GemUpdateDialog.cpp
|
||||
Source/GemCatalog/GemDependenciesDialog.h
|
||||
Source/GemCatalog/GemDependenciesDialog.cpp
|
||||
Source/GemCatalog/GemRequirementDialog.h
|
||||
|
||||
Reference in New Issue
Block a user