ProductDependencyTreeItemData.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include <AzCore/Outcome/Outcome.h>
  10. #include <AzCore/RTTI/RTTI.h>
  11. #include <AzCore/std/containers/vector.h>
  12. #include <AzCore/std/smart_ptr/shared_ptr.h>
  13. #include <AzCore/std/smart_ptr/unique_ptr.h>
  14. #include <AzCore/std/string/string.h>
  15. #include <QString>
  16. #include <QVariant>
  17. namespace AZ
  18. {
  19. struct Uuid;
  20. }
  21. namespace AssetProcessor
  22. {
  23. class ProductDependencyTreeItemData
  24. {
  25. public:
  26. AZ_RTTI(ProductDependencyTreeItemData, "{A746FA16-7545-44FB-9454-0D64CBAA7A6E}");
  27. ProductDependencyTreeItemData(
  28. QString name, AZStd::string productName);
  29. virtual ~ProductDependencyTreeItemData()
  30. {
  31. }
  32. QString m_name;
  33. // Product name as it exists in the database,
  34. // used in the right click menu to jump to this content.
  35. AZStd::string m_productName;
  36. };
  37. enum class ProductDependencyTreeColumns
  38. {
  39. Name,
  40. Max
  41. };
  42. class ProductDependencyTreeItem
  43. {
  44. public:
  45. explicit ProductDependencyTreeItem(
  46. AZStd::shared_ptr<ProductDependencyTreeItemData> data, ProductDependencyTreeItem* parentItem = nullptr);
  47. virtual ~ProductDependencyTreeItem();
  48. ProductDependencyTreeItem* CreateChild(AZStd::shared_ptr<ProductDependencyTreeItemData> data);
  49. ProductDependencyTreeItem* GetChild(int row) const;
  50. void EraseChild(ProductDependencyTreeItem* child);
  51. int getChildCount() const;
  52. int GetRow() const;
  53. QVariant GetDataForColumn(int column) const;
  54. ProductDependencyTreeItem* GetParent() const;
  55. AZStd::shared_ptr<ProductDependencyTreeItemData> GetData() const
  56. {
  57. return m_data;
  58. }
  59. private:
  60. AZStd::vector<AZStd::unique_ptr<ProductDependencyTreeItem>> m_childItems;
  61. AZStd::shared_ptr<ProductDependencyTreeItemData> m_data;
  62. ProductDependencyTreeItem* m_parent = nullptr;
  63. };
  64. } // namespace AssetProcessor