ProjectExportWorker.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <AzCore/Outcome/Outcome.h>
  12. #include <QObject>
  13. #include <QProcessEnvironment>
  14. #endif
  15. QT_FORWARD_DECLARE_CLASS(QProcess)
  16. namespace O3DE::ProjectManager
  17. {
  18. class ProjectExportWorker : public QObject
  19. {
  20. // QProcess::waitForFinished uses -1 to indicate that the process should not timeout
  21. static constexpr int MaxExportTimeMSecs = -1;
  22. Q_OBJECT
  23. public:
  24. explicit ProjectExportWorker(const ProjectInfo& projectInfo);
  25. ~ProjectExportWorker() = default;
  26. AZ::Outcome<QString, QString> GetLogFilePath() const;
  27. AZ::Outcome<QString, QString> GetExpectedOutputPath() const;
  28. public slots:
  29. void ExportProject();
  30. signals:
  31. void UpdateProgress(QString lastLine);
  32. void Done(QString result = "");
  33. private:
  34. AZ::Outcome<void, QString> ExportProjectForPlatform();
  35. void QStringToAZTracePrint(const QString& error);
  36. AZ::Outcome<QStringList, QString> ConstructKillProcessCommandArguments(const QString& pidToKill) const;
  37. QString GetO3DECLIString() const;
  38. QProcess* m_exportProjectProcess = nullptr;
  39. const ProjectInfo& m_projectInfo;
  40. QString exportScript;
  41. QString m_expectedOutputDir;
  42. };
  43. } // namespace O3DE::ProjectManager