Merge pull request #5769 from aws-lumberyard-dev/Prism/RemoteGemWarning

Extra gem download failure handling
monroegm-disable-blank-issue-2
AMZN-Phil 4 years ago committed by GitHub
commit 092d125acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,6 +57,7 @@ namespace O3DE::ProjectManager
vLayout->addWidget(m_headerWidget);
connect(m_gemModel, &GemModel::gemStatusChanged, this, &GemCatalogScreen::OnGemStatusChanged);
connect(m_gemModel, &GemModel::dependencyGemStatusChanged, this, &GemCatalogScreen::OnDependencyGemStatusChanged);
connect(m_gemModel->GetSelectionModel(), &QItemSelectionModel::selectionChanged, this, [this]{ ShowInspector(); });
connect(m_headerWidget, &GemCatalogHeaderWidget::RefreshGems, this, &GemCatalogScreen::Refresh);
connect(m_headerWidget, &GemCatalogHeaderWidget::OpenGemsRepo, this, &GemCatalogScreen::HandleOpenGemRepo);
@ -279,7 +280,8 @@ namespace O3DE::ProjectManager
{
notification += tr(" and ");
}
if (added && GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded)
if (added && (GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded) ||
(GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::DownloadFailed))
{
m_downloadController->AddGemDownload(GemModel::GetName(modelIndex));
GemModel::SetDownloadStatus(*m_gemModel, modelIndex, GemInfo::DownloadStatus::Downloading);
@ -304,6 +306,18 @@ namespace O3DE::ProjectManager
}
}
void GemCatalogScreen::OnDependencyGemStatusChanged(const QString& gemName)
{
QModelIndex modelIndex = m_gemModel->FindIndexByNameString(gemName);
bool added = GemModel::IsAddedDependency(modelIndex);
if (added && (GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded) ||
(GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::DownloadFailed))
{
m_downloadController->AddGemDownload(GemModel::GetName(modelIndex));
GemModel::SetDownloadStatus(*m_gemModel, modelIndex, GemInfo::DownloadStatus::Downloading);
}
}
void GemCatalogScreen::SelectGem(const QString& gemName)
{
QModelIndex modelIndex = m_gemModel->FindIndexByNameString(gemName);
@ -383,6 +397,7 @@ namespace O3DE::ProjectManager
// Remove gem from gems to be added to update any dependencies
GemModel::SetIsAdded(*m_gemModel, modelIndex, false);
GemModel::DeactivateDependentGems(*m_gemModel, modelIndex);
// Unregister the gem
auto unregisterResult = PythonBindingsInterface::Get()->UnregisterGem(selectedGemPath);
@ -660,6 +675,8 @@ namespace O3DE::ProjectManager
QModelIndex index = m_gemModel->FindIndexByNameString(gemName);
if (index.isValid())
{
GemModel::SetIsAdded(*m_gemModel, index, false);
GemModel::DeactivateDependentGems(*m_gemModel, index);
GemModel::SetDownloadStatus(*m_gemModel, index, GemInfo::DownloadFailed);
}
}

@ -53,6 +53,7 @@ namespace O3DE::ProjectManager
public slots:
void OnGemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
void OnDependencyGemStatusChanged(const QString& gemName);
void OnAddGemClicked();
void SelectGem(const QString& gemName);
void OnGemDownloadResult(const QString& gemName, bool succeeded = true);

@ -357,6 +357,8 @@ namespace O3DE::ProjectManager
if (!IsAdded(dependency))
{
numChangedDependencies++;
const QString dependencyName = gemModel->GetName(dependency);
gemModel->emit dependencyGemStatusChanged(dependencyName);
}
}
}
@ -381,6 +383,8 @@ namespace O3DE::ProjectManager
if (!IsAdded(dependency))
{
numChangedDependencies++;
const QString dependencyName = gemModel->GetName(dependency);
gemModel->emit dependencyGemStatusChanged(dependencyName);
}
}
}
@ -479,6 +483,23 @@ namespace O3DE::ProjectManager
return previouslyAdded && !added;
}
void GemModel::DeactivateDependentGems(QAbstractItemModel& model, const QModelIndex& modelIndex)
{
GemModel* gemModel = GetSourceModel(&model);
AZ_Assert(gemModel, "Failed to obtain GemModel");
QVector<QModelIndex> dependentGems = gemModel->GatherDependentGems(modelIndex);
if (!dependentGems.isEmpty())
{
// we need to deactivate all gems that depend on this one
for (auto dependentModelIndex : dependentGems)
{
SetIsAdded(model, dependentModelIndex, false);
}
}
}
void GemModel::SetDownloadStatus(QAbstractItemModel& model, const QModelIndex& modelIndex, GemInfo::DownloadStatus status)
{
model.setData(modelIndex, status, RoleDownloadStatus);

@ -99,6 +99,7 @@ namespace O3DE::ProjectManager
static bool NeedsToBeRemoved(const QModelIndex& modelIndex, bool includeDependencies = false);
static bool HasRequirement(const QModelIndex& modelIndex);
static void UpdateDependencies(QAbstractItemModel& model, const QString& gemName, bool isAdded);
static void DeactivateDependentGems(QAbstractItemModel& model, const QModelIndex& modelIndex);
static void SetDownloadStatus(QAbstractItemModel& model, const QModelIndex& modelIndex, GemInfo::DownloadStatus status);
bool DoGemsToBeAddedHaveRequirements() const;
@ -113,6 +114,7 @@ namespace O3DE::ProjectManager
signals:
void gemStatusChanged(const QString& gemName, uint32_t numChangedDependencies);
void dependencyGemStatusChanged(const QString& gemName);
protected slots:
void OnRowsAboutToBeRemoved(const QModelIndex& parent, int first, int last);

Loading…
Cancel
Save