ReconcileOperationColumn.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #include "ReconcileOperationColumn.h"
  16. #include "AkAudioStyle.h"
  17. #include "Widgets/SWidget.h"
  18. #include "WaapiPicker/WwiseTreeItem.h"
  19. #include "Widgets/Text/STextBlock.h"
  20. #include "Wwise/WwiseReconcile.h"
  21. #define LOCTEXT_NAMESPACE "AkAudio"
  22. FText FReconcileOperationColumn::GetOperationText(FWwiseReconcileItem TreeItem)
  23. {
  24. if (EnumHasAllFlags(TreeItem.OperationRequired,
  25. EWwiseReconcileOperationFlags::UpdateExisting | EWwiseReconcileOperationFlags::RenameExisting))
  26. {
  27. return LOCTEXT("WwiseReconcileUpdateRename", "Update and Rename");
  28. }
  29. switch (TreeItem.OperationRequired)
  30. {
  31. case EWwiseReconcileOperationFlags::Create:
  32. return LOCTEXT("WwiseReconcileCreate", "Create");
  33. case EWwiseReconcileOperationFlags::UpdateExisting:
  34. return LOCTEXT("WwiseReconcileUpdate", "Update");
  35. case EWwiseReconcileOperationFlags::RenameExisting:
  36. return LOCTEXT("WwiseReconcileRename", "Rename");
  37. case EWwiseReconcileOperationFlags::Delete:
  38. return LOCTEXT("WwiseReconcileDelete", "Delete");
  39. }
  40. return LOCTEXT("WwiseReconcileEmpty", "");
  41. }
  42. FName FReconcileOperationColumn::GetColumnId()
  43. {
  44. return FName("ReconcileOperations");
  45. }
  46. const TSharedRef<SWidget> FReconcileOperationColumn::ConstructRowWidget(FWwiseReconcileItem TreeItem,
  47. const STableRow<TSharedPtr<FWwiseReconcileItem>>& Row)
  48. {
  49. return SNew(SHorizontalBox)
  50. + SHorizontalBox::Slot()
  51. .AutoWidth()
  52. .VAlign(VAlign_Center)
  53. [
  54. SNew(STextBlock)
  55. .Text(GetOperationText(TreeItem))
  56. ];
  57. }
  58. SHeaderRow::FColumn::FArguments FReconcileOperationColumn::ConstructHeaderRowColumn()
  59. {
  60. auto NameColumnHeader = SHeaderRow::Column(GetColumnId());
  61. NameColumnHeader.ColumnId(TEXT("WwiseItem"));
  62. NameColumnHeader.FixedWidth(125.f);
  63. TAttribute<FText> Label;
  64. Label.Set(FText::FromString("UAsset Operation"));
  65. NameColumnHeader.DefaultLabel(Label);
  66. NameColumnHeader.DefaultTooltip(LOCTEXT("WwiseReconcileOperationColumn_Tooltip", "The operation that will happen on the asset upon Reconciling."));
  67. return NameColumnHeader;
  68. }