ProjectExportController.h 1.5 KB

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