ProjectBuilderController.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <ProjectInfo.h>
  11. #include <QThread>
  12. #endif
  13. #include "ProjectManagerBuses.h"
  14. QT_FORWARD_DECLARE_CLASS(QProcess)
  15. namespace O3DE::ProjectManager
  16. {
  17. QT_FORWARD_DECLARE_CLASS(ProjectButton)
  18. QT_FORWARD_DECLARE_CLASS(ProjectBuilderWorker)
  19. class ProjectBuilderController
  20. : public QObject
  21. , public ProjectManagerUtilityRequestsBus::Handler
  22. {
  23. Q_OBJECT
  24. public:
  25. explicit ProjectBuilderController(const ProjectInfo& projectInfo, ProjectButton* projectButton, QWidget* parent = nullptr);
  26. ~ProjectBuilderController();
  27. void SetProjectButton(ProjectButton* projectButton);
  28. const ProjectInfo& GetProjectInfo() const;
  29. inline constexpr static int s_maxDisplayedBuiltOutputChars = 25;
  30. public slots:
  31. void Start();
  32. void UpdateUIProgress(const QString& lastLine);
  33. void HandleResults(const QString& result);
  34. void HandleCancel();
  35. signals:
  36. void Done(bool success = true);
  37. void NotifyBuildProject(const ProjectInfo& projectInfo);
  38. private:
  39. // ProjectManagerUtilityRequests overrides...
  40. void CanCloseProjectManager(bool& result) const override;
  41. private:
  42. ProjectInfo m_projectInfo;
  43. ProjectBuilderWorker* m_worker;
  44. QThread m_workerThread;
  45. ProjectButton* m_projectButton;
  46. QWidget* m_parent;
  47. QString m_lastLine;
  48. };
  49. } // namespace O3DE::ProjectManager