2023-11-21 09:56:04 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-11-21 10:29:56 -05:00
|
|
|
#if SOURCE_CONTROL_WITH_SLATE
|
|
|
|
|
|
2023-11-21 09:56:04 -05:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "ISourceControlProvider.h"
|
|
|
|
|
#include "Delegates/IDelegateInstance.h"
|
|
|
|
|
#include "Framework/SlateDelegates.h"
|
|
|
|
|
#include "Styling/SlateTypes.h"
|
|
|
|
|
#include "Widgets/SCompoundWidget.h"
|
|
|
|
|
|
|
|
|
|
/** Widget for displaying Source Control Check in Changes and Sync Latest buttons */
|
|
|
|
|
class SOURCECONTROL_API SSourceControlControls : public SCompoundWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SLATE_BEGIN_ARGS(SSourceControlControls) {}
|
|
|
|
|
|
2023-11-30 03:37:36 -05:00
|
|
|
SLATE_ATTRIBUTE(bool, IsEnabledSyncLatest)
|
|
|
|
|
SLATE_ATTRIBUTE(bool, IsEnabledCheckInChanges)
|
2023-11-21 09:56:04 -05:00
|
|
|
SLATE_EVENT(FOnClicked, OnClickedSyncLatest)
|
|
|
|
|
SLATE_EVENT(FOnClicked, OnClickedCheckInChanges)
|
|
|
|
|
SLATE_EVENT(FOnGetContent, OnGenerateKebabMenu)
|
|
|
|
|
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/** Construct this widget */
|
|
|
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/** Sync button */
|
|
|
|
|
bool IsAtLatestRevision() const;
|
2023-11-30 03:37:36 -05:00
|
|
|
bool IsSourceControlSyncEnabled() const;
|
|
|
|
|
bool HasSourceControlChangesToSync() const;
|
2023-11-21 09:56:04 -05:00
|
|
|
EVisibility GetSourceControlSyncStatusVisibility() const;
|
|
|
|
|
FText GetSourceControlSyncStatusText() const;
|
|
|
|
|
FText GetSourceControlSyncStatusTooltipText() const;
|
|
|
|
|
const FSlateBrush* GetSourceControlSyncStatusIcon() const;
|
|
|
|
|
FReply OnSourceControlSyncClicked() const;
|
|
|
|
|
|
|
|
|
|
/** Check-in button */
|
|
|
|
|
int GetNumLocalChanges() const;
|
2023-11-30 03:37:36 -05:00
|
|
|
bool IsSourceControlCheckInEnabled() const;
|
|
|
|
|
bool HasSourceControlChangesToCheckIn() const;
|
2023-11-21 09:56:04 -05:00
|
|
|
EVisibility GetSourceControlCheckInStatusVisibility() const;
|
|
|
|
|
FText GetSourceControlCheckInStatusText() const;
|
|
|
|
|
FText GetSourceControlCheckInStatusTooltipText() const;
|
|
|
|
|
const FSlateBrush* GetSourceControlCheckInStatusIcon() const;
|
|
|
|
|
FReply OnSourceControlCheckInChangesClicked() const;
|
|
|
|
|
|
|
|
|
|
/** Conflicts */
|
|
|
|
|
void CheckSourceControlStatus();
|
|
|
|
|
bool AreConflictsRemaining() const;
|
|
|
|
|
|
|
|
|
|
void OnSourceControlProviderChanged(ISourceControlProvider& OldProvider, ISourceControlProvider& NewProvider);
|
|
|
|
|
void OnSourceControlStateChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
FOnClicked OnSyncLatestClicked;
|
|
|
|
|
FOnClicked OnCheckInChangesClicked;
|
|
|
|
|
|
2023-11-30 03:37:36 -05:00
|
|
|
TAttribute<bool> IsSyncLatestEnabled;
|
|
|
|
|
TAttribute<bool> IsCheckInChangesEnabled;
|
|
|
|
|
|
2023-11-21 09:56:04 -05:00
|
|
|
/** Is there a conflict remaining? */
|
|
|
|
|
bool bConflictsRemaining;
|
|
|
|
|
|
|
|
|
|
FDelegateHandle SourceControlProviderChangedHandle;
|
|
|
|
|
FDelegateHandle SourceControlStateChangedHandle;
|
2023-11-21 10:29:56 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // SOURCE_CONTROL_WITH_SLATE
|