ManifestWidget.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #pragma once
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. #if !defined(Q_MOC_RUN)
  10. #include <QWidget>
  11. #include <QTabWidget>
  12. #include <AzCore/std/string/string.h>
  13. #include <AzCore/std/smart_ptr/shared_ptr.h>
  14. #include <AzCore/std/containers/unordered_map.h>
  15. #include <SceneAPI/SceneUI/SceneUIConfiguration.h>
  16. #endif
  17. namespace AZ
  18. {
  19. class SerializeContext;
  20. namespace SceneAPI
  21. {
  22. namespace Containers
  23. {
  24. class Scene;
  25. }
  26. namespace DataTypes
  27. {
  28. class IManifestObject;
  29. }
  30. namespace UI
  31. {
  32. // QT space
  33. namespace Ui
  34. {
  35. class ManifestWidget;
  36. }
  37. class ManifestWidgetPage;
  38. class SCENE_UI_API ManifestWidget : public QWidget
  39. {
  40. Q_OBJECT
  41. public:
  42. using PageList = AZStd::vector<ManifestWidgetPage*>;
  43. explicit ManifestWidget(SerializeContext* serializeContext, QWidget* parent = nullptr);
  44. ~ManifestWidget() override;
  45. void BuildFromScene(const AZStd::shared_ptr<Containers::Scene>& scene);
  46. bool AddObject(const AZStd::shared_ptr<DataTypes::IManifestObject>& object);
  47. bool RemoveObject(const AZStd::shared_ptr<DataTypes::IManifestObject>& object);
  48. AZStd::shared_ptr<Containers::Scene> GetScene();
  49. AZStd::shared_ptr<const Containers::Scene> GetScene() const;
  50. void ResetScene();
  51. void SetInspectButtonVisibility(bool enableInspector);
  52. //! Finds this ManifestWidget if the given widget is it's child, otherwise returns null.
  53. static ManifestWidget* FindRoot(QWidget* child);
  54. //! Finds this ManifestWidget if the given widget is it's child, otherwise returns null.
  55. static const ManifestWidget* FindRoot(const QWidget* child);
  56. signals:
  57. void SaveClicked();
  58. void OnInspect();
  59. void OnSceneResetRequested();
  60. void OnClearUnsavedChangesRequested();
  61. void OnAssignScript();
  62. void AppendUnsavedChangesToTitle(bool hasUnsavedChanges);
  63. void EnableInspector(bool enableInspector);
  64. protected:
  65. void BuildPages();
  66. void AddPage(const QString& category, ManifestWidgetPage* page);
  67. PageList m_pages;
  68. QScopedPointer<Ui::ManifestWidget> ui;
  69. AZStd::shared_ptr<Containers::Scene> m_scene;
  70. SerializeContext* m_serializeContext;
  71. };
  72. } // namespace UI
  73. } // namespace SceneAPI
  74. } // namespace AZ