CreateAGemScreen.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 <ScreenWidget.h>
  11. #include <GemCatalog/GemInfo.h>
  12. #include <PythonBindings.h>
  13. #endif
  14. QT_FORWARD_DECLARE_CLASS(QButtonGroup)
  15. QT_FORWARD_DECLARE_CLASS(QPushButton)
  16. QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
  17. QT_FORWARD_DECLARE_CLASS(QRadioButton)
  18. QT_FORWARD_DECLARE_CLASS(QScrollArea)
  19. QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
  20. QT_FORWARD_DECLARE_CLASS(QStackedWidget)
  21. QT_FORWARD_DECLARE_CLASS(QDir)
  22. namespace O3DE::ProjectManager
  23. {
  24. class FormFolderBrowseEditWidget;
  25. class FormLineEditWidget;
  26. class FormLineEditTagsWidget;
  27. class FormOptionsWidget;
  28. class FormComboBoxWidget;
  29. class ScreenHeader;
  30. class CreateGem : public ScreenWidget
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit CreateGem(QWidget* parent = nullptr);
  35. ~CreateGem() = default;
  36. ProjectManagerScreen GetScreenEnum() override
  37. {
  38. return ProjectManagerScreen::CreateGem;
  39. }
  40. void Init() override;
  41. signals:
  42. void GemCreated(const GemInfo& gemInfo);
  43. protected slots:
  44. void HandleBackButton();
  45. void HandleNextButton();
  46. void HandleGemDetailsTab();
  47. private slots:
  48. void HandleGemTemplateSelectionTab();
  49. void HandleGemCreatorDetailsTab();
  50. protected:
  51. void ClearFields();
  52. virtual void GemAction();
  53. virtual bool ValidateGemLocation(const QDir& chosenGemLocation) const;
  54. //Gem Setup
  55. QVector<TemplateInfo> m_gemTemplates;
  56. QButtonGroup* m_radioButtonGroup = nullptr;
  57. QRadioButton* m_formFolderRadioButton = nullptr;
  58. FormFolderBrowseEditWidget* m_gemTemplateLocation = nullptr;
  59. ScreenHeader* m_header = nullptr;
  60. //Gem Details
  61. FormLineEditWidget* m_gemDisplayName = nullptr;
  62. FormLineEditWidget* m_gemName = nullptr;
  63. FormLineEditWidget* m_gemSummary = nullptr;
  64. FormOptionsWidget* m_platformOptions = nullptr;
  65. FormLineEditWidget* m_requirements = nullptr;
  66. FormLineEditWidget* m_license = nullptr;
  67. FormLineEditWidget* m_licenseURL = nullptr;
  68. FormLineEditTagsWidget* m_userDefinedGemTags = nullptr;
  69. FormFolderBrowseEditWidget* m_gemLocation = nullptr;
  70. FormLineEditWidget* m_gemIconPath = nullptr;
  71. FormLineEditWidget* m_documentationURL = nullptr;
  72. //Gem Creator
  73. FormLineEditWidget* m_origin = nullptr;
  74. FormLineEditWidget* m_originURL = nullptr;
  75. FormLineEditWidget* m_repositoryURL = nullptr;
  76. QStackedWidget* m_stackWidget = nullptr;
  77. QDialogButtonBox* m_backNextButtons = nullptr;
  78. QPushButton* m_backButton = nullptr;
  79. QPushButton* m_nextButton = nullptr;
  80. QRadioButton* m_gemTemplateSelectionTab = nullptr;
  81. QRadioButton* m_gemDetailsTab = nullptr;
  82. QRadioButton* m_gemCreatorDetailsTab = nullptr;
  83. GemInfo m_gemInfo;
  84. static constexpr int GemTemplateSelectionScreen = 0;
  85. static constexpr int GemDetailsScreen = 1;
  86. static constexpr int GemCreatorDetailsScreen = 2;
  87. static inline constexpr int s_platformOptionItemSpacing = 24;
  88. int m_indexBackLimit = 0;
  89. QString m_gemActionString;
  90. GemInfo::Platforms m_platformSupportMask = GemInfo::Platform::Windows | GemInfo::Platform::Linux |
  91. GemInfo::Platform::iOS | GemInfo::Platform::Android;
  92. private:
  93. void LoadButtonsFromGemTemplatePaths(QVBoxLayout* gemSetupLayout);
  94. QScrollArea* CreateGemSetupScrollArea();
  95. QScrollArea* CreateGemDetailsScrollArea();
  96. QScrollArea* CreateGemCreatorScrollArea();
  97. QFrame* CreateTabButtonsFrame();
  98. QFrame* CreateTabPaneFrame();
  99. void SetupCreateWorkflow();
  100. void ProceedToGemDetailsPage();
  101. void ProceedToGemCreatorDetailsPage();
  102. void ProceedToGemAction();
  103. bool ValidateGemTemplateLocation();
  104. bool ValidateGemDisplayName();
  105. bool ValidateGemName();
  106. bool ValidateGemPath();
  107. bool ValidateFormNotEmpty(FormLineEditWidget* form);
  108. bool ValidateRepositoryURL();
  109. };
  110. } // namespace O3DE::ProjectManager