Files
UnrealEngine/Engine/Source/Editor/StorageServerWidgets/Internal/SBuildSelection.h
2025-05-18 13:04:45 +08:00

128 lines
4.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Experimental/BuildServerInterface.h"
#include "Experimental/ZenServerInterface.h"
#include "Templates/SharedPointer.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/Input/SComboBox.h"
#include "Widgets/Layout/SGridPanel.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/SCompoundWidget.h"
#include "Widgets/SWidget.h"
#include "Widgets/Views/ITableRow.h"
#include "Widgets/Views/SListView.h"
#include "Widgets/Views/STableRow.h"
#include "Widgets/Views/STableViewBase.h"
class SMultiSelectComboBox;
namespace UE::BuildSelection::Internal{ struct FListBuildsState; }
DECLARE_DELEGATE_ThreeParams(FOnBuildTransferStarted, UE::Zen::Build::FBuildServiceInstance::FBuildTransfer /*Transfer*/,
FStringView /*Name*/,
FStringView /*Platform*/);
class STORAGESERVERWIDGETS_API SBuildSelection : public SCompoundWidget
{
SLATE_BEGIN_ARGS(SBuildSelection)
: _ZenServiceInstance(nullptr)
, _BuildServiceInstance(nullptr)
{ }
SLATE_ATTRIBUTE(TSharedPtr<UE::Zen::FZenServiceInstance>, ZenServiceInstance);
SLATE_ATTRIBUTE(TSharedPtr<UE::Zen::Build::FBuildServiceInstance>, BuildServiceInstance);
SLATE_EVENT(FOnBuildTransferStarted, OnBuildTransferStarted)
SLATE_END_ARGS()
struct FBuildGroup : public TSharedFromThis<FBuildGroup, ESPMode::ThreadSafe>
{
FString Namespace;
FString DisplayName;
FString CommitIdentifier;
FString Suffix;
FDateTime CreatedAt;
FString Category;
TMap<FString, UE::Zen::Build::FBuildServiceInstance::FBuildRecord> PerPlatformBuilds;
};
void Construct(const FArguments& InArgs);
private:
enum class EBuildType
{
Oplog,
StagedBuild,
PackagedBuild,
EditorPreCompiledBinary,
EditorInstalledBuild,
Unknown
};
EBuildType GetSelectedBuildType() const;
void RebuildLists();
void ReselectDestination(TSharedPtr<FBuildGroup> Item);
void RegenerateBuildGroups(UE::BuildSelection::Internal::FListBuildsState& ListBuildsState);
void RegenerateActivePlatformFilters();
void ValidateBuildGroupSelection();
TSharedRef<SWidget> OnGenerateTextBlockFromString(TSharedPtr<FString> Item);
bool BuildGroupIsSelectableOrNavigable(TSharedPtr<FBuildGroup> InItem) const;
TSharedRef<ITableRow> GenerateBuildGroupRow(TSharedPtr<FBuildGroup> InItem, const TSharedRef<STableViewBase>& InOwningTable);
void OnOpenDestinationDirectoryClicked();
TSharedRef<SWidget> GetBuildDestinationPanel();
TSharedRef<SWidget> GetGridPanel();
void BuildGroupSelectionChanged(TSharedPtr<FBuildGroup> Item, ESelectInfo::Type SelectInfo);
TSharedPtr<SComboBox<TSharedPtr<FString>>> ProjectWidget;
TSharedPtr<SComboBox<TSharedPtr<FString>>> StreamWidget;
TSharedPtr<SComboBox<TSharedPtr<FString>>> BuildTypeWidget;
TSharedPtr<SMultiSelectComboBox> RequiredPlatformsWidget;
TSharedPtr<SGridPanel> SelectedGroupPlatformGrid;
TArray<FString> SelectedGroupSelectedPlatforms;
TMultiMap<FString, FString> BucketsToNamespaces;
TArray<TSharedPtr<FString>> ProjectList;
TArray<TSharedPtr<FString>> StreamList;
TArray<TSharedPtr<FString>> BuildTypeList;
TArray<TSharedPtr<FString>> PlatformList;
TArray<FString> ActivePlatformFilters;
FString DestinationFolderPath;
FString DestinationZenProjectId;
TSharedPtr<FString> SelectedStream;
TSharedPtr<FString> SelectedProject;
TSharedPtr<FString> SelectedBuildType;
TSharedPtr<SListView<TSharedPtr<SBuildSelection::FBuildGroup, ESPMode::ThreadSafe>>> BuildListView;
std::atomic<uint32> BuildListRefreshesInProgress = 0;
std::atomic<uint32> BuildRefreshGeneration = 0;
TArray<TSharedPtr<SBuildSelection::FBuildGroup, ESPMode::ThreadSafe>> BuildGroups;
SVerticalBox::FSlot* GridSlot = nullptr;
TAttribute<TSharedPtr<UE::Zen::FZenServiceInstance>> ZenServiceInstance;
TAttribute<TSharedPtr<UE::Zen::Build::FBuildServiceInstance>> BuildServiceInstance;
FOnBuildTransferStarted OnBuildTransferStarted;
};
typedef TSharedPtr<SBuildSelection::FBuildGroup, ESPMode::ThreadSafe> FBuildSelectionBuildGroupPtr;
class SBuildGroupTableRow : public SMultiColumnTableRow<FBuildSelectionBuildGroupPtr>
{
public:
SLATE_BEGIN_ARGS(SBuildGroupTableRow) { }
SLATE_END_ARGS()
void Construct(const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, const FBuildSelectionBuildGroupPtr InBuildGroup);
virtual TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) override;
const FSlateBrush* GetBorder() const;
FReply OnBrowseClicked();
private:
FBuildSelectionBuildGroupPtr BuildGroup;
};