ProjectExportController.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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(ProjectExportWorker)
  19. class ProjectExportController
  20. : public QObject
  21. , public ProjectManagerUtilityRequestsBus::Handler
  22. {
  23. Q_OBJECT
  24. public:
  25. explicit ProjectExportController(const ProjectInfo& projectInfo, ProjectButton* projectButton, QWidget* parent = nullptr);
  26. ~ProjectExportController();
  27. void SetProjectButton(ProjectButton* projectButton);
  28. const ProjectInfo& GetProjectInfo() const;
  29. constexpr static int s_maxDisplayedBuiltOutputChars = 25;
  30. inline static const char* LauncherExportFailedMessage = "Launcher failed to export.";
  31. public slots:
  32. void Start();
  33. void UpdateUIProgress(const QString& lastLine);
  34. void HandleResults(const QString& result);
  35. void HandleCancel();
  36. signals:
  37. void Done(bool success = true);
  38. void NotifyExportProject(const ProjectInfo& projectInfo);
  39. private:
  40. // ProjectManagerUtilityRequests overrides...
  41. void CanCloseProjectManager(bool& result) const override;
  42. private:
  43. ProjectInfo m_projectInfo;
  44. ProjectExportWorker* m_worker;
  45. QThread m_workerThread;
  46. ProjectButton* m_projectButton;
  47. QWidget* m_parent;
  48. QString m_lastLine;
  49. };
  50. } // namespace O3DE::ProjectManager