ProjectBuilderController.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. QT_FORWARD_DECLARE_CLASS(QProcess)
  14. namespace O3DE::ProjectManager
  15. {
  16. QT_FORWARD_DECLARE_CLASS(ProjectButton)
  17. QT_FORWARD_DECLARE_CLASS(ProjectBuilderWorker)
  18. class ProjectBuilderController : public QObject
  19. {
  20. Q_OBJECT
  21. public:
  22. explicit ProjectBuilderController(const ProjectInfo& projectInfo, ProjectButton* projectButton, QWidget* parent = nullptr);
  23. ~ProjectBuilderController();
  24. void SetProjectButton(ProjectButton* projectButton);
  25. const ProjectInfo& GetProjectInfo() const;
  26. inline constexpr static int s_maxDisplayedBuiltOutputChars = 25;
  27. public slots:
  28. void Start();
  29. void UpdateUIProgress(const QString& lastLine);
  30. void HandleResults(const QString& result);
  31. void HandleCancel();
  32. signals:
  33. void Done(bool success = true);
  34. void NotifyBuildProject(const ProjectInfo& projectInfo);
  35. private:
  36. ProjectInfo m_projectInfo;
  37. ProjectBuilderWorker* m_worker;
  38. QThread m_workerThread;
  39. ProjectButton* m_projectButton;
  40. QWidget* m_parent;
  41. QString m_lastLine;
  42. };
  43. } // namespace O3DE::ProjectManager