From 9aa9ed8c8e160c06f6447ea568e49ca05c0374af Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Wed, 20 Oct 2021 14:55:08 -0700 Subject: [PATCH] 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