AssetListTableModel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 <AzToolsFramework/Asset/AssetSeedManager.h>
  10. #include <AzFramework/Platform/PlatformDefaults.h>
  11. #include <QAbstractTableModel>
  12. namespace AssetBundler
  13. {
  14. class AssetListTableModel
  15. : public QAbstractTableModel
  16. {
  17. public:
  18. explicit AssetListTableModel(
  19. QObject* parent = nullptr,
  20. const AZStd::string& absolutePath = AZStd::string(),
  21. const AZStd::string& platform = "");
  22. virtual ~AssetListTableModel() {}
  23. AZStd::shared_ptr<AzToolsFramework::AssetSeedManager> GetSeedListManager() { return m_seedListManager; }
  24. //////////////////////////////////////////////////////////////////////////
  25. // QAbstractListModel overrides
  26. int rowCount(const QModelIndex& parent = QModelIndex()) const override;
  27. int columnCount(const QModelIndex& parent = QModelIndex()) const override;
  28. QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
  29. QVariant data(const QModelIndex& index, int role) const override;
  30. //////////////////////////////////////////////////////////////////////////
  31. enum Column
  32. {
  33. ColumnAssetName,
  34. ColumnRelativePath,
  35. ColumnAssetId,
  36. Max
  37. };
  38. private:
  39. AZ::Outcome<AZStd::reference_wrapper<const AzToolsFramework::AssetFileInfo>, AZStd::string> GetAssetFileInfo(const QModelIndex& index) const;
  40. AZStd::shared_ptr<AzToolsFramework::AssetSeedManager> m_seedListManager;
  41. AzToolsFramework::AssetFileInfoList m_assetFileInfoList;
  42. AzFramework::PlatformId m_platformId;
  43. };
  44. }