AkMigrationWidgets.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. #pragma once
  16. #include "AkAssetMigrationHelper.h"
  17. #include "Application/SlateWindowHelper.h"
  18. #include "CoreMinimal.h"
  19. #include "Input/Reply.h"
  20. #include "Styling/SlateTypes.h"
  21. #include "Widgets/DeclarativeSyntaxSupport.h"
  22. #include "Widgets/SCompoundWidget.h"
  23. #include "Widgets/SCompoundWidget.h"
  24. #include "Widgets/SWidget.h"
  25. #include "Widgets/Input/SCheckBox.h"
  26. #include "Widgets/Input/SDirectoryPicker.h"
  27. #include "Widgets/Input/SComboBox.h"
  28. #include "Widgets/Input/SFilePathPicker.h"
  29. #include "Widgets/Layout/SExpandableArea.h"
  30. class SEditableTextBox;
  31. /**
  32. * A File path box (that actually lets you create a new file).
  33. */
  34. class SDefinitionFilePicker : public SCompoundWidget
  35. {
  36. public:
  37. DECLARE_DELEGATE_OneParam(FOnFileChanged, const FString& /*Directory*/);
  38. SLATE_BEGIN_ARGS(SDefinitionFilePicker)
  39. : _IsEnabled(true) {}
  40. SLATE_ARGUMENT(FString, FilePath)
  41. SLATE_ARGUMENT(FText, Message)
  42. SLATE_ATTRIBUTE(bool, IsEnabled)
  43. /** Called when a path has been picked or modified. */
  44. SLATE_EVENT(FOnFileChanged, OnFileChanged)
  45. SLATE_END_ARGS()
  46. public:
  47. void Construct(const FArguments& InArgs);
  48. FString GetFilePath() const;
  49. /**
  50. * Declares a delegate that is executed when a file was picked in the SFilePicker widget.
  51. *
  52. * The first parameter will contain the path to the picked file.
  53. */
  54. DECLARE_DELEGATE_OneParam(FOnFilePicked, const FString& /*PickedPath*/);
  55. private:
  56. void OnFileTextChanged(const FText& InFilePath);
  57. void OnFileTextCommitted(const FText& InText, ETextCommit::Type InCommitType);
  58. FText GetFilePathText() const;
  59. bool OpenDefinitionFilePicker(FString& OutDirectory, const FString& DefaultPath);
  60. FReply BrowseForFile();
  61. private:
  62. FString FilePath;
  63. FText Message;
  64. /** Holds a delegate that is executed when a file was picked. */
  65. FOnFileChanged OnFileChanged;
  66. TSharedPtr<SEditableTextBox> EditableTextBox;
  67. };
  68. class SBankTransferWidget : public SCompoundWidget
  69. {
  70. public:
  71. SLATE_BEGIN_ARGS(SBankTransferWidget) {}
  72. SLATE_END_ARGS()
  73. TSharedPtr<SCheckBox> SoundBankTransferCheckBox;
  74. TSharedPtr<SCheckBox> TransferAutoLoadCheckBox;
  75. TSharedPtr<SCheckBox> DeleteSoundBanksCheckBox;
  76. TSharedPtr<SDefinitionFilePicker> SoundBankDefinitionFilePathPicker;
  77. AkAssetMigration::EBankTransferMode BankTransferMethod = AkAssetMigration::EBankTransferMode::NoTransfer;
  78. FString SoundBankDefinitionFilePath = TEXT("");
  79. void Construct(const FArguments& InArgs);
  80. void SetDefinitionFilePath(const FString& PickedPath);
  81. void SetTransferMethod(AkAssetMigration::EBankTransferMode TransferMethod);
  82. void OnCheckedTransferBanks(ECheckBoxState NewState);
  83. bool GetDefinitionFilePath(FString& OutFilePath) const ;
  84. bool CheckWaapiConnection() const;
  85. EVisibility GetDefinitionFilePathVisibility() const;
  86. EVisibility GetTransferMethodVisibility() const;
  87. TSharedRef<SWidget> OnGetTransferMethodMenu();
  88. FText GetTransferMethodText() const;
  89. FLinearColor GetDropDownColour() const;
  90. FSlateColor GetDropDownBorderColour() const;
  91. private :
  92. TSharedPtr<SExpandableArea> ExpandableSection;
  93. TSharedPtr<SExpandableArea> ExpandableDetails;
  94. };
  95. class SDeprecatedAssetCleanupWidget : public SCompoundWidget
  96. {
  97. public:
  98. SLATE_BEGIN_ARGS(SDeprecatedAssetCleanupWidget) {}
  99. SLATE_ARGUMENT(int, NumDeprecatedAssets)
  100. SLATE_END_ARGS()
  101. TSharedPtr<SCheckBox> DeleteAssetsCheckBox;
  102. void Construct(const FArguments& InArgs);
  103. private:
  104. TSharedPtr<SExpandableArea> ExpandableSection;
  105. TSharedPtr<SExpandableArea> ExpandableDetails;
  106. };
  107. class SAssetMigrationWidget : public SCompoundWidget
  108. {
  109. public:
  110. SLATE_BEGIN_ARGS(SAssetMigrationWidget) {}
  111. SLATE_END_ARGS()
  112. TSharedPtr<SCheckBox> MigrateAssetsCheckBox;
  113. void Construct(const FArguments& InArgs);
  114. private :
  115. TSharedPtr<SExpandableArea> ExpandableSection;
  116. TSharedPtr<SExpandableArea> ExpandableDetails;
  117. };
  118. class SProjectMigrationWidget : public SCompoundWidget
  119. {
  120. public:
  121. SLATE_BEGIN_ARGS(SProjectMigrationWidget) {}
  122. SLATE_END_ARGS()
  123. TSharedPtr<SCheckBox> AutoMigrateCheckbox;
  124. TSharedPtr<SDirectoryPicker> GeneratedSoundBanksFolderPickerWidget;
  125. void Construct(const FArguments& InArgs);
  126. EVisibility GetPathVisibility() const;
  127. private :
  128. TSharedPtr<SExpandableArea> ExpandableSection;
  129. TSharedPtr<SExpandableArea> ExpandableDetails;
  130. };
  131. class SMigrationWidget : public SCompoundWidget
  132. {
  133. public:
  134. SLATE_BEGIN_ARGS(SMigrationWidget) {}
  135. SLATE_ARGUMENT(TSharedPtr<SWindow>, Dialog)
  136. SLATE_ARGUMENT(bool, ShowBankTransfer)
  137. SLATE_ARGUMENT(bool, ShowDeprecatedAssetCleanup)
  138. SLATE_ARGUMENT(bool, ShowAssetMigration)
  139. SLATE_ARGUMENT(bool, ShowProjectMigration)
  140. SLATE_ARGUMENT(int, NumDeprecatedAssets)
  141. SLATE_END_ARGS()
  142. TSharedPtr<SWindow> Dialog;
  143. TSharedPtr<SBankTransferWidget> BankTransferWidget;
  144. TSharedPtr<SDeprecatedAssetCleanupWidget> DeprecatedAssetCleanupWidget;
  145. TSharedPtr<SAssetMigrationWidget> AssetMigrationWidget;
  146. TSharedPtr<SProjectMigrationWidget> ProjectMigrationWidget;
  147. void Construct(const FArguments& InArgs);
  148. FReply OnContinueClicked();
  149. FReply OnCancelClicked();
  150. EVisibility GetBankTransferWidgetVisibility() const;
  151. EVisibility GetMediaCleanupWidgetVisibility() const;
  152. EVisibility GetAssetMigrationWidgetVisibility() const;
  153. EVisibility GetProjectMigrationWidgetVisibility() const;
  154. bool CanClickContinue() const;
  155. FText GetContinueToolTip() const;
  156. bool bCancel = false;
  157. private:
  158. bool bShowBankTransfer;
  159. bool bShowMediaCleanup;
  160. bool bShowAssetMigration;
  161. bool bShowProjectMigration;
  162. };
  163. class SBankMigrationFailureWidget : public SCompoundWidget
  164. {
  165. public:
  166. SLATE_BEGIN_ARGS(SBankMigrationFailureWidget) {}
  167. SLATE_ARGUMENT(TSharedPtr<SWindow>, Dialog)
  168. SLATE_ARGUMENT(FText, ErrorMessage);
  169. SLATE_END_ARGS()
  170. TSharedPtr<SWindow> Dialog;
  171. void Construct(const FArguments& InArgs);
  172. FReply OnCancelClicked();
  173. FReply OnIgnoreClicked();
  174. bool bCancel = false;
  175. };