From 02364b869e20adb9828678f0c76910df34b30285 Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Tue, 19 Oct 2021 19:48:36 -0700 Subject: [PATCH 1/6] First part of UI feedback for downloading gems Signed-off-by: AMZN-Phil --- .../Resources/ProjectManager.qss | 12 ++ .../GemCatalog/GemCatalogHeaderWidget.cpp | 119 +++++++++++++++++- .../GemCatalog/GemCatalogHeaderWidget.h | 10 +- .../Source/GemCatalog/GemCatalogScreen.cpp | 6 +- .../Source/GemCatalog/GemCatalogScreen.h | 2 + .../ProjectManager/Source/PythonBindings.cpp | 27 ++++ .../ProjectManager/Source/PythonBindings.h | 2 + .../Source/PythonBindingsInterface.h | 2 + .../Source/UpdateProjectCtrl.cpp | 7 +- .../project_manager_files.cmake | 4 + 10 files changed, 181 insertions(+), 10 deletions(-) diff --git a/Code/Tools/ProjectManager/Resources/ProjectManager.qss b/Code/Tools/ProjectManager/Resources/ProjectManager.qss index 5f7826dbac..507cf38726 100644 --- a/Code/Tools/ProjectManager/Resources/ProjectManager.qss +++ b/Code/Tools/ProjectManager/Resources/ProjectManager.qss @@ -481,6 +481,18 @@ QProgressBar::chunk { font-weight: 600; } +#GemCatalogCartOverlayGemDownloadHeader { + margin:0; + padding: 0px; + background-color: #333333; +} + +#GemCatalogCartOverlayGemDownloadBG { + margin:0; + padding: 0px; + background-color: #444444; +} + #GemCatalogHeaderLabel { font-size: 12px; color: #FFFFFF; diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp index 9fca6040d4..7d25ae180b 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp @@ -12,13 +12,15 @@ #include #include #include +#include #include namespace O3DE::ProjectManager { - CartOverlayWidget::CartOverlayWidget(GemModel* gemModel, QWidget* parent) + CartOverlayWidget::CartOverlayWidget(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent) : QWidget(parent) , m_gemModel(gemModel) + , m_downloadController(downloadController) { setObjectName("GemCatalogCart"); @@ -42,6 +44,9 @@ namespace O3DE::ProjectManager hLayout->addWidget(closeButton); m_layout->addLayout(hLayout); + // downloading gems + CreateDownloadSection(); + // added CreateGemSection( tr("Gem to be activated"), tr("Gems to be activated"), [=] { @@ -149,6 +154,109 @@ namespace O3DE::ProjectManager update(); } + void CartOverlayWidget::CreateDownloadSection() + { + QWidget* widget = new QWidget(); + widget->setFixedWidth(s_width); + m_layout->addWidget(widget); + + QVBoxLayout* layout = new QVBoxLayout(); + layout->setAlignment(Qt::AlignTop); + widget->setLayout(layout); + + QLabel* label = new QLabel(); + label->setObjectName("GemCatalogCartOverlaySectionLabel"); + layout->addWidget(label); + + label->setText(tr("Gems to be installed")); + + // Create header section + QWidget* downloadingGemsWidget = new QWidget(); + downloadingGemsWidget->setObjectName("GemCatalogCartOverlayGemDownloadHeader"); + layout->addWidget(downloadingGemsWidget); + QVBoxLayout* gemDownloadLayout = new QVBoxLayout(); + gemDownloadLayout->setMargin(0); + gemDownloadLayout->setAlignment(Qt::AlignTop); + downloadingGemsWidget->setLayout(gemDownloadLayout); + QLabel* processingQueueLabel = new QLabel("Processing Queue"); + gemDownloadLayout->addWidget(processingQueueLabel); + + QWidget* downloadingItemWidget = new QWidget(); + downloadingItemWidget->setObjectName("GemCatalogCartOverlayGemDownloadBG"); + gemDownloadLayout->addWidget(downloadingItemWidget); + QVBoxLayout* downloadingItemLayout = new QVBoxLayout(); + downloadingItemLayout->setAlignment(Qt::AlignTop); + downloadingItemWidget->setLayout(downloadingItemLayout); + + auto update = [=](int downloadProgress) + { + if (m_downloadController->IsDownloadQueueEmpty()) + { + widget->hide(); + } + else + { + widget->setUpdatesEnabled(false); + // remove items + QLayoutItem* layoutItem = nullptr; + while ((layoutItem = downloadingItemLayout->takeAt(0)) != nullptr) + { + if (layoutItem->layout()) + { + // Gem info row + QLayoutItem* rowLayoutItem = nullptr; + while ((rowLayoutItem = layoutItem->layout()->takeAt(0)) != nullptr) + { + rowLayoutItem->widget()->deleteLater(); + } + layoutItem->layout()->deleteLater(); + } + if (layoutItem->widget()) + { + layoutItem->widget()->deleteLater(); + } + } + + // Setup gem download rows + const AZStd::vector& downloadQueue = m_downloadController->GetDownloadQueue(); + + QLabel* downloadsInProgessLabel = new QLabel(""); + downloadsInProgessLabel->setText( + QString("%1 %2").arg(downloadQueue.size()).arg(downloadQueue.size() == 1 ? tr("download in progress...") : tr("downloads in progress..."))); + downloadingItemLayout->addWidget(downloadsInProgessLabel); + + for (int downloadingGemNumber = 0; downloadingGemNumber < downloadQueue.size(); ++downloadingGemNumber) + { + QHBoxLayout* nameProgressLayout = new QHBoxLayout(); + TagWidget* newTag = new TagWidget(downloadQueue[downloadingGemNumber]); + nameProgressLayout->addWidget(newTag); + QLabel* progress = new QLabel(downloadingGemNumber == 0? QString("%1%").arg(downloadProgress) : tr("Queued")); + nameProgressLayout->addWidget(progress); + QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + nameProgressLayout->addSpacerItem(spacer); + QLabel* cancelText = new QLabel(tr("Cancel")); + nameProgressLayout->addWidget(cancelText); + downloadingItemLayout->addLayout(nameProgressLayout); + QProgressBar* downloadProgessBar = new QProgressBar(); + downloadingItemLayout->addWidget(downloadProgessBar); + downloadProgessBar->setValue(downloadingGemNumber == 0 ? downloadProgress : 0); + } + + widget->setUpdatesEnabled(true); + widget->show(); + } + }; + + auto downloadEnded = [=](bool /*success*/) + { + update(0); // update the list to remove the gem that has finished + }; + // connect to download controller data changed + connect(m_downloadController, &O3DEObjectDownloadController::GemDownloadProgress, this, update); + connect(m_downloadController, &O3DEObjectDownloadController::Done, this, downloadEnded); + update(0); + } + QStringList CartOverlayWidget::ConvertFromModelIndices(const QVector& gems) const { QStringList gemNames; @@ -160,9 +268,10 @@ namespace O3DE::ProjectManager return gemNames; } - CartButton::CartButton(GemModel* gemModel, QWidget* parent) + CartButton::CartButton(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent) : QWidget(parent) , m_gemModel(gemModel) + , m_downloadController(downloadController) { m_layout = new QHBoxLayout(); m_layout->setMargin(0); @@ -239,7 +348,7 @@ namespace O3DE::ProjectManager delete m_cartOverlay; } - m_cartOverlay = new CartOverlayWidget(m_gemModel, this); + m_cartOverlay = new CartOverlayWidget(m_gemModel, m_downloadController, this); connect(m_cartOverlay, &QWidget::destroyed, this, [=] { // Reset the overlay pointer on destruction to prevent dangling pointers. @@ -265,7 +374,7 @@ namespace O3DE::ProjectManager } } - GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, QWidget* parent) + GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, O3DEObjectDownloadController* downloadController, QWidget* parent) : QFrame(parent) { QHBoxLayout* hLayout = new QHBoxLayout(); @@ -293,7 +402,7 @@ namespace O3DE::ProjectManager hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding)); hLayout->addSpacerItem(new QSpacerItem(75, 0, QSizePolicy::Fixed)); - CartButton* cartButton = new CartButton(gemModel); + CartButton* cartButton = new CartButton(gemModel, downloadController); hLayout->addWidget(cartButton); } diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h index 2cfda4c790..3d977e2b15 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h @@ -21,6 +21,7 @@ #include #include #include +#include #endif namespace O3DE::ProjectManager @@ -31,16 +32,18 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - CartOverlayWidget(GemModel* gemModel, QWidget* parent = nullptr); + CartOverlayWidget(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); private: QStringList ConvertFromModelIndices(const QVector& gems) const; using GetTagIndicesCallback = AZStd::function()>; void CreateGemSection(const QString& singularTitle, const QString& pluralTitle, GetTagIndicesCallback getTagIndices); + void CreateDownloadSection(); QVBoxLayout* m_layout = nullptr; GemModel* m_gemModel = nullptr; + O3DEObjectDownloadController* m_downloadController = nullptr; inline constexpr static int s_width = 240; }; @@ -51,7 +54,7 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - CartButton(GemModel* gemModel, QWidget* parent = nullptr); + CartButton(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); ~CartButton(); void ShowOverlay(); @@ -64,6 +67,7 @@ namespace O3DE::ProjectManager QLabel* m_countLabel = nullptr; QPushButton* m_dropDownButton = nullptr; CartOverlayWidget* m_cartOverlay = nullptr; + O3DEObjectDownloadController* m_downloadController = nullptr; inline constexpr static int s_iconSize = 24; inline constexpr static int s_arrowDownIconSize = 8; @@ -75,7 +79,7 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - explicit GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, QWidget* parent = nullptr); + explicit GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); ~GemCatalogHeaderWidget() = default; void ReinitForProject(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp index 945878768d..5a4462d14b 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,10 @@ namespace O3DE::ProjectManager vLayout->setSpacing(0); setLayout(vLayout); - m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxModel); + m_downloadController = new O3DEObjectDownloadController(); + m_downloadController->Start(); + + m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxModel, m_downloadController); vLayout->addWidget(m_headerWidget); QHBoxLayout* hLayout = new QHBoxLayout(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h index 72e8d44f65..ad603138f0 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h @@ -39,6 +39,7 @@ namespace O3DE::ProjectManager EnableDisableGemsResult EnableDisableGemsForProject(const QString& projectPath); GemModel* GetGemModel() const { return m_gemModel; } + O3DEObjectDownloadController* GetDownloadController() const { return m_downloadController; } private: void FillModel(const QString& projectPath); @@ -50,5 +51,6 @@ namespace O3DE::ProjectManager GemSortFilterProxyModel* m_proxModel = nullptr; QVBoxLayout* m_filterWidgetLayout = nullptr; GemFilterWidget* m_filterWidget = nullptr; + O3DEObjectDownloadController* m_downloadController = nullptr; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 633116e8b6..bc8773b0c8 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -301,6 +301,7 @@ namespace O3DE::ProjectManager m_enableGemProject = pybind11::module::import("o3de.enable_gem"); m_disableGemProject = pybind11::module::import("o3de.disable_gem"); m_editProjectProperties = pybind11::module::import("o3de.project_properties"); + m_download = pybind11::module::import("o3de.download"); m_pathlib = pybind11::module::import("pathlib"); // make sure the engine is registered @@ -1075,4 +1076,30 @@ namespace O3DE::ProjectManager std::sort(gemRepos.begin(), gemRepos.end()); return AZ::Success(AZStd::move(gemRepos)); } + + AZ::Outcome PythonBindings::DownloadGem(const QString& gemName, std::function gemProgressCallback) + { + bool downloadSucceeded = false; + auto result = ExecuteWithLockErrorHandling( + [&] + { + auto downloadResult = m_download.attr("download_gem")( + QString_To_Py_String(gemName), // gem name + pybind11::none(), // destination path + false// skip auto register + ); + downloadSucceeded = (downloadResult.cast() == 0); + }); + + if (!result.IsSuccess()) + { + return result; + } + else if (!downloadSucceeded) + { + return AZ::Failure("Failed to download gem."); + } + + return AZ::Success(); + } } diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.h b/Code/Tools/ProjectManager/Source/PythonBindings.h index d0704d0bd1..638ce6b1d4 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.h +++ b/Code/Tools/ProjectManager/Source/PythonBindings.h @@ -61,6 +61,7 @@ namespace O3DE::ProjectManager bool AddGemRepo(const QString& repoUri) override; bool RemoveGemRepo(const QString& repoUri) override; AZ::Outcome, AZStd::string> GetAllGemRepoInfos() override; + AZ::Outcome DownloadGem(const QString& gemName, std::function gemProgressCallback) override; private: AZ_DISABLE_COPY_MOVE(PythonBindings); @@ -87,6 +88,7 @@ namespace O3DE::ProjectManager pybind11::handle m_enableGemProject; pybind11::handle m_disableGemProject; pybind11::handle m_editProjectProperties; + pybind11::handle m_download; pybind11::handle m_pathlib; }; } diff --git a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h index 5daf543c11..19442540a4 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h +++ b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h @@ -187,6 +187,8 @@ namespace O3DE::ProjectManager * @return A list of gem repo infos. */ virtual AZ::Outcome, AZStd::string> GetAllGemRepoInfos() = 0; + + virtual AZ::Outcome DownloadGem(const QString& gemName, std::function gemProgressCallback) = 0; }; using PythonBindingsInterface = AZ::Interface; diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp index e952ada57a..40f114b82b 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp @@ -38,7 +38,7 @@ namespace O3DE::ProjectManager vLayout->addWidget(m_header); m_updateSettingsScreen = new UpdateProjectSettingsScreen(); - m_gemCatalogScreen = new GemCatalogScreen(); + m_gemCatalogScreen = new GemCatalogScreen(nullptr); m_stack = new QStackedWidget(this); m_stack->setObjectName("body"); @@ -136,6 +136,11 @@ namespace O3DE::ProjectManager } else if (m_stack->currentIndex() == ScreenOrder::Gems && m_gemCatalogScreen) { + if (!m_gemCatalogScreen->GetDownloadController()->IsDownloadQueueEmpty()) + { + QMessageBox::critical(this, tr("Gems downloading"), tr("You must wait for gems to finish downloading before continuing.")); + return; + } // Enable or disable the gems that got adjusted in the gem catalog and apply them to the given project. const GemCatalogScreen::EnableDisableGemsResult result = m_gemCatalogScreen->EnableDisableGemsForProject(m_projectInfo.m_path); if (result == GemCatalogScreen::EnableDisableGemsResult::Failed) diff --git a/Code/Tools/ProjectManager/project_manager_files.cmake b/Code/Tools/ProjectManager/project_manager_files.cmake index fd8389ca4f..d53cf6c8c1 100644 --- a/Code/Tools/ProjectManager/project_manager_files.cmake +++ b/Code/Tools/ProjectManager/project_manager_files.cmake @@ -29,6 +29,10 @@ set(FILES Source/FormImageBrowseEditWidget.cpp Source/GemsSubWidget.h Source/GemsSubWidget.cpp + Source/O3DEObjectDownloadController.h + Source/O3DEObjectDownloadController.cpp + Source/O3DEObjectDownloadWorker.h + Source/O3DEObjectDownloadWorker.cpp Source/PathValidator.h Source/PathValidator.cpp Source/ProjectManagerWindow.h From 023e8fcff2d4121e27cc23e819e55a4e55ce7d6a Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Wed, 20 Oct 2021 10:21:15 -0700 Subject: [PATCH 2/6] Add missing files for review Signed-off-by: AMZN-Phil --- .../Source/O3DEObjectDownloadController.cpp | 92 +++++++++++++++++++ .../Source/O3DEObjectDownloadController.h | 65 +++++++++++++ .../Source/O3DEObjectDownloadWorker.cpp | 52 +++++++++++ .../Source/O3DEObjectDownloadWorker.h | 51 ++++++++++ 4 files changed, 260 insertions(+) create mode 100644 Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp create mode 100644 Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h create mode 100644 Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp create mode 100644 Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp new file mode 100644 index 0000000000..f3be0fd8e4 --- /dev/null +++ b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp @@ -0,0 +1,92 @@ +/* + * 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 +#include +#include + +#include +#include +#include + + +namespace O3DE::ProjectManager +{ + O3DEObjectDownloadController::O3DEObjectDownloadController(QWidget* parent) + : QObject() + , m_lastProgress(0) + , m_parent(parent) + { + m_worker = new O3DEObjectDownloadWorker(); + m_worker->moveToThread(&m_workerThread); + + connect(&m_workerThread, &QThread::started, m_worker, &O3DEObjectDownloadWorker::StartDownload); + connect(m_worker, &O3DEObjectDownloadWorker::Done, this, &O3DEObjectDownloadController::HandleResults); + connect(m_worker, &O3DEObjectDownloadWorker::UpdateProgress, this, &O3DEObjectDownloadController::UpdateUIProgress); + connect(this, &O3DEObjectDownloadController::StartGemDownload, m_worker, &O3DEObjectDownloadWorker::StartDownload); + } + + O3DEObjectDownloadController::~O3DEObjectDownloadController() + { + connect(&m_workerThread, &QThread::finished, m_worker, &O3DEObjectDownloadWorker::deleteLater); + m_workerThread.requestInterruption(); + m_workerThread.quit(); + m_workerThread.wait(); + } + + void O3DEObjectDownloadController::AddGemDownload(const QString& gemName) + { + m_gemNames.push_back(gemName); + if (m_gemNames.size() == 1) + { + m_worker->SetGemToDownload(m_gemNames[0], false); + m_workerThread.start(); + } + } + + void O3DEObjectDownloadController::Start() + { + + } + + void O3DEObjectDownloadController::UpdateUIProgress(int progress) + { + m_lastProgress = progress; + emit GemDownloadProgress(progress); + } + + void O3DEObjectDownloadController::HandleResults(const QString& result) + { + bool succeeded = true; + + if (!result.isEmpty()) + { + QMessageBox::critical(nullptr, tr("Gem download"), result); + succeeded = false; + } + + m_gemNames.erase(m_gemNames.begin()); + emit Done(succeeded); + + if (!m_gemNames.empty()) + { + emit StartGemDownload(m_gemNames[0]); + } + else + { + m_workerThread.quit(); + m_workerThread.wait(); + } + } + + void O3DEObjectDownloadController::HandleCancel() + { + m_workerThread.quit(); + emit Done(false); + } +} // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h new file mode 100644 index 0000000000..7cd9220f9f --- /dev/null +++ b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h @@ -0,0 +1,65 @@ +/* + * 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 +#include +#include +#endif + +QT_FORWARD_DECLARE_CLASS(QProcess) + +namespace O3DE::ProjectManager +{ + QT_FORWARD_DECLARE_CLASS(O3DEObjectDownloadWorker) + + class O3DEObjectDownloadController : public QObject + { + Q_OBJECT + + public: + explicit O3DEObjectDownloadController(QWidget* parent = nullptr); + ~O3DEObjectDownloadController(); + + void AddGemDownload(const QString& m_gemName); + + bool IsDownloadQueueEmpty() + { + return m_gemNames.empty(); + } + + const AZStd::vector& GetDownloadQueue() const + { + return m_gemNames; + } + + const QString& GetCurrentDownloadingGem() const + { + return m_gemNames[0]; + } + public slots: + void Start(); + void UpdateUIProgress(int progress); + void HandleResults(const QString& result); + void HandleCancel(); + + signals: + void StartGemDownload(const QString& gemName); + void Done(bool success = true); + void GemDownloadProgress(int percentage); + + private: + O3DEObjectDownloadWorker* m_worker; + QThread m_workerThread; + QWidget* m_parent; + AZStd::vector m_gemNames; + + int m_lastProgress; + }; +} // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp new file mode 100644 index 0000000000..3462600c40 --- /dev/null +++ b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp @@ -0,0 +1,52 @@ +/* + * 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 +#include +#include + +#include +#include +#include + + +namespace O3DE::ProjectManager +{ + O3DEObjectDownloadWorker::O3DEObjectDownloadWorker() + : QObject() + { + } + + void O3DEObjectDownloadWorker::StartDownload() + { + auto gemDownloadProgress = [=](int downloadProgress) + { + m_downloadProgress = downloadProgress; + emit UpdateProgress(downloadProgress); + }; + AZ::Outcome gemInfoResult = PythonBindingsInterface::Get()->DownloadGem(m_gemName, gemDownloadProgress); + if (gemInfoResult.IsSuccess()) + { + emit Done(""); + } + else + { + emit Done(tr("Gem download failed")); + } + } + + void O3DEObjectDownloadWorker::SetGemToDownload(const QString& gemName, bool downloadNow) + { + m_gemName = gemName; + if (downloadNow) + { + StartDownload(); + } + } + +} // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h new file mode 100644 index 0000000000..4fff71634f --- /dev/null +++ b/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h @@ -0,0 +1,51 @@ +/* + * 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 + +#include +#include +#include +#endif + +QT_FORWARD_DECLARE_CLASS(QProcess) + +namespace O3DE::ProjectManager +{ + class O3DEObjectDownloadWorker : public QObject + { + // QProcess::waitForFinished uses -1 to indicate that the process should not timeout + static constexpr int MaxBuildTimeMSecs = -1; + // Download was cancelled + inline static const QString DownloadCancelled = QObject::tr("Download Cancelled."); + + Q_OBJECT + + public: + explicit O3DEObjectDownloadWorker(); + ~O3DEObjectDownloadWorker() = default; + + public slots: + void StartDownload(); + void SetGemToDownload(const QString& gemName, bool downloadNow = true); + + signals: + void UpdateProgress(int progress); + void Done(QString result = ""); + + private: + + QProcess* m_configProjectProcess = nullptr; + QProcess* m_buildProjectProcess = nullptr; + + QString m_gemName; + int m_downloadProgress; + }; +} // namespace O3DE::ProjectManager From 9aa9ed8c8e160c06f6447ea568e49ca05c0374af Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Wed, 20 Oct 2021 14:55:08 -0700 Subject: [PATCH 3/6] Changing some class names and other download UI feedback. Signed-off-by: AMZN-Phil --- ...dController.cpp => DownloadController.cpp} | 30 +++++++++---------- ...nloadController.h => DownloadController.h} | 10 +++---- ...tDownloadWorker.cpp => DownloadWorker.cpp} | 10 +++---- ...bjectDownloadWorker.h => DownloadWorker.h} | 10 ++----- .../GemCatalog/GemCatalogHeaderWidget.cpp | 10 +++---- .../GemCatalog/GemCatalogHeaderWidget.h | 12 ++++---- .../Source/GemCatalog/GemCatalogScreen.cpp | 4 +-- .../Source/GemCatalog/GemCatalogScreen.h | 4 +-- .../Source/UpdateProjectCtrl.cpp | 2 +- .../project_manager_files.cmake | 8 ++--- 10 files changed, 48 insertions(+), 52 deletions(-) rename Code/Tools/ProjectManager/Source/{O3DEObjectDownloadController.cpp => DownloadController.cpp} (59%) rename Code/Tools/ProjectManager/Source/{O3DEObjectDownloadController.h => DownloadController.h} (83%) rename Code/Tools/ProjectManager/Source/{O3DEObjectDownloadWorker.cpp => DownloadWorker.cpp} (78%) rename Code/Tools/ProjectManager/Source/{O3DEObjectDownloadWorker.h => DownloadWorker.h} (84%) diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp b/Code/Tools/ProjectManager/Source/DownloadController.cpp similarity index 59% rename from Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp rename to Code/Tools/ProjectManager/Source/DownloadController.cpp index f3be0fd8e4..e06763ed4d 100644 --- a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.cpp +++ b/Code/Tools/ProjectManager/Source/DownloadController.cpp @@ -6,8 +6,8 @@ * */ -#include -#include +#include +#include #include #include @@ -17,29 +17,29 @@ namespace O3DE::ProjectManager { - O3DEObjectDownloadController::O3DEObjectDownloadController(QWidget* parent) + DownloadController::DownloadController(QWidget* parent) : QObject() , m_lastProgress(0) , m_parent(parent) { - m_worker = new O3DEObjectDownloadWorker(); + m_worker = new DownloadWorker(); m_worker->moveToThread(&m_workerThread); - connect(&m_workerThread, &QThread::started, m_worker, &O3DEObjectDownloadWorker::StartDownload); - connect(m_worker, &O3DEObjectDownloadWorker::Done, this, &O3DEObjectDownloadController::HandleResults); - connect(m_worker, &O3DEObjectDownloadWorker::UpdateProgress, this, &O3DEObjectDownloadController::UpdateUIProgress); - connect(this, &O3DEObjectDownloadController::StartGemDownload, m_worker, &O3DEObjectDownloadWorker::StartDownload); + connect(&m_workerThread, &QThread::started, m_worker, &DownloadWorker::StartDownload); + connect(m_worker, &DownloadWorker::Done, this, &DownloadController::HandleResults); + connect(m_worker, &DownloadWorker::UpdateProgress, this, &DownloadController::UpdateUIProgress); + connect(this, &DownloadController::StartGemDownload, m_worker, &DownloadWorker::StartDownload); } - O3DEObjectDownloadController::~O3DEObjectDownloadController() + DownloadController::~DownloadController() { - connect(&m_workerThread, &QThread::finished, m_worker, &O3DEObjectDownloadWorker::deleteLater); + connect(&m_workerThread, &QThread::finished, m_worker, &DownloadController::deleteLater); m_workerThread.requestInterruption(); m_workerThread.quit(); m_workerThread.wait(); } - void O3DEObjectDownloadController::AddGemDownload(const QString& gemName) + void DownloadController::AddGemDownload(const QString& gemName) { m_gemNames.push_back(gemName); if (m_gemNames.size() == 1) @@ -49,18 +49,18 @@ namespace O3DE::ProjectManager } } - void O3DEObjectDownloadController::Start() + void DownloadController::Start() { } - void O3DEObjectDownloadController::UpdateUIProgress(int progress) + void DownloadController::UpdateUIProgress(int progress) { m_lastProgress = progress; emit GemDownloadProgress(progress); } - void O3DEObjectDownloadController::HandleResults(const QString& result) + void DownloadController::HandleResults(const QString& result) { bool succeeded = true; @@ -84,7 +84,7 @@ namespace O3DE::ProjectManager } } - void O3DEObjectDownloadController::HandleCancel() + void DownloadController::HandleCancel() { m_workerThread.quit(); emit Done(false); diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h b/Code/Tools/ProjectManager/Source/DownloadController.h similarity index 83% rename from Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h rename to Code/Tools/ProjectManager/Source/DownloadController.h index 7cd9220f9f..a769533c72 100644 --- a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadController.h +++ b/Code/Tools/ProjectManager/Source/DownloadController.h @@ -17,15 +17,15 @@ QT_FORWARD_DECLARE_CLASS(QProcess) namespace O3DE::ProjectManager { - QT_FORWARD_DECLARE_CLASS(O3DEObjectDownloadWorker) + QT_FORWARD_DECLARE_CLASS(DownloadWorker) - class O3DEObjectDownloadController : public QObject + class DownloadController : public QObject { Q_OBJECT public: - explicit O3DEObjectDownloadController(QWidget* parent = nullptr); - ~O3DEObjectDownloadController(); + explicit DownloadController(QWidget* parent = nullptr); + ~DownloadController(); void AddGemDownload(const QString& m_gemName); @@ -55,7 +55,7 @@ namespace O3DE::ProjectManager void GemDownloadProgress(int percentage); private: - O3DEObjectDownloadWorker* m_worker; + DownloadWorker* m_worker; QThread m_workerThread; QWidget* m_parent; AZStd::vector m_gemNames; diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp b/Code/Tools/ProjectManager/Source/DownloadWorker.cpp similarity index 78% rename from Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp rename to Code/Tools/ProjectManager/Source/DownloadWorker.cpp index 3462600c40..954eae432e 100644 --- a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.cpp +++ b/Code/Tools/ProjectManager/Source/DownloadWorker.cpp @@ -6,8 +6,8 @@ * */ -#include -#include +#include +#include #include #include @@ -17,12 +17,12 @@ namespace O3DE::ProjectManager { - O3DEObjectDownloadWorker::O3DEObjectDownloadWorker() + DownloadWorker::DownloadWorker() : QObject() { } - void O3DEObjectDownloadWorker::StartDownload() + void DownloadWorker::StartDownload() { auto gemDownloadProgress = [=](int downloadProgress) { @@ -40,7 +40,7 @@ namespace O3DE::ProjectManager } } - void O3DEObjectDownloadWorker::SetGemToDownload(const QString& gemName, bool downloadNow) + void DownloadWorker::SetGemToDownload(const QString& gemName, bool downloadNow) { m_gemName = gemName; if (downloadNow) diff --git a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h b/Code/Tools/ProjectManager/Source/DownloadWorker.h similarity index 84% rename from Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h rename to Code/Tools/ProjectManager/Source/DownloadWorker.h index 4fff71634f..1bd51bca66 100644 --- a/Code/Tools/ProjectManager/Source/O3DEObjectDownloadWorker.h +++ b/Code/Tools/ProjectManager/Source/DownloadWorker.h @@ -9,17 +9,13 @@ #if !defined(Q_MOC_RUN) #include - -#include -#include -#include #endif QT_FORWARD_DECLARE_CLASS(QProcess) namespace O3DE::ProjectManager { - class O3DEObjectDownloadWorker : public QObject + class DownloadWorker : public QObject { // QProcess::waitForFinished uses -1 to indicate that the process should not timeout static constexpr int MaxBuildTimeMSecs = -1; @@ -29,8 +25,8 @@ namespace O3DE::ProjectManager Q_OBJECT public: - explicit O3DEObjectDownloadWorker(); - ~O3DEObjectDownloadWorker() = default; + explicit DownloadWorker(); + ~DownloadWorker() = default; public slots: void StartDownload(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp index 7d25ae180b..9396234a68 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp @@ -17,7 +17,7 @@ namespace O3DE::ProjectManager { - CartOverlayWidget::CartOverlayWidget(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent) + CartOverlayWidget::CartOverlayWidget(GemModel* gemModel, DownloadController* downloadController, QWidget* parent) : QWidget(parent) , m_gemModel(gemModel) , m_downloadController(downloadController) @@ -252,8 +252,8 @@ namespace O3DE::ProjectManager update(0); // update the list to remove the gem that has finished }; // connect to download controller data changed - connect(m_downloadController, &O3DEObjectDownloadController::GemDownloadProgress, this, update); - connect(m_downloadController, &O3DEObjectDownloadController::Done, this, downloadEnded); + connect(m_downloadController, &DownloadController::GemDownloadProgress, this, update); + connect(m_downloadController, &DownloadController::Done, this, downloadEnded); update(0); } @@ -268,7 +268,7 @@ namespace O3DE::ProjectManager return gemNames; } - CartButton::CartButton(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent) + CartButton::CartButton(GemModel* gemModel, DownloadController* downloadController, QWidget* parent) : QWidget(parent) , m_gemModel(gemModel) , m_downloadController(downloadController) @@ -374,7 +374,7 @@ namespace O3DE::ProjectManager } } - GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, O3DEObjectDownloadController* downloadController, QWidget* parent) + GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, DownloadController* downloadController, QWidget* parent) : QFrame(parent) { QHBoxLayout* hLayout = new QHBoxLayout(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h index 3d977e2b15..8e0eaa13ba 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #endif namespace O3DE::ProjectManager @@ -32,7 +32,7 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - CartOverlayWidget(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); + CartOverlayWidget(GemModel* gemModel, DownloadController* downloadController, QWidget* parent = nullptr); private: QStringList ConvertFromModelIndices(const QVector& gems) const; @@ -43,7 +43,7 @@ namespace O3DE::ProjectManager QVBoxLayout* m_layout = nullptr; GemModel* m_gemModel = nullptr; - O3DEObjectDownloadController* m_downloadController = nullptr; + DownloadController* m_downloadController = nullptr; inline constexpr static int s_width = 240; }; @@ -54,7 +54,7 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - CartButton(GemModel* gemModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); + CartButton(GemModel* gemModel, DownloadController* downloadController, QWidget* parent = nullptr); ~CartButton(); void ShowOverlay(); @@ -67,7 +67,7 @@ namespace O3DE::ProjectManager QLabel* m_countLabel = nullptr; QPushButton* m_dropDownButton = nullptr; CartOverlayWidget* m_cartOverlay = nullptr; - O3DEObjectDownloadController* m_downloadController = nullptr; + DownloadController* m_downloadController = nullptr; inline constexpr static int s_iconSize = 24; inline constexpr static int s_arrowDownIconSize = 8; @@ -79,7 +79,7 @@ namespace O3DE::ProjectManager Q_OBJECT // AUTOMOC public: - explicit GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, O3DEObjectDownloadController* downloadController, QWidget* parent = nullptr); + explicit GemCatalogHeaderWidget(GemModel* gemModel, GemSortFilterProxyModel* filterProxyModel, DownloadController* downloadController, QWidget* parent = nullptr); ~GemCatalogHeaderWidget() = default; void ReinitForProject(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp index 5a4462d14b..08df6f255f 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ namespace O3DE::ProjectManager vLayout->setSpacing(0); setLayout(vLayout); - m_downloadController = new O3DEObjectDownloadController(); + m_downloadController = new DownloadController(); m_downloadController->Start(); m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxModel, m_downloadController); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h index ad603138f0..361e34b214 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.h @@ -39,7 +39,7 @@ namespace O3DE::ProjectManager EnableDisableGemsResult EnableDisableGemsForProject(const QString& projectPath); GemModel* GetGemModel() const { return m_gemModel; } - O3DEObjectDownloadController* GetDownloadController() const { return m_downloadController; } + DownloadController* GetDownloadController() const { return m_downloadController; } private: void FillModel(const QString& projectPath); @@ -51,6 +51,6 @@ namespace O3DE::ProjectManager GemSortFilterProxyModel* m_proxModel = nullptr; QVBoxLayout* m_filterWidgetLayout = nullptr; GemFilterWidget* m_filterWidget = nullptr; - O3DEObjectDownloadController* m_downloadController = nullptr; + DownloadController* m_downloadController = nullptr; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp index 40f114b82b..fd2ebf340f 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp @@ -38,7 +38,7 @@ namespace O3DE::ProjectManager vLayout->addWidget(m_header); m_updateSettingsScreen = new UpdateProjectSettingsScreen(); - m_gemCatalogScreen = new GemCatalogScreen(nullptr); + m_gemCatalogScreen = new GemCatalogScreen(); m_stack = new QStackedWidget(this); m_stack->setObjectName("body"); diff --git a/Code/Tools/ProjectManager/project_manager_files.cmake b/Code/Tools/ProjectManager/project_manager_files.cmake index d53cf6c8c1..e2e35717f6 100644 --- a/Code/Tools/ProjectManager/project_manager_files.cmake +++ b/Code/Tools/ProjectManager/project_manager_files.cmake @@ -29,10 +29,10 @@ set(FILES Source/FormImageBrowseEditWidget.cpp Source/GemsSubWidget.h Source/GemsSubWidget.cpp - Source/O3DEObjectDownloadController.h - Source/O3DEObjectDownloadController.cpp - Source/O3DEObjectDownloadWorker.h - Source/O3DEObjectDownloadWorker.cpp + Source/DownloadController.h + Source/DownloadController.cpp + Source/DownloadWorker.h + Source/DownloadWorker.cpp Source/PathValidator.h Source/PathValidator.cpp Source/ProjectManagerWindow.h From 2809c3b7ed6f2b4968cb3bea692d1277377d8b3a Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Thu, 21 Oct 2021 09:35:03 -0700 Subject: [PATCH 4/6] Removing unused variables and defines and some renaming Signed-off-by: AMZN-Phil --- Code/Tools/ProjectManager/Source/DownloadController.cpp | 3 --- Code/Tools/ProjectManager/Source/DownloadController.h | 9 ++++++++- Code/Tools/ProjectManager/Source/DownloadWorker.cpp | 4 ---- Code/Tools/ProjectManager/Source/DownloadWorker.h | 5 ----- .../Source/GemCatalog/GemCatalogHeaderWidget.cpp | 8 ++++---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/DownloadController.cpp b/Code/Tools/ProjectManager/Source/DownloadController.cpp index e06763ed4d..4942f4efb0 100644 --- a/Code/Tools/ProjectManager/Source/DownloadController.cpp +++ b/Code/Tools/ProjectManager/Source/DownloadController.cpp @@ -8,11 +8,8 @@ #include #include -#include #include -#include -#include namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/DownloadController.h b/Code/Tools/ProjectManager/Source/DownloadController.h index a769533c72..2a377f1ce8 100644 --- a/Code/Tools/ProjectManager/Source/DownloadController.h +++ b/Code/Tools/ProjectManager/Source/DownloadController.h @@ -41,7 +41,14 @@ namespace O3DE::ProjectManager const QString& GetCurrentDownloadingGem() const { - return m_gemNames[0]; + if (!m_gemNames.empty()) + { + return m_gemNames[0]; + } + else + { + return QString(); + } } public slots: void Start(); diff --git a/Code/Tools/ProjectManager/Source/DownloadWorker.cpp b/Code/Tools/ProjectManager/Source/DownloadWorker.cpp index 954eae432e..9bda1b34cc 100644 --- a/Code/Tools/ProjectManager/Source/DownloadWorker.cpp +++ b/Code/Tools/ProjectManager/Source/DownloadWorker.cpp @@ -10,10 +10,6 @@ #include #include -#include -#include -#include - namespace O3DE::ProjectManager { diff --git a/Code/Tools/ProjectManager/Source/DownloadWorker.h b/Code/Tools/ProjectManager/Source/DownloadWorker.h index 1bd51bca66..316a730a78 100644 --- a/Code/Tools/ProjectManager/Source/DownloadWorker.h +++ b/Code/Tools/ProjectManager/Source/DownloadWorker.h @@ -17,8 +17,6 @@ namespace O3DE::ProjectManager { class DownloadWorker : public QObject { - // QProcess::waitForFinished uses -1 to indicate that the process should not timeout - static constexpr int MaxBuildTimeMSecs = -1; // Download was cancelled inline static const QString DownloadCancelled = QObject::tr("Download Cancelled."); @@ -38,9 +36,6 @@ namespace O3DE::ProjectManager private: - QProcess* m_configProjectProcess = nullptr; - QProcess* m_buildProjectProcess = nullptr; - QString m_gemName; int m_downloadProgress; }; diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp index 9396234a68..79ff7624b7 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp @@ -164,11 +164,11 @@ namespace O3DE::ProjectManager layout->setAlignment(Qt::AlignTop); widget->setLayout(layout); - QLabel* label = new QLabel(); - label->setObjectName("GemCatalogCartOverlaySectionLabel"); - layout->addWidget(label); + QLabel* titleLabel = new QLabel(); + titleLabel->setObjectName("GemCatalogCartOverlaySectionLabel"); + layout->addWidget(titleLabel); - label->setText(tr("Gems to be installed")); + titleLabel->setText(tr("Gems to be installed")); // Create header section QWidget* downloadingGemsWidget = new QWidget(); From a032c59eab5acfb081ef13471d063f3206978299 Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Thu, 21 Oct 2021 09:39:15 -0700 Subject: [PATCH 5/6] Removing unused function Signed-off-by: AMZN-Phil --- Code/Tools/ProjectManager/Source/DownloadController.cpp | 5 ----- Code/Tools/ProjectManager/Source/DownloadController.h | 1 - .../ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp | 1 - 3 files changed, 7 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/DownloadController.cpp b/Code/Tools/ProjectManager/Source/DownloadController.cpp index 4942f4efb0..fa3fdb10d1 100644 --- a/Code/Tools/ProjectManager/Source/DownloadController.cpp +++ b/Code/Tools/ProjectManager/Source/DownloadController.cpp @@ -46,11 +46,6 @@ namespace O3DE::ProjectManager } } - void DownloadController::Start() - { - - } - void DownloadController::UpdateUIProgress(int progress) { m_lastProgress = progress; diff --git a/Code/Tools/ProjectManager/Source/DownloadController.h b/Code/Tools/ProjectManager/Source/DownloadController.h index 2a377f1ce8..385ceb4772 100644 --- a/Code/Tools/ProjectManager/Source/DownloadController.h +++ b/Code/Tools/ProjectManager/Source/DownloadController.h @@ -51,7 +51,6 @@ namespace O3DE::ProjectManager } } public slots: - void Start(); void UpdateUIProgress(int progress); void HandleResults(const QString& result); void HandleCancel(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp index 08df6f255f..58f3b48c81 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp @@ -34,7 +34,6 @@ namespace O3DE::ProjectManager setLayout(vLayout); m_downloadController = new DownloadController(); - m_downloadController->Start(); m_headerWidget = new GemCatalogHeaderWidget(m_gemModel, m_proxModel, m_downloadController); vLayout->addWidget(m_headerWidget); From 24d7a90e5f4499250f334e2f7adf07d9091619c4 Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Thu, 21 Oct 2021 13:01:46 -0700 Subject: [PATCH 6/6] Fix a warning Signed-off-by: AMZN-Phil --- Code/Tools/ProjectManager/Source/DownloadController.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/Tools/ProjectManager/Source/DownloadController.h b/Code/Tools/ProjectManager/Source/DownloadController.h index 385ceb4772..608d9b1a2b 100644 --- a/Code/Tools/ProjectManager/Source/DownloadController.h +++ b/Code/Tools/ProjectManager/Source/DownloadController.h @@ -47,7 +47,8 @@ namespace O3DE::ProjectManager } else { - return QString(); + static const QString emptyString; + return emptyString; } } public slots: