2020-05-20 12:48:17 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
2020-05-20 13:04:13 -04:00
# include "SourceControlMenuHelpers.h"
2020-05-20 12:48:17 -04:00
# include "SourceControlOperations.h"
# include "ISourceControlProvider.h"
# include "ISourceControlModule.h"
2021-01-11 15:31:58 -04:00
# include "ISourceControlWindowsModule.h"
2020-05-20 12:48:17 -04:00
# include "SourceControlWindows.h"
2022-10-03 20:38:09 -04:00
# include "UnsavedAssetsTrackerModule.h"
2020-05-20 12:48:17 -04:00
# include "FileHelpers.h"
2022-10-26 12:57:32 -04:00
# include "Logging/MessageLog.h"
2020-05-20 12:48:17 -04:00
# include "ToolMenuContext.h"
# include "ToolMenus.h"
2022-05-09 13:12:28 -04:00
# include "Styling/AppStyle.h"
2020-05-20 13:04:13 -04:00
# include "Widgets/Input/SComboButton.h"
2022-09-26 16:32:49 -04:00
# include "Widgets/Input/SButton.h"
2020-05-20 13:04:13 -04:00
# include "Widgets/Images/SImage.h"
2022-12-11 23:09:22 -05:00
# include "Widgets/Layout/SSeparator.h"
2022-12-09 14:18:01 -05:00
# include "Widgets/Images/SLayeredImage.h"
2022-09-26 16:32:49 -04:00
# include "PackageTools.h"
2023-11-30 03:37:36 -05:00
# include "Editor.h"
# include "EditorModeManager.h"
2022-09-26 16:32:49 -04:00
# include "Misc/ConfigCacheIni.h"
2022-10-26 15:30:49 -04:00
# include "Misc/MessageDialog.h"
2022-12-09 14:18:01 -05:00
# include "RevisionControlStyle/RevisionControlStyle.h"
2023-01-26 10:15:04 -05:00
# include "Bookmarks/BookmarkScoped.h"
2023-02-16 12:43:53 -05:00
# include "Styling/StyleColors.h"
2023-09-26 06:31:30 -04:00
# include "HAL/IConsoleManager.h"
2023-11-21 09:56:04 -05:00
# include "SSourceControlControls.h"
2020-05-20 12:48:17 -04:00
# define LOCTEXT_NAMESPACE "SourceControlCommands"
TSharedRef < FUICommandList > FSourceControlCommands : : ActionList ( new FUICommandList ( ) ) ;
FSourceControlCommands : : FSourceControlCommands ( )
: TCommands < FSourceControlCommands >
(
" SourceControl " ,
2022-11-23 11:57:50 -05:00
NSLOCTEXT ( " Contexts " , " SourceControl " , " Revision Control " ) ,
2020-05-20 12:48:17 -04:00
" LevelEditor " ,
2022-05-09 13:12:28 -04:00
FAppStyle : : GetAppStyleSetName ( )
2020-05-20 12:48:17 -04:00
)
{ }
/**
* Initialize commands
*/
void FSourceControlCommands : : RegisterCommands ( )
{
2022-11-23 11:57:50 -05:00
UI_COMMAND ( ConnectToSourceControl , " Connect to Revision Control... " , " Connect to a revision control system for tracking changes to your content and levels. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ChangeSourceControlSettings , " Change Revision Control Settings... " , " Opens a dialog to change revision control settings. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2023-02-01 19:44:37 -05:00
UI_COMMAND ( ViewChangelists , " View Changes " , " Opens a dialog displaying current changes. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2024-01-10 10:47:34 -05:00
UI_COMMAND ( ViewSnapshotHistory , " Open Snapshot History " , " See all the changes that have been made to this project over time. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2021-10-20 14:15:53 -04:00
UI_COMMAND ( SubmitContent , " Submit Content " , " Opens a dialog with check in options for content and levels. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( CheckOutModifiedFiles , " Check Out Modified Files " , " Opens a dialog to check out any assets which have been modified. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2022-12-11 23:09:22 -05:00
UI_COMMAND ( RevertAll , " Revert All Files " , " Opens a dialog to revert any assets which have been modified. " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2020-05-20 12:48:17 -04:00
ActionList - > MapAction (
ConnectToSourceControl ,
2021-01-11 15:31:58 -04:00
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : ConnectToSourceControl_Clicked )
2020-05-20 12:48:17 -04:00
) ;
ActionList - > MapAction (
ChangeSourceControlSettings ,
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : ConnectToSourceControl_Clicked )
) ;
2021-01-11 15:31:58 -04:00
ActionList - > MapAction (
ViewChangelists ,
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : ViewChangelists_Clicked ) ,
2022-09-26 16:32:49 -04:00
FCanExecuteAction : : CreateStatic ( & FSourceControlCommands : : ViewChangelists_CanExecute ) ,
FIsActionChecked : : CreateLambda ( [ ] ( ) { return false ; } ) ,
2023-11-30 07:58:07 -05:00
FIsActionButtonVisible : : CreateStatic ( & FSourceControlCommands : : ViewChangelists_IsVisible )
) ;
ActionList - > MapAction (
ViewSnapshotHistory ,
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : ViewSnapshotHistory_Clicked ) ,
FCanExecuteAction : : CreateStatic ( & FSourceControlCommands : : ViewSnapshotHistory_CanExecute ) ,
FIsActionChecked : : CreateLambda ( [ ] ( ) { return false ; } ) ,
FIsActionButtonVisible : : CreateStatic ( & FSourceControlCommands : : ViewSnapshotHistory_IsVisible )
2021-01-11 15:31:58 -04:00
) ;
2021-10-20 14:15:53 -04:00
ActionList - > MapAction (
SubmitContent ,
FExecuteAction : : CreateLambda ( [ ] ( ) { FSourceControlWindows : : ChoosePackagesToCheckIn ( ) ; } ) ,
2022-09-30 16:16:47 -04:00
FCanExecuteAction : : CreateStatic ( & FSourceControlWindows : : CanChoosePackagesToCheckIn ) ,
FIsActionChecked : : CreateLambda ( [ ] ( ) { return false ; } ) ,
FIsActionButtonVisible : : CreateStatic ( & FSourceControlCommands : : SubmitContent_IsVisible )
2021-10-20 14:15:53 -04:00
) ;
2020-05-20 12:48:17 -04:00
ActionList - > MapAction (
CheckOutModifiedFiles ,
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : CheckOutModifiedFiles_Clicked ) ,
FCanExecuteAction : : CreateStatic ( & FSourceControlCommands : : CheckOutModifiedFiles_CanExecute )
) ;
2022-12-11 23:09:22 -05:00
ActionList - > MapAction (
RevertAll ,
FExecuteAction : : CreateStatic ( & FSourceControlCommands : : RevertAllModifiedFiles_Clicked ) ,
2023-02-17 11:00:54 -05:00
FCanExecuteAction : : CreateStatic ( & FSourceControlCommands : : RevertAllModifiedFiles_CanExecute )
2022-12-11 23:09:22 -05:00
) ;
2020-05-20 12:48:17 -04:00
}
void FSourceControlCommands : : ConnectToSourceControl_Clicked ( )
{
// Show login window regardless of current status - its useful as a shortcut to change settings.
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
SourceControlModule . ShowLoginDialog ( FSourceControlLoginClosed ( ) , ELoginWindowMode : : Modeless , EOnLoginWindowStartup : : PreserveProvider ) ;
}
2021-01-11 15:31:58 -04:00
bool FSourceControlCommands : : ViewChangelists_CanExecute ( )
{
2021-03-17 13:43:31 -04:00
return ISourceControlWindowsModule : : Get ( ) . CanShowChangelistsTab ( ) ;
2021-01-11 15:31:58 -04:00
}
2022-09-26 16:32:49 -04:00
bool FSourceControlCommands : : ViewChangelists_IsVisible ( )
{
2023-06-15 07:08:48 -04:00
return ISourceControlModule : : Get ( ) . GetProvider ( ) . UsesChangelists ( ) | | ISourceControlModule : : Get ( ) . GetProvider ( ) . UsesUncontrolledChangelists ( ) ;
2022-09-26 16:32:49 -04:00
}
2023-11-30 07:58:07 -05:00
bool FSourceControlCommands : : ViewSnapshotHistory_CanExecute ( )
{
return ISourceControlWindowsModule : : Get ( ) . CanShowSnapshotHistoryTab ( ) ;
}
bool FSourceControlCommands : : ViewSnapshotHistory_IsVisible ( )
{
return ISourceControlModule : : Get ( ) . GetProvider ( ) . GetName ( ) = = TEXT ( " Unreal Revision Control " ) ;
}
2022-09-30 16:16:47 -04:00
bool FSourceControlCommands : : SubmitContent_IsVisible ( )
{
2024-02-26 03:57:11 -05:00
if ( SSourceControlControls : : GetSourceControlCheckInStatusVisibility ( ) = = EVisibility : : Visible )
2022-09-30 16:16:47 -04:00
{
return false ;
}
2022-10-15 02:16:54 -04:00
if ( ! FSourceControlWindows : : ShouldChoosePackagesToCheckBeVisible ( ) )
{
return false ;
}
2022-09-30 16:16:47 -04:00
return true ;
}
2021-01-11 15:31:58 -04:00
void FSourceControlCommands : : ViewChangelists_Clicked ( )
{
ISourceControlWindowsModule : : Get ( ) . ShowChangelistsTab ( ) ;
}
2023-11-30 07:58:07 -05:00
void FSourceControlCommands : : ViewSnapshotHistory_Clicked ( )
{
ISourceControlWindowsModule : : Get ( ) . ShowSnapshotHistoryTab ( ) ;
}
2020-05-20 12:48:17 -04:00
bool FSourceControlCommands : : CheckOutModifiedFiles_CanExecute ( )
{
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
if ( ISourceControlModule : : Get ( ) . IsEnabled ( ) & &
ISourceControlModule : : Get ( ) . GetProvider ( ) . IsAvailable ( ) )
{
TArray < UPackage * > PackagesToSave ;
FEditorFileUtils : : GetDirtyWorldPackages ( PackagesToSave ) ;
FEditorFileUtils : : GetDirtyContentPackages ( PackagesToSave ) ;
return PackagesToSave . Num ( ) > 0 ;
}
return false ;
}
void FSourceControlCommands : : CheckOutModifiedFiles_Clicked ( )
{
TArray < UPackage * > PackagesToSave ;
FEditorFileUtils : : GetDirtyWorldPackages ( PackagesToSave ) ;
FEditorFileUtils : : GetDirtyContentPackages ( PackagesToSave ) ;
2023-04-24 23:20:03 -04:00
FEditorFileUtils : : FPromptForCheckoutAndSaveParams SaveParams ;
SaveParams . bCheckDirty = true ;
SaveParams . bPromptToSave = false ;
SaveParams . bIsExplicitSave = true ;
FEditorFileUtils : : PromptForCheckoutAndSave ( PackagesToSave , SaveParams ) ;
2020-05-20 12:48:17 -04:00
}
2023-02-17 11:00:54 -05:00
bool FSourceControlCommands : : RevertAllModifiedFiles_CanExecute ( )
{
// If CHECK-IN CHANGES button is active, the REVERT ALL option should be active.
if ( FUnsavedAssetsTrackerModule : : Get ( ) . GetUnsavedAssetNum ( ) > 0 )
{
return true ;
}
if ( FSourceControlWindows : : CanChoosePackagesToCheckIn ( ) )
{
return true ;
}
return false ;
}
2022-12-11 23:09:22 -05:00
void FSourceControlCommands : : RevertAllModifiedFiles_Clicked ( )
{
FText Message = LOCTEXT ( " RevertAllModifiedFiles " , " Are you sure you want to revert all local changes? By proceeding, your local changes will be discarded, and the state of your last synced snapshot will be restored. " ) ;
FText Title = LOCTEXT ( " RevertAllModifiedFiles_Title " , " Revert all local changes " ) ;
2023-04-15 19:49:32 -04:00
if ( FMessageDialog : : Open ( EAppMsgType : : YesNo , EAppReturnType : : No , Message , Title ) = = EAppReturnType : : Yes )
2022-12-11 23:09:22 -05:00
{
SourceControl: The ChoosePackagesToCheckIn operation should optionally perform a sync ('pull-before-push' model) for snapshot based source control systems.
Skein, the only provider that returns 'true' for 'UsesSnapshots()' requires the user to be at head when doing a check-in operation, or the check-in will fail.
This is enforced within the plugin, not the CLI, by performing an FSync prior to doing an FCheckIn. It's not easy to do the sync within the CLI as part of the check-in as the editor doesn't release its file locks when doing an FCheckIn, causing syncs to fail.
For this, a code path was introduced in SourceControlMenuHelpers that triggers a sync before triggering the check-in, when clicking the 'Check In Changes' button visible in the bottom right of the editor within UEFN.
However, this approach fails if other code paths in the editor call ChoosePackagesToCheckIn directly. This is known to happen for the MainFrame's "Submit Content" action, which was therefore disabled for Skein in #26272334, but the issue could be more widespread.
To provide a definitive fix for this issue, the sync is moved to within ChoosePackagesToCheckIn, triggered only when 'UsesSnapshots()' is true, which effectively means Skein only.
#rnx
[CL 27582511 by wouter burgers in ue5-main branch]
2023-09-04 04:10:36 -04:00
const bool bPromptUserToSave = false ;
const bool bSaveMapPackages = true ;
const bool bSaveContentPackages = true ;
const bool bFastSave = false ;
const bool bNotifyNoPackagesSaved = false ;
const bool bCanBeDeclined = false ;
FEditorFileUtils : : SaveDirtyPackages ( bPromptUserToSave , bSaveMapPackages , bSaveContentPackages , bFastSave , bNotifyNoPackagesSaved , bCanBeDeclined ) ;
2023-01-26 10:15:04 -05:00
FBookmarkScoped BookmarkScoped ;
2023-01-20 15:31:16 -05:00
FSourceControlWindows : : RevertAllChangesAndReloadWorld ( ) ;
2022-12-11 23:09:22 -05:00
}
}
2020-05-20 12:48:17 -04:00
FSourceControlMenuHelpers : : EQueryState FSourceControlMenuHelpers : : QueryState = FSourceControlMenuHelpers : : EQueryState : : NotQueried ;
void FSourceControlMenuHelpers : : CheckSourceControlStatus ( )
{
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
if ( SourceControlModule . IsEnabled ( ) )
{
SourceControlModule . GetProvider ( ) . Execute ( ISourceControlOperation : : Create < FConnect > ( ) ,
EConcurrency : : Asynchronous ,
FSourceControlOperationComplete : : CreateStatic ( & FSourceControlMenuHelpers : : OnSourceControlOperationComplete ) ) ;
QueryState = EQueryState : : Querying ;
}
}
void FSourceControlMenuHelpers : : OnSourceControlOperationComplete ( const FSourceControlOperationRef & InOperation , ECommandResult : : Type InResult )
{
QueryState = EQueryState : : Queried ;
}
TSharedRef < SWidget > FSourceControlMenuHelpers : : GenerateSourceControlMenuContent ( )
{
UToolMenu * SourceControlMenu = UToolMenus : : Get ( ) - > RegisterMenu ( " StatusBar.ToolBar.SourceControl " , NAME_None , EMultiBoxType : : Menu , false ) ;
FToolMenuSection & Section = SourceControlMenu - > AddSection ( " SourceControlActions " , LOCTEXT ( " SourceControlMenuHeadingActions " , " Actions " ) ) ;
2021-01-11 15:31:58 -04:00
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . ViewChangelists ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
2022-12-09 14:18:01 -05:00
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.ChangelistsTab " )
2021-01-11 15:31:58 -04:00
) ;
2023-11-30 07:58:07 -05:00
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . ViewSnapshotHistory ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.Actions.Rewind " )
) ;
2021-10-20 14:15:53 -04:00
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . SubmitContent ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
2022-12-09 14:18:01 -05:00
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.Actions.Submit " )
2021-10-20 14:15:53 -04:00
) ;
2020-05-20 12:48:17 -04:00
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . CheckOutModifiedFiles ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
2022-12-09 14:18:01 -05:00
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.Actions.CheckOut " )
2020-05-20 12:48:17 -04:00
) ;
2021-10-20 14:15:53 -04:00
Section . AddDynamicEntry ( " ConnectToSourceControl " , FNewToolMenuSectionDelegate : : CreateLambda ( [ ] ( FToolMenuSection & InSection )
{
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
if ( ISourceControlModule : : Get ( ) . IsEnabled ( ) & & ISourceControlModule : : Get ( ) . GetProvider ( ) . IsAvailable ( ) )
{
InSection . AddMenuEntry (
FSourceControlCommands : : Get ( ) . ChangeSourceControlSettings ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
2022-12-09 14:18:01 -05:00
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.Actions.ChangeSettings " )
2021-10-20 14:15:53 -04:00
) ;
}
else
{
InSection . AddMenuEntry (
FSourceControlCommands : : Get ( ) . ConnectToSourceControl ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
2022-12-09 14:18:01 -05:00
FSlateIcon ( FRevisionControlStyleManager : : GetStyleSetName ( ) , " RevisionControl.Icon " )
2021-10-20 14:15:53 -04:00
) ;
}
} ) ) ;
2020-05-20 12:48:17 -04:00
return UToolMenus : : Get ( ) - > GenerateWidget ( " StatusBar.ToolBar.SourceControl " , FToolMenuContext ( FSourceControlCommands : : ActionList ) ) ;
}
2022-12-11 23:09:22 -05:00
TSharedRef < SWidget > FSourceControlMenuHelpers : : GenerateCheckInComboButtonContent ( )
{
UToolMenu * SourceControlMenu = UToolMenus : : Get ( ) - > RegisterMenu ( " StatusBar.ToolBar.SourceControl.CheckInCombo " , NAME_None , EMultiBoxType : : Menu , false ) ;
FToolMenuSection & Section = SourceControlMenu - > AddSection ( " SourceControlComboActions " , LOCTEXT ( " SourceControlComboMenuHeadingActions " , " Actions " ) ) ;
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . RevertAll ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
FSlateIcon ( FAppStyle : : GetAppStyleSetName ( ) , " SourceControl.Actions.Revert " )
) ;
Section . AddMenuEntry (
FSourceControlCommands : : Get ( ) . ViewChangelists ,
TAttribute < FText > ( ) ,
TAttribute < FText > ( ) ,
FSlateIcon ( FAppStyle : : GetAppStyleSetName ( ) , " SourceControl.ChangelistsTab " )
) ;
return UToolMenus : : Get ( ) - > GenerateWidget ( " StatusBar.ToolBar.SourceControl.CheckInCombo " , FToolMenuContext ( FSourceControlCommands : : ActionList ) ) ;
}
2020-05-20 12:48:17 -04:00
FText FSourceControlMenuHelpers : : GetSourceControlStatusText ( )
{
if ( QueryState = = EQueryState : : Querying )
{
return LOCTEXT ( " SourceControlStatus_Querying " , " Contacting Server.... " ) ;
}
else
{
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
if ( SourceControlModule . IsEnabled ( ) )
{
if ( ! SourceControlModule . GetProvider ( ) . IsAvailable ( ) )
{
2022-03-04 16:10:23 -05:00
return LOCTEXT ( " SourceControlStatus_Error_ServerUnavailable " , " Server Unavailable " ) ;
2020-05-20 12:48:17 -04:00
}
else
{
2022-11-23 11:57:50 -05:00
return LOCTEXT ( " SourceControlStatus_Available " , " Revision Control " ) ;
2020-05-20 12:48:17 -04:00
}
}
else
{
2022-11-23 11:57:50 -05:00
return LOCTEXT ( " SourceControlStatus_Error_Off " , " Revision Control " ) ; // Relies on the icon on the status bar widget to know if the source control is on or off.
2020-05-20 12:48:17 -04:00
}
}
}
FText FSourceControlMenuHelpers : : GetSourceControlTooltip ( )
{
if ( QueryState = = EQueryState : : Querying )
{
2022-11-23 11:57:50 -05:00
return LOCTEXT ( " SourceControlUnknown " , " Revision control status is unknown " ) ;
2020-05-20 12:48:17 -04:00
}
else
{
return ISourceControlModule : : Get ( ) . GetProvider ( ) . GetStatusText ( ) ;
}
}
2022-12-09 14:18:01 -05:00
const FSlateBrush * FSourceControlMenuHelpers : : GetSourceControlIconBadge ( )
2020-05-20 12:48:17 -04:00
{
if ( QueryState = = EQueryState : : Querying )
{
2022-12-09 14:18:01 -05:00
return nullptr ;
2020-05-20 12:48:17 -04:00
}
else
{
ISourceControlModule & SourceControlModule = ISourceControlModule : : Get ( ) ;
if ( SourceControlModule . IsEnabled ( ) )
{
if ( ! SourceControlModule . GetProvider ( ) . IsAvailable ( ) )
{
2022-12-09 14:18:01 -05:00
static const FSlateBrush * ErrorBrush = FRevisionControlStyleManager : : Get ( ) . GetBrush ( " RevisionControl.Icon.WarningBadge " ) ;
2020-05-20 12:48:17 -04:00
return ErrorBrush ;
}
else
{
2022-12-09 14:18:01 -05:00
static const FSlateBrush * OnBrush = FRevisionControlStyleManager : : Get ( ) . GetBrush ( " RevisionControl.Icon.ConnectedBadge " ) ;
2020-05-20 12:48:17 -04:00
return OnBrush ;
}
}
else
{
2022-12-09 14:18:01 -05:00
static const FSlateBrush * OffBrush = nullptr ;
2020-05-20 12:48:17 -04:00
return OffBrush ;
}
}
}
TSharedRef < SWidget > FSourceControlMenuHelpers : : MakeSourceControlStatusWidget ( )
{
2022-12-09 14:18:01 -05:00
TSharedRef < SLayeredImage > SourceControlIcon =
SNew ( SLayeredImage )
2023-02-16 12:43:53 -05:00
. ColorAndOpacity ( FSlateColor : : UseForeground ( ) )
2022-12-09 14:18:01 -05:00
. Image ( FRevisionControlStyleManager : : Get ( ) . GetBrush ( " RevisionControl.Icon " ) ) ;
SourceControlIcon - > AddLayer ( TAttribute < const FSlateBrush * > : : CreateStatic ( & FSourceControlMenuHelpers : : GetSourceControlIconBadge ) ) ;
2020-05-20 12:48:17 -04:00
return
2022-09-26 16:32:49 -04:00
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. VAlign ( VAlign_Center )
. AutoWidth ( )
2020-05-20 12:48:17 -04:00
[
2022-10-03 20:38:09 -04:00
// NOTE: The unsaved can have its own menu extension in the status bar to decouple it from source control, but putting all the buttons in the right order
// on the status bar is not deterministic, you need to know the name of the menu that is before or after and the menu is dynamic. Having it here
// ensure its position with respect to the source control button.
FUnsavedAssetsTrackerModule : : Get ( ) . MakeUnsavedAssetsStatusBarWidget ( )
]
2023-02-20 17:59:49 -05:00
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. Padding ( 4.0f , - 5.0f ) // Intentional negative padding to make the separator cover the whole status bar vertically
[
SNew ( SSeparator )
. Thickness ( 2.0f )
. Orientation ( EOrientation : : Orient_Vertical )
]
2023-11-21 09:56:04 -05:00
+ SHorizontalBox : : Slot ( )
. Padding ( 0.f )
2022-09-26 16:32:49 -04:00
[
2023-11-21 09:56:04 -05:00
SNew ( SSourceControlControls )
. OnGenerateKebabMenu_Static ( & FSourceControlMenuHelpers : : GenerateCheckInComboButtonContent )
2023-02-20 21:07:58 -05:00
]
2022-11-01 07:01:53 -04:00
+ SHorizontalBox : : Slot ( ) // Source Control Menu
2022-09-26 16:32:49 -04:00
. VAlign ( VAlign_Center )
. AutoWidth ( )
[
SNew ( SComboButton )
. ContentPadding ( FMargin ( 6.0f , 0.0f ) )
. ToolTipText_Static ( & FSourceControlMenuHelpers : : GetSourceControlTooltip )
. MenuPlacement ( MenuPlacement_AboveAnchor )
2023-04-27 15:33:10 -04:00
. ComboButtonStyle ( & FAppStyle : : Get ( ) . GetWidgetStyle < FComboButtonStyle > ( " SimpleComboButton " ) )
2022-09-26 16:32:49 -04:00
. ButtonContent ( )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. VAlign ( VAlign_Center )
. HAlign ( HAlign_Center )
[
2022-12-09 14:18:01 -05:00
SourceControlIcon
2022-09-26 16:32:49 -04:00
]
+ SHorizontalBox : : Slot ( )
. AutoWidth ( )
. VAlign ( VAlign_Center )
. Padding ( FMargin ( 5 , 0 , 0 , 0 ) )
[
SNew ( STextBlock )
. TextStyle ( & FAppStyle : : Get ( ) . GetWidgetStyle < FTextBlockStyle > ( " NormalText " ) )
. Text_Static ( & FSourceControlMenuHelpers : : GetSourceControlStatusText )
]
]
. OnGetMenuContent ( FOnGetContent : : CreateStatic ( & FSourceControlMenuHelpers : : GenerateSourceControlMenuContent ) )
] ;
2020-05-20 12:48:17 -04:00
}
# undef LOCTEXT_NAMESPACE