ProjectsScreen.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #pragma once
  13. #if !defined(Q_MOC_RUN)
  14. #include <ScreenWidget.h>
  15. #include <ProjectInfo.h>
  16. #include <QQueue>
  17. #endif
  18. QT_FORWARD_DECLARE_CLASS(QPaintEvent)
  19. QT_FORWARD_DECLARE_CLASS(QFrame)
  20. QT_FORWARD_DECLARE_CLASS(QStackedWidget)
  21. QT_FORWARD_DECLARE_CLASS(QLayout)
  22. namespace O3DE::ProjectManager
  23. {
  24. QT_FORWARD_DECLARE_CLASS(ProjectBuilderController);
  25. QT_FORWARD_DECLARE_CLASS(ProjectButton);
  26. class ProjectsScreen
  27. : public ScreenWidget
  28. {
  29. public:
  30. explicit ProjectsScreen(QWidget* parent = nullptr);
  31. ~ProjectsScreen();
  32. ProjectManagerScreen GetScreenEnum() override;
  33. QString GetTabText() override;
  34. bool IsTab() override;
  35. protected:
  36. void NotifyCurrentScreen() override;
  37. void ProjectBuildDone();
  38. protected slots:
  39. void HandleNewProjectButton();
  40. void HandleAddProjectButton();
  41. void HandleOpenProject(const QString& projectPath);
  42. void HandleEditProject(const QString& projectPath);
  43. void HandleCopyProject(const QString& projectPath);
  44. void HandleRemoveProject(const QString& projectPath);
  45. void HandleDeleteProject(const QString& projectPath);
  46. void SuggestBuildProject(const ProjectInfo& projectInfo);
  47. void QueueBuildProject(const ProjectInfo& projectInfo);
  48. void paintEvent(QPaintEvent* event) override;
  49. private:
  50. QFrame* CreateFirstTimeContent();
  51. QFrame* CreateProjectsContent(QString buildProjectPath = "", ProjectButton** projectButton = nullptr);
  52. ProjectButton* CreateProjectButton(ProjectInfo& project, QLayout* flowLayout, bool processing = false);
  53. void ResetProjectsContent();
  54. bool ShouldDisplayFirstTimeContent();
  55. void StartProjectBuild(const ProjectInfo& projectInfo);
  56. QList<ProjectInfo>::iterator RequiresBuildProjectIterator(const QString& projectPath);
  57. bool BuildQueueContainsProject(const QString& projectPath);
  58. bool WarnIfInBuildQueue(const QString& projectPath);
  59. QAction* m_createNewProjectAction = nullptr;
  60. QAction* m_addExistingProjectAction = nullptr;
  61. QPixmap m_background;
  62. QFrame* m_firstTimeContent = nullptr;
  63. QFrame* m_projectsContent = nullptr;
  64. QStackedWidget* m_stack = nullptr;
  65. QList<ProjectInfo> m_requiresBuild;
  66. QQueue<ProjectInfo> m_buildQueue;
  67. ProjectBuilderController* m_currentBuilder = nullptr;
  68. const QString m_projectPreviewImagePath = "/preview.png";
  69. inline constexpr static int s_contentMargins = 80;
  70. inline constexpr static int s_spacerSize = 20;
  71. };
  72. } // namespace O3DE::ProjectManager