SeedTabWidget.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 <source/ui/AssetBundlerTabWidget.h>
  11. #include <AzCore/Debug/TraceMessageBus.h>
  12. #include <AzCore/std/smart_ptr/unique_ptr.h>
  13. #include <AzFramework/Platform/PlatformDefaults.h>
  14. #include <QDir>
  15. #include <QItemSelectionModel>
  16. #include <QModelIndex>
  17. #include <QSharedPointer>
  18. #include <QString>
  19. #include <QWidget>
  20. #endif
  21. namespace Ui
  22. {
  23. class SeedTabWidget;
  24. }
  25. class QFileSystemModel;
  26. class QStringListModel;
  27. namespace AssetBundler
  28. {
  29. class GUIApplicationManager;
  30. class SeedListFileTableModel;
  31. class SeedListTableModel;
  32. class NewFileDialog;
  33. class EditSeedDialog;
  34. class AddSeedDialog;
  35. class SeedTabWidget
  36. : public AssetBundlerTabWidget
  37. , public AZ::Debug::TraceMessageBus::Handler
  38. {
  39. Q_OBJECT
  40. public:
  41. explicit SeedTabWidget(QWidget* parent, GUIApplicationManager* guiApplicationManager, const QString& assetBundlingDirectory);
  42. virtual ~SeedTabWidget();
  43. QString GetTabTitle() override { return tr("Seeds"); }
  44. QString GetFileTypeDisplayName() override { return tr("Seed List file"); }
  45. AssetBundlingFileType GetFileType() override { return AssetBundlingFileType::SeedListFileType; }
  46. bool HasUnsavedChanges() override;
  47. void Reload() override;
  48. bool SaveCurrentSelection() override;
  49. bool SaveAll() override;
  50. void SetModelDataSource() override;
  51. AzQtComponents::TableView* GetFileTableView() override;
  52. QModelIndex GetSelectedFileTableIndex() override;
  53. AssetBundlerAbstractFileTableModel* GetFileTableModel() override;
  54. void SetActiveProjectLabel(const QString& labelText) override;
  55. void ApplyConfig() override;
  56. void FileSelectionChanged(
  57. const QItemSelection& /*selected*/ = QItemSelection(),
  58. const QItemSelection& /*deselected*/ = QItemSelection()) override;
  59. void UncheckSelectDefaultSeedListsCheckBox();
  60. void SetGenerateAssetListsButtonEnabled(bool isEnabled);
  61. /////////////////////////////////////////////////////////
  62. // TraceMessageBus overrides
  63. bool OnPreError(const char* window, const char* fileName, int line, const char* func, const char* message) override;
  64. bool OnPreWarning(const char* window, const char* fileName, int line, const char* func, const char* message) override;
  65. /////////////////////////////////////////////////////////
  66. private:
  67. void OnNewFileButtonPressed();
  68. void OnSelectDefaultSeedListsCheckBoxChanged();
  69. void OnGenerateAssetListsButtonPressed();
  70. void OnEditSeedButtonPressed();
  71. void OnEditAllButtonPressed();
  72. void OnAddSeedButtonPressed();
  73. void OnRemoveSeedButtonPressed();
  74. void OnSeedListContentsTableContextMenuRequested(const QPoint& pos);
  75. QSharedPointer<Ui::SeedTabWidget> m_ui;
  76. QDir m_assetBundlingFolder;
  77. QSharedPointer<SeedListFileTableModel> m_fileTableModel;
  78. QModelIndex m_selectedFileTableIndex;
  79. QSharedPointer<NewFileDialog> m_generateAssetListsDialog;
  80. QSharedPointer<AssetBundler::AssetBundlerFileTableFilterModel> m_seedListContentsFilterModel;
  81. QSharedPointer<SeedListTableModel> m_seedListContentsModel;
  82. QSharedPointer<EditSeedDialog> m_editSeedDialog;
  83. QSharedPointer<AddSeedDialog> m_addSeedDialog;
  84. bool m_hasWarningsOrErrors = false;
  85. };
  86. } // namespace AssetBundler