2022-07-06 13:15:26 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "UGSTab.h"
2022-07-08 17:44:08 -04:00
# include "UGSLog.h"
2022-07-13 18:31:11 -04:00
# include "ChangeInfo.h"
2022-10-11 11:51:56 -04:00
# include "CreateClientTask.h"
2022-09-27 14:21:41 -04:00
# include "FindStreamsTask.h"
2022-07-20 19:57:37 -04:00
# include "UGSTabManager.h"
2022-07-13 18:31:11 -04:00
2023-02-16 02:03:16 -05:00
# include "Utility.h"
# include "BuildStep.h"
# include "DetectProjectSettingsTask.h"
# include "FindStreamsTask.h"
# include "PerforceMonitor.h"
# include "EventMonitor.h"
2022-07-12 21:26:56 -04:00
2022-07-07 16:15:00 -04:00
# include "Widgets/SModalTaskWindow.h"
2022-07-07 17:55:05 -04:00
# include "Widgets/SLogWidget.h"
2022-07-07 13:34:35 -04:00
2022-07-20 23:24:30 -04:00
# include "HAL/PlatformApplicationMisc.h"
2022-09-07 14:07:32 -04:00
# include "Framework/Application/SlateApplication.h"
2022-07-20 23:24:30 -04:00
2022-07-13 13:19:32 -04:00
# include "Internationalization/Regex.h"
2022-07-06 13:15:26 -04:00
# define LOCTEXT_NAMESPACE "UGSTab"
UGSTab : : UGSTab ( ) : TabArgs ( nullptr , FTabId ( ) ) ,
TabWidget ( SNew ( SDockTab ) ) ,
2022-09-21 11:56:01 -04:00
EmptyTabView ( SNew ( SEmptyTab , this ) ) ,
GameSyncTabView ( SNew ( SGameSyncTab , this ) ) ,
2022-08-16 18:20:22 -04:00
bHasQueuedMessages ( false ) ,
bNeedUpdateGameTabBuildList ( false )
2022-07-20 19:57:37 -04:00
{
2022-08-11 15:08:33 -04:00
Initialize ( nullptr ) ;
2022-07-20 19:57:37 -04:00
}
2022-08-18 10:08:35 -04:00
UGSTab : : ~ UGSTab ( )
{
if ( Workspace )
{
Workspace - > CancelUpdate ( ) ;
}
}
2022-08-11 15:08:33 -04:00
void UGSTab : : Initialize ( TSharedPtr < UGSCore : : FUserSettings > InUserSettings )
2022-07-06 13:15:26 -04:00
{
2022-08-11 15:08:33 -04:00
UserSettings = InUserSettings ;
2022-07-06 13:15:26 -04:00
TabWidget - > SetContent ( EmptyTabView ) ;
2022-07-11 15:44:33 -04:00
TabWidget - > SetLabel ( FText ( LOCTEXT ( " TabName " , " Select a Project " ) ) ) ;
2022-09-21 11:56:01 -04:00
PerforceClient = MakeShared < UGSCore : : FPerforceConnection > ( TEXT ( " " ) , TEXT ( " " ) , TEXT ( " " ) ) ;
2022-07-06 13:15:26 -04:00
}
2022-07-20 19:57:37 -04:00
void UGSTab : : SetTabManager ( UGSTabManager * InTabManager )
{
TabManager = InTabManager ;
}
2022-07-06 13:15:26 -04:00
const TSharedRef < SDockTab > UGSTab : : GetTabWidget ( )
{
return TabWidget ;
}
2022-07-08 15:08:49 -04:00
void UGSTab : : SetTabArgs ( FSpawnTabArgs InTabArgs )
2022-07-06 13:15:26 -04:00
{
2022-07-08 15:08:49 -04:00
TabArgs = InTabArgs ;
}
FSpawnTabArgs UGSTab : : GetTabArgs ( ) const
{
return TabArgs ;
2022-07-06 13:15:26 -04:00
}
2022-07-07 13:34:35 -04:00
namespace
{
// TODO super hacky... fix up later
# if PLATFORM_WINDOWS
const TCHAR * HostPlatform = TEXT ( " Win64 " ) ;
# elif PLATFORM_MAC
const TCHAR * HostPlatform = TEXT ( " Mac " ) ;
# else
const TCHAR * HostPlatform = TEXT ( " Linux " ) ;
# endif
2022-07-20 21:32:25 -04:00
class FLineWriter : public UGSCore : : FLineBasedTextWriter
2022-07-07 13:34:35 -04:00
{
public :
virtual void FlushLine ( const FString & Line ) override
{
2022-07-08 17:44:08 -04:00
UE_LOG ( LogSlateUGS , Log , TEXT ( " %s " ) , * Line ) ;
2022-07-07 13:34:35 -04:00
}
} ;
2022-07-20 21:32:25 -04:00
FString GetEditorExePath ( UGSCore : : EBuildConfig Config , TSharedPtr < UGSCore : : FDetectProjectSettingsTask > DetectSettings )
2022-07-07 13:34:35 -04:00
{
2022-08-19 10:30:26 -04:00
# if PLATFORM_WINDOWS
FString ExeFileName = TEXT ( " UnrealEditor.exe " ) ;
# else
2022-07-07 13:34:35 -04:00
FString ExeFileName = TEXT ( " UnrealEditor " ) ;
2022-08-19 10:30:26 -04:00
# endif
2022-07-07 13:34:35 -04:00
2022-07-20 21:32:25 -04:00
if ( Config ! = UGSCore : : EBuildConfig : : DebugGame & & Config ! = UGSCore : : EBuildConfig : : Development )
2022-07-07 13:34:35 -04:00
{
# if PLATFORM_WINDOWS
2022-07-20 21:32:25 -04:00
ExeFileName = FString : : Printf ( TEXT ( " UnrealEditor-%s-%s.exe " ) , HostPlatform , * UGSCore : : ToString ( Config ) ) ;
2022-07-07 13:34:35 -04:00
# else
2022-07-20 21:32:25 -04:00
ExeFileName = FString : : Printf ( TEXT ( " UnrealEditor-%s-%s " ) , HostPlatform , * UGSCore : : ToString ( Config ) ) ;
2022-07-07 13:34:35 -04:00
# endif
}
return DetectSettings - > BranchDirectoryName / " Engine " / " Binaries " / HostPlatform / ExeFileName ;
}
2022-07-13 18:31:11 -04:00
static FString FormatUserName ( FString UserName )
{
TStringBuilder < 256 > NormalUserName ;
2022-07-20 21:32:25 -04:00
for ( int Index = 0 ; Index < UserName . Len ( ) ; Index + + )
2022-07-13 18:31:11 -04:00
{
2022-07-20 21:32:25 -04:00
if ( Index = = 0 | | UserName [ Index - 1 ] = = ' . ' )
2022-07-13 18:31:11 -04:00
{
NormalUserName . AppendChar ( FChar : : ToUpper ( UserName [ Index ] ) ) ;
}
2022-07-20 21:32:25 -04:00
else if ( UserName [ Index ] = = ' . ' )
2022-07-13 18:31:11 -04:00
{
NormalUserName . AppendChar ( ' ' ) ;
}
else
{
NormalUserName . AppendChar ( FChar : : ToLower ( UserName [ Index ] ) ) ;
}
}
2022-07-20 21:32:25 -04:00
2022-07-13 18:31:11 -04:00
return NormalUserName . ToString ( ) ;
}
2022-07-07 13:34:35 -04:00
}
2022-08-11 15:08:33 -04:00
bool UGSTab : : IsProjectLoaded ( ) const
{
return ! ProjectFileName . IsEmpty ( ) ;
}
2022-07-08 15:08:49 -04:00
bool UGSTab : : OnWorkspaceChosen ( const FString & Project )
{
bool bIsDataValid = FPaths : : FileExists ( Project ) ; // Todo: Check that the project file is also associated with a workspace
if ( bIsDataValid )
{
ProjectFileName = Project ;
2022-07-12 11:58:47 -04:00
2022-08-18 14:19:03 -04:00
if ( SetupWorkspace ( ) )
{
GameSyncTabView - > SetStreamPathText ( FText : : FromString ( DetectSettings - > StreamName ) ) ;
GameSyncTabView - > SetChangelistText ( WorkspaceSettings - > CurrentChangeNumber ) ;
GameSyncTabView - > SetProjectPathText ( FText : : FromString ( ProjectFileName ) ) ;
TabWidget - > SetContent ( GameSyncTabView ) ;
TabWidget - > SetLabel ( FText : : FromString ( DetectSettings - > StreamName ) ) ;
2022-07-12 11:58:47 -04:00
2022-08-18 14:19:03 -04:00
return true ;
}
2022-07-08 15:08:49 -04:00
}
return false ;
}
2022-08-18 14:54:30 -04:00
void UGSTab : : RefreshBuildList ( )
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Refreshing build list... " ) ) ;
2022-08-18 14:54:30 -04:00
PerforceMonitor - > Refresh ( ) ;
}
2022-08-16 18:20:22 -04:00
void UGSTab : : CancelSync ( )
{
if ( Workspace - > IsBusy ( ) )
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Canceling sync/build... " ) ) ;
2022-08-16 18:20:22 -04:00
Workspace - > CancelUpdate ( ) ;
}
}
2022-09-01 17:54:04 -04:00
TMap < FString , FString > UGSTab : : GetWorkspaceVariables ( ) const
{
UGSCore : : EBuildConfig EditorBuildConfig = GetEditorBuildConfig ( ) ;
TMap < FString , FString > Variables ;
Variables . Add ( " BranchDir " , DetectSettings - > BranchDirectoryName ) ;
Variables . Add ( " ProjectDir " , FPaths : : GetPath ( DetectSettings - > NewSelectedFileName ) ) ;
Variables . Add ( " ProjectFile " , DetectSettings - > NewSelectedFileName ) ;
// Todo: These might not be called "UE4*" anymore
Variables . Add ( " UE4EditorExe " , GetEditorExePath ( EditorBuildConfig , DetectSettings ) ) ;
Variables . Add ( " UE4EditorCmdExe " , GetEditorExePath ( EditorBuildConfig , DetectSettings ) . Replace ( TEXT ( " .exe " ) , TEXT ( " -Cmd.exe " ) ) ) ;
Variables . Add ( " UE4EditorConfig " , UGSCore : : ToString ( EditorBuildConfig ) ) ;
Variables . Add ( " UE4EditorDebugArg " , ( EditorBuildConfig = = UGSCore : : EBuildConfig : : Debug | | EditorBuildConfig = = UGSCore : : EBuildConfig : : DebugGame ) ? " -debug " : " " ) ;
return Variables ;
}
UGSCore : : EBuildConfig UGSTab : : GetEditorBuildConfig ( ) const
{
return ShouldSyncPrecompiledEditor ( ) ? UGSCore : : EBuildConfig : : Development : UserSettings - > CompiledEditorBuildConfig ;
}
bool UGSTab : : ShouldSyncPrecompiledEditor ( ) const
{
return UserSettings - > bSyncPrecompiledEditor & & PerforceMonitor - > HasZippedBinaries ( ) ;
}
2022-09-27 14:37:01 -04:00
TArray < FString > UGSTab : : GetAllStreamNames ( ) const
2022-09-21 11:56:01 -04:00
{
2022-09-27 13:00:50 -04:00
TArray < FString > Result ;
2022-09-27 14:21:41 -04:00
const TSharedRef < UGSCore : : FModalTaskResult > TaskResult = ExecuteModalTask (
FSlateApplication : : Get ( ) . GetActiveModalWindow ( ) ,
2022-09-27 14:37:01 -04:00
MakeShared < UGSCore : : FFindStreamsTask > ( PerforceClient . ToSharedRef ( ) , MakeShared < FLineWriter > ( ) , Result , TEXT ( " //*/* " ) ) ,
2024-08-30 00:39:28 -04:00
LOCTEXT ( " FindingStreamsTitle " , " Finding Streams " ) ,
LOCTEXT ( " FindingStreamsCaption " , " Finding streams, please wait... " ) ) ;
2022-09-27 14:21:41 -04:00
if ( TaskResult - > Failed ( ) )
{
FMessageDialog : : Open ( EAppMsgType : : Ok , TaskResult - > GetMessage ( ) ) ;
return TArray < FString > ( ) ;
}
2022-09-21 11:56:01 -04:00
return Result ;
}
2022-09-01 17:54:04 -04:00
// Honestly ... seems ... super hacky/hardcoded. With out all these you assert when trying to merge build targets sooo a bit odd
// TODO Need to do each of these ... per ... platform??
TMap < FGuid , UGSCore : : FCustomConfigObject > UGSTab : : GetDefaultBuildStepObjects ( const FString & EditorTargetName )
{
TArray < UGSCore : : FBuildStep > DefaultBuildSteps ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x01F66060 , 0x73FA4CC8 , 0x9CB3E217 , 0xFBBA954E ) , 0 , TEXT ( " Compile UnrealHeaderTool " ) , TEXT ( " Compiling UnrealHeaderTool... " ) , 1 , TEXT ( " UnrealHeaderTool " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
FString ActualEditorTargetName = ( EditorTargetName . Len ( ) > 0 ) ? EditorTargetName : " UnrealEditor " ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0xF097FF61 , 0xC9164058 , 0x839135B4 , 0x6C3173D5 ) , 1 , FString : : Printf ( TEXT ( " Compile %s " ) , * ActualEditorTargetName ) , FString : : Printf ( TEXT ( " Compiling %s... " ) , * ActualEditorTargetName ) , 10 , ActualEditorTargetName , HostPlatform , UGSCore : : ToString ( UserSettings - > CompiledEditorBuildConfig ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0xC6E633A1 , 0x956F4AD3 , 0xBC956D06 , 0xD131E7B4 ) , 2 , TEXT ( " Compile ShaderCompileWorker " ) , TEXT ( " Compiling ShaderCompileWorker... " ) , 1 , TEXT ( " ShaderCompileWorker " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x24FFD88C , 0x79014899 , 0x9696AE10 , 0x66B4B6E8 ) , 3 , TEXT ( " Compile UnrealLightmass " ) , TEXT ( " Compiling UnrealLightmass... " ) , 1 , TEXT ( " UnrealLightmass " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0xFFF20379 , 0x06BF4205 , 0x8A3EC534 , 0x27736688 ) , 4 , TEXT ( " Compile CrashReportClient " ) , TEXT ( " Compiling CrashReportClient... " ) , 1 , TEXT ( " CrashReportClient " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x89FE8A79 , 0xD2594C7B , 0xBFB468F7 , 0x218B91C2 ) , 5 , TEXT ( " Compile UnrealInsights " ) , TEXT ( " Compiling UnrealInsights... " ) , 1 , TEXT ( " UnrealInsights " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x46312669 , 0x5069428D , 0x8D72C241 , 0x6C5A322E ) , 6 , TEXT ( " Launch UnrealInsights " ) , TEXT ( " Running UnrealInsights... " ) , 1 , TEXT ( " UnrealInsights " ) , HostPlatform , TEXT ( " Shipping " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0xBB48CA5B , 0x56824432 , 0x824DC451 , 0x336A6523 ) , 7 , TEXT ( " Compile Zen Dashboard " ) , TEXT ( " Compile ZenDashboard Step... " ) , 1 , TEXT ( " ZenDashboard " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x586CC0D3 , 0x39144DF9 , 0xACB62C02 , 0xCD9D4FC6 ) , 8 , TEXT ( " Launch Zen Dashboard " ) , TEXT ( " Running Zen Dashboard... " ) , 1 , TEXT ( " ZenDashboard " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x91C2A429 , 0xC39149B4 , 0x92A54E6B , 0xE71E0F00 ) , 9 , TEXT ( " Compile SwitchboardListener " ) , TEXT ( " Compiling SwitchboardListener... " ) , 1 , TEXT ( " SwitchboardListener " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x5036C75B , 0x8DF04329 , 0x82A1869D , 0xD2D48605 ) , 10 , TEXT ( " Compile UnrealMultiUserServer " ) , TEXT ( " Compiling UnrealMultiUserServer... " ) , 1 , TEXT ( " UnrealMultiUserServer " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0x274B89C3 , 0x9DC64465 , 0xA50840AB , 0xC4593CC2 ) , 11 , TEXT ( " Compile UnrealMultiUserSlateServer " ) , TEXT ( " Compiling UnrealMultiUserSlateServer... " ) , 1 , TEXT ( " UnrealMultiUserSlateServer " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
2022-12-02 09:45:14 -05:00
DefaultBuildSteps . Add ( UGSCore : : FBuildStep ( FGuid ( 0xF7F0C4C7 , 0x55514485 , 0xA961F3E4 , 0xFD9D138C ) , 12 , TEXT ( " Compile InterchangeWorker " ) , TEXT ( " Compiling InterchangeWorker... " ) , 1 , TEXT ( " InterchangeWorker " ) , HostPlatform , TEXT ( " Development " ) , TEXT ( " " ) , ! ShouldSyncPrecompiledEditor ( ) ) ) ;
2022-09-01 17:54:04 -04:00
TMap < FGuid , UGSCore : : FCustomConfigObject > DefaultBuildStepObjects ;
for ( const UGSCore : : FBuildStep & DefaultBuildStep : DefaultBuildSteps )
{
DefaultBuildStepObjects . Add ( DefaultBuildStep . UniqueId , DefaultBuildStep . ToConfigObject ( ) ) ;
}
return DefaultBuildStepObjects ;
}
2022-07-14 19:09:38 -04:00
void UGSTab : : OnSyncChangelist ( int Changelist )
{
2022-08-16 14:49:58 -04:00
// Options on what to do with workspace when updating it
2022-09-01 17:54:04 -04:00
UGSCore : : EWorkspaceUpdateOptions Options = UGSCore : : EWorkspaceUpdateOptions : : Sync | UGSCore : : EWorkspaceUpdateOptions : : GenerateProjectFiles ;
2022-08-16 14:49:58 -04:00
if ( UserSettings - > bAutoResolveConflicts )
{
Options | = UGSCore : : EWorkspaceUpdateOptions : : AutoResolveChanges ;
}
if ( UserSettings - > bUseIncrementalBuilds )
{
Options | = UGSCore : : EWorkspaceUpdateOptions : : UseIncrementalBuilds ;
}
if ( UserSettings - > bBuildAfterSync )
{
Options | = UGSCore : : EWorkspaceUpdateOptions : : Build ;
}
if ( UserSettings - > bBuildAfterSync & & UserSettings - > bRunAfterSync )
{
Options | = UGSCore : : EWorkspaceUpdateOptions : : RunAfterSync ;
}
if ( UserSettings - > bOpenSolutionAfterSync )
{
Options | = UGSCore : : EWorkspaceUpdateOptions : : OpenSolutionAfterSync ;
}
2022-07-20 21:32:25 -04:00
TSharedRef < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > Context = MakeShared < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > (
2022-07-14 19:09:38 -04:00
Changelist ,
Options ,
CombinedSyncFilter ,
2022-09-01 17:54:04 -04:00
GetDefaultBuildStepObjects ( DetectSettings - > NewProjectEditorTarget ) ,
2022-07-14 19:09:38 -04:00
ProjectSettings - > BuildSteps ,
TSet < FGuid > ( ) ,
2022-09-01 17:54:04 -04:00
GetWorkspaceVariables ( ) ) ;
if ( UserSettings - > bSyncPrecompiledEditor )
{
FString ArchivePath ;
if ( PerforceMonitor - > TryGetArchivePathForChangeNumber ( Changelist , ArchivePath ) )
{
Context - > Options | = UGSCore : : EWorkspaceUpdateOptions : : SyncArchives ;
Context - > ArchiveTypeToDepotPath . Add ( TPair < FString , FString > ( " Editor " , ArchivePath ) ) ;
}
}
2022-07-14 19:09:38 -04:00
// Update the workspace with the Context!
Workspace - > Update ( Context ) ;
}
2022-08-18 16:23:15 -04:00
void UGSTab : : OnBuildWorkspace ( )
{
UGSCore : : EWorkspaceUpdateOptions Options = UGSCore : : EWorkspaceUpdateOptions : : Build ;
TSharedRef < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > Context = MakeShared < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > (
- 1 ,
Options ,
CombinedSyncFilter ,
2022-09-01 17:54:04 -04:00
GetDefaultBuildStepObjects ( DetectSettings - > NewProjectEditorTarget ) ,
2022-08-18 16:23:15 -04:00
ProjectSettings - > BuildSteps ,
TSet < FGuid > ( ) ,
2022-09-01 17:54:04 -04:00
GetWorkspaceVariables ( ) ) ;
2022-08-18 16:23:15 -04:00
// Update the workspace with the Context!
Workspace - > Update ( Context ) ;
}
2022-07-20 23:24:30 -04:00
void UGSTab : : OnViewInSwarmClicked ( int Changelist ) const
{
FString SwarmURL = FString : : Printf ( TEXT ( " https://p4-swarm.epicgames.net/changes/%i " ) , Changelist ) ;
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Opening Swarm to %s " ) , * SwarmURL ) ;
2022-07-20 23:24:30 -04:00
FPlatformProcess : : LaunchURL ( * SwarmURL , nullptr , nullptr ) ;
}
void UGSTab : : OnCopyChangeListClicked ( int Changelist ) const
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Copying CL %i to clipboard " ) , Changelist ) ;
2022-07-20 23:24:30 -04:00
FPlatformApplicationMisc : : ClipboardCopy ( * FString : : FromInt ( Changelist ) ) ;
}
void UGSTab : : OnMoreInfoClicked ( int Changelist ) const
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Opening CL %i in p4v " ) , Changelist ) ;
2022-07-20 23:24:30 -04:00
PerforceClient - > OpenP4VC ( FString : : Printf ( TEXT ( " change %i " ) , Changelist ) ) ;
}
void UGSTab : : OnOpenPerforceClicked ( ) const
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Opening %s in p4v " ) , * ProjectFileName ) ;
2022-07-20 23:24:30 -04:00
PerforceClient - > OpenP4V ( ) ;
}
2022-07-08 15:08:49 -04:00
void UGSTab : : OnSyncLatest ( )
{
2022-07-08 17:18:38 -04:00
int ChangeNumber = - 1 ;
FEvent * AbortEvent = FPlatformProcess : : GetSynchEventFromPool ( true ) ;
2022-07-08 15:08:49 -04:00
2022-08-19 10:29:29 -04:00
if ( PerforceClient - > LatestChangeList ( ChangeNumber , AbortEvent , * Log . Get ( ) ) )
2022-07-08 17:18:38 -04:00
{
2022-07-14 19:09:38 -04:00
OnSyncChangelist ( ChangeNumber ) ;
2022-07-08 17:18:38 -04:00
}
FPlatformProcess : : ReturnSynchEventToPool ( AbortEvent ) ;
2022-07-08 15:08:49 -04:00
}
2022-07-14 17:48:46 -04:00
void UGSTab : : OnSyncFilterWindowSaved (
const TArray < FString > & SyncViewCurrent ,
const TArray < FGuid > & SyncExcludedCategoriesCurrent ,
const TArray < FString > & SyncViewAll ,
const TArray < FGuid > & SyncExcludedCategoriesAll )
{
WorkspaceSettings - > SyncView = SyncViewCurrent ;
WorkspaceSettings - > SyncExcludedCategories = SyncExcludedCategoriesCurrent ;
UserSettings - > SyncView = SyncViewAll ;
UserSettings - > SyncExcludedCategories = SyncExcludedCategoriesAll ;
UserSettings - > Save ( ) ;
}
2022-08-18 17:06:59 -04:00
void UGSTab : : OnOpenExplorer ( )
{
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Opening %s in the explorer " ) , * FPaths : : GetPath ( ProjectFileName ) ) ;
2022-08-18 17:06:59 -04:00
FPlatformProcess : : ExploreFolder ( * FPaths : : GetPath ( ProjectFileName ) ) ;
}
void UGSTab : : OnOpenEditor ( )
{
UGSCore : : EBuildConfig EditorBuildConfig = GetEditorBuildConfig ( ) ;
FString EditorPath = GetEditorExePath ( EditorBuildConfig , DetectSettings ) ;
2022-08-19 10:29:29 -04:00
Log - > Logf ( TEXT ( " Running Editor %s %s " ) , * EditorPath , * ProjectFileName ) ;
2022-08-18 17:06:59 -04:00
EditorProcessHandle = FPlatformProcess : : CreateProc ( * EditorPath , * ProjectFileName , true , false , false , nullptr , 0 , nullptr , nullptr , nullptr ) ;
}
2022-10-11 11:51:56 -04:00
void UGSTab : : OnCreateWorkspace ( const FString & WorkspaceName , const FString & Stream , const FString & RootDirectory ) const
{
const TSharedRef < FLineWriter > CreateWorkspaceLog = MakeShared < FLineWriter > ( ) ;
FEvent * AbortEvent = FPlatformProcess : : GetSynchEventFromPool ( true ) ;
TSharedPtr < UGSCore : : FPerforceInfoRecord > PerforceInfo ;
PerforceClient - > Info ( PerforceInfo , AbortEvent , * CreateWorkspaceLog ) ;
TMap < FString , FString > Tags ;
Tags . Add ( TEXT ( " client " ) , WorkspaceName ) ;
Tags . Add ( TEXT ( " Owner " ) , PerforceInfo - > UserName ) ;
Tags . Add ( TEXT ( " Host " ) , PerforceInfo - > HostName ) ;
Tags . Add ( TEXT ( " Root " ) , RootDirectory ) ;
const UGSCore : : FPerforceClientRecord ClientRecord ( Tags ) ;
const TSharedRef < UGSCore : : FModalTaskResult > TaskResult = ExecuteModalTask (
FSlateApplication : : Get ( ) . GetActiveModalWindow ( ) ,
MakeShared < UGSCore : : FCreateClientTask > ( PerforceClient . ToSharedRef ( ) , MakeShared < FLineWriter > ( ) , ClientRecord , Stream ) ,
2024-08-30 00:39:28 -04:00
LOCTEXT ( " CreatingProjectTitle " , " Creating Project " ) ,
LOCTEXT ( " CreatingProjectCaption " , " Creating project, please wait... " ) ) ;
2022-10-11 11:51:56 -04:00
}
2022-07-12 21:26:56 -04:00
void UGSTab : : QueueMessageForMainThread ( TFunction < void ( ) > Function )
{
FScopeLock Lock ( & CriticalSection ) ;
MessageQueue . Add ( Function ) ;
bHasQueuedMessages = true ;
}
void UGSTab : : Tick ( )
{
if ( bHasQueuedMessages )
{
bHasQueuedMessages = false ;
FScopeLock Lock ( & CriticalSection ) ;
for ( const TFunction < void ( ) > & MessageFunction : MessageQueue )
{
MessageFunction ( ) ;
}
MessageQueue . Empty ( ) ;
}
2022-08-16 16:53:21 -04:00
if ( bNeedUpdateGameTabBuildList )
{
bNeedUpdateGameTabBuildList = false ;
UpdateGameTabBuildList ( ) ;
}
2022-08-18 17:06:59 -04:00
// if we have spawned an editor process, check if its closed to reap it
if ( EditorProcessHandle . IsValid ( ) )
{
if ( ! FPlatformProcess : : IsProcRunning ( EditorProcessHandle ) )
{
FPlatformProcess : : CloseProc ( EditorProcessHandle ) ;
EditorProcessHandle . Reset ( ) ;
}
}
2022-07-12 21:26:56 -04:00
}
2022-07-13 13:19:32 -04:00
namespace
{
2022-07-20 21:32:25 -04:00
bool ShouldShowChange ( const UGSCore : : FPerforceChangeSummary & Change , const TArray < FString > & ExcludeChanges )
2022-07-13 13:19:32 -04:00
{
for ( const FString & ExcludeChange : ExcludeChanges )
{
FRegexPattern RegexPattern ( * ExcludeChange , ERegexPatternFlags : : CaseInsensitive ) ;
FRegexMatcher RegexMatcher ( RegexPattern , Change . Description ) ;
if ( RegexMatcher . FindNext ( ) )
{
return false ;
}
}
if ( Change . User = = TEXT ( " buildmachine " ) & & Change . Description . Contains ( TEXT ( " lightmaps " ) ) )
{
return false ;
}
return true ;
}
}
bool UGSTab : : ShouldIncludeInReviewedList ( const TSet < int > & PromotedChangeNumbers , int ChangeNumber ) const
{
if ( PromotedChangeNumbers . Contains ( ChangeNumber ) )
{
return true ;
}
2022-07-20 21:32:25 -04:00
TSharedPtr < UGSCore : : FEventSummary > Review ;
2022-07-13 13:19:32 -04:00
if ( EventMonitor - > TryGetSummaryForChange ( ChangeNumber , Review ) )
{
2022-07-20 21:32:25 -04:00
if ( Review - > LastStarReview . IsValid ( ) & & Review - > LastStarReview - > Type = = UGSCore : : EEventType : : Starred )
2022-07-13 13:19:32 -04:00
{
return true ;
}
2022-07-20 21:32:25 -04:00
if ( Review - > Verdict = = UGSCore : : EReviewVerdict : : Good | | Review - > Verdict = = UGSCore : : EReviewVerdict : : Mixed )
2022-07-13 13:19:32 -04:00
{
return true ;
}
}
return false ;
}
void UGSTab : : UpdateGameTabBuildList ( )
{
2022-07-20 21:32:25 -04:00
TArray < TSharedRef < UGSCore : : FPerforceChangeSummary , ESPMode : : ThreadSafe > > Changes = PerforceMonitor - > GetChanges ( ) ;
2022-07-13 18:31:11 -04:00
TArray < TSharedPtr < FChangeInfo > > ChangeInfos ;
2022-07-13 13:19:32 -04:00
// do we need to store these for something?
TSet < int > PromotedChangeNumbers = PerforceMonitor - > GetPromotedChangeNumbers ( ) ;
TArray < FString > ExcludeChanges ;
2022-07-20 21:32:25 -04:00
TSharedPtr < UGSCore : : FCustomConfigFile , ESPMode : : ThreadSafe > ProjectConfigFile = Workspace - > GetProjectConfigFile ( ) ;
2022-07-13 13:26:22 -04:00
if ( ProjectConfigFile . IsValid ( ) )
{
ProjectConfigFile - > TryGetValues ( TEXT ( " Options.ExcludeChanges " ) , ExcludeChanges ) ;
}
2022-07-13 13:19:32 -04:00
bool bFirstChange = true ;
bool bOnlyShowReviewed = false ;
// bool bOnlyShowReviewed = OnlyShowReviewedCheckBox.Checked;
for ( int ChangeIdx = 0 ; ChangeIdx < Changes . Num ( ) ; ChangeIdx + + )
{
2022-07-20 21:32:25 -04:00
const UGSCore : : FPerforceChangeSummary & Change = Changes [ ChangeIdx ] . Get ( ) ;
2022-07-13 13:26:22 -04:00
if ( ShouldShowChange ( Change , ExcludeChanges ) | | PromotedChangeNumbers . Contains ( Change . Number ) )
{
2022-07-13 13:19:32 -04:00
if ( ! bOnlyShowReviewed | | ( ! EventMonitor - > IsUnderInvestigation ( Change . Number ) & & ( ShouldIncludeInReviewedList ( PromotedChangeNumbers , Change . Number ) | | bFirstChange ) ) )
{
bFirstChange = false ;
FDateTime DisplayTime = Change . Date ;
if ( UserSettings - > bShowLocalTimes )
{
DisplayTime = ( DisplayTime - DetectSettings - > ServerTimeZone ) . GetDate ( ) ;
}
2022-07-20 21:32:25 -04:00
TSharedPtr < UGSCore : : FEventSummary > Review ;
UGSCore : : EReviewVerdict Status = UGSCore : : EReviewVerdict : : Unknown ;
2022-07-13 18:31:11 -04:00
if ( EventMonitor - > TryGetSummaryForChange ( Change . Number , Review ) & & Review - > LastStarReview . IsValid ( ) )
{
2022-07-20 21:32:25 -04:00
if ( Review - > LastStarReview - > Type = = UGSCore : : EEventType : : Starred )
2022-07-13 18:31:11 -04:00
{
2022-07-20 21:32:25 -04:00
Status = UGSCore : : EReviewVerdict : : Good ;
2022-07-13 18:31:11 -04:00
}
else
{
Status = Review - > Verdict ;
}
}
2022-09-14 17:22:00 -04:00
bool bHasZippedBinaries = false ;
FString Temp ;
if ( PerforceMonitor - > TryGetArchivePathForChangeNumber ( Change . Number , Temp ) )
{
bHasZippedBinaries = true ;
}
UGSCore : : FChangeType ChangeType ;
PerforceMonitor - > TryGetChangeType ( Change . Number , ChangeType ) ;
2022-07-20 19:57:37 -04:00
if ( ChangeIdx = = 0 | |
Changes [ ChangeIdx - 1 ] - > Date . GetDayOfYear ( ) ! = Changes [ ChangeIdx ] - > Date . GetDayOfYear ( ) )
{
TSharedPtr < FChangeInfo > HeaderRow = MakeShareable ( new FChangeInfo ) ;
HeaderRow - > Time = DisplayTime ;
HeaderRow - > bHeaderRow = true ;
ChangeInfos . Add ( HeaderRow ) ;
}
2022-07-13 13:19:32 -04:00
2022-08-16 16:53:21 -04:00
bool bCurrentSyncedChange = Change . Number = = WorkspaceSettings - > CurrentChangeNumber ;
2022-07-20 19:57:37 -04:00
ChangeInfos . Add ( MakeShareable ( new FChangeInfo
{
DisplayTime ,
false ,
2022-07-13 18:31:11 -04:00
Status ,
2022-07-14 19:09:38 -04:00
Change . Number ,
2022-08-16 16:53:21 -04:00
bCurrentSyncedChange ,
2022-09-14 17:22:00 -04:00
ShouldSyncPrecompiledEditor ( ) ,
bHasZippedBinaries ,
ChangeType ,
2022-07-13 18:31:11 -04:00
FText : : FromString ( FormatUserName ( Change . User ) ) ,
2022-07-21 16:19:05 -04:00
Change . Description
2022-07-20 19:57:37 -04:00
} ) ) ;
2022-07-13 13:19:32 -04:00
}
}
}
2022-07-13 18:31:11 -04:00
GameSyncTabView - > AddHordeBuilds ( ChangeInfos ) ;
2022-07-13 13:19:32 -04:00
}
2022-07-11 15:44:33 -04:00
bool UGSTab : : IsSyncing ( ) const
{
2022-07-12 13:01:18 -04:00
return Workspace - > IsBusy ( ) ;
}
2022-07-11 15:44:33 -04:00
2022-07-12 13:01:18 -04:00
FString UGSTab : : GetSyncProgress ( ) const
{
2022-09-14 17:22:00 -04:00
TTuple < FString , float > CurrentProgress = Workspace - > GetCurrentProgress ( ) ;
if ( CurrentProgress . Value > 0.0f )
{
return FString : : Printf ( TEXT ( " %s %.2f%% " ) , * CurrentProgress . Key , CurrentProgress . Value * 100.0f ) ;
}
return CurrentProgress . Key ;
2022-07-11 15:44:33 -04:00
}
2022-07-20 21:32:25 -04:00
TArray < UGSCore : : FWorkspaceSyncCategory > UGSTab : : GetSyncCategories ( SyncCategoryType CategoryType ) const
2022-07-12 17:23:29 -04:00
{
2022-07-20 21:32:25 -04:00
TArray < UGSCore : : FWorkspaceSyncCategory > SyncCategories ;
TMap < FGuid , UGSCore : : FWorkspaceSyncCategory > Categories = Workspace - > GetSyncCategories ( ) ;
2022-07-14 17:48:46 -04:00
TArray < FGuid > SyncExcludedCategories ;
if ( CategoryType = = SyncCategoryType : : CurrentWorkspace )
{
SyncExcludedCategories = WorkspaceSettings - > SyncExcludedCategories ;
}
else
{
SyncExcludedCategories = UserSettings - > SyncExcludedCategories ;
}
for ( const FGuid & Guid : SyncExcludedCategories )
{
Categories [ Guid ] . bEnable = false ;
}
2022-07-20 21:32:25 -04:00
2022-07-14 17:48:46 -04:00
Categories . GenerateValueArray ( SyncCategories ) ;
2022-07-20 21:32:25 -04:00
2022-07-14 17:48:46 -04:00
return SyncCategories ;
}
TArray < FString > UGSTab : : GetSyncViews ( SyncCategoryType CategoryType ) const
{
if ( CategoryType = = SyncCategoryType : : CurrentWorkspace )
{
return WorkspaceSettings - > SyncView ;
}
2022-07-20 21:32:25 -04:00
2022-07-14 17:48:46 -04:00
return UserSettings - > SyncView ;
2022-07-12 17:23:29 -04:00
}
const TArray < FString > & UGSTab : : GetCombinedSyncFilter ( ) const
{
return CombinedSyncFilter ;
}
2022-09-27 14:21:41 -04:00
UGSTabManager * UGSTab : : GetTabManager ( ) const
2022-07-20 19:57:37 -04:00
{
return TabManager ;
}
2022-08-15 15:12:16 -04:00
TSharedPtr < UGSCore : : FUserSettings > UGSTab : : GetUserSettings ( ) const
{
return UserSettings ;
}
2022-07-12 15:06:30 -04:00
// This is getting called on a thread, lock our stuff up
2022-07-20 21:32:25 -04:00
void UGSTab : : OnWorkspaceSyncComplete ( TSharedRef < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > WorkspaceContext , UGSCore : : EWorkspaceUpdateResult SyncResult , const FString & StatusMessage )
2022-07-12 11:58:47 -04:00
{
2022-07-12 15:06:30 -04:00
FScopeLock Lock ( & CriticalSection ) ;
2022-07-12 11:58:47 -04:00
2022-08-16 18:20:22 -04:00
if ( SyncResult = = UGSCore : : EWorkspaceUpdateResult : : Success )
{
WorkspaceSettings - > CurrentChangeNumber = Workspace - > GetCurrentChangeNumber ( ) ;
WorkspaceSettings - > LastBuiltChangeNumber = Workspace - > GetLastBuiltChangeNumber ( ) ;
// Queue up setting the changelist text on the main thread
QueueMessageForMainThread ( [ this ] {
GameSyncTabView - > SetChangelistText ( WorkspaceSettings - > CurrentChangeNumber ) ;
} ) ;
// TODO hacky, but allows us to highlight which CL we have synced to in the list
bNeedUpdateGameTabBuildList = true ;
}
WorkspaceSettings - > LastSyncResult = SyncResult ;
WorkspaceSettings - > LastSyncResultMessage = StatusMessage ;
WorkspaceSettings - > LastSyncTime = WorkspaceContext - > StartTime ;
2022-07-12 11:58:47 -04:00
// TODO check this is valid, may be off
WorkspaceSettings - > LastSyncDurationSeconds = ( FDateTime : : UtcNow ( ) - WorkspaceContext - > StartTime ) . GetSeconds ( ) ;
UserSettings - > Save ( ) ;
}
2022-08-18 14:19:03 -04:00
bool UGSTab : : SetupWorkspace ( )
2022-07-07 13:34:35 -04:00
{
2022-07-20 21:32:25 -04:00
ProjectFileName = UGSCore : : FUtility : : GetPathWithCorrectCase ( ProjectFileName ) ;
2022-07-07 17:55:05 -04:00
// TODO likely should also log this on an Empty tab... so we can show logging info when we are loading things
2022-09-21 11:56:01 -04:00
DetectSettings = MakeShared < UGSCore : : FDetectProjectSettingsTask > ( PerforceClient . ToSharedRef ( ) , ProjectFileName , MakeShared < FLineWriter > ( ) ) ;
2022-07-07 13:34:35 -04:00
2022-07-20 21:32:25 -04:00
TSharedRef < UGSCore : : FModalTaskResult > Result = ExecuteModalTask (
2022-07-12 19:32:55 -04:00
FSlateApplication : : Get ( ) . GetActiveModalWindow ( ) ,
2022-07-08 15:08:49 -04:00
DetectSettings . ToSharedRef ( ) ,
LOCTEXT ( " OpeningProjectTitle " , " Opening Project " ) ,
LOCTEXT ( " OpeningProjectCaption " , " Opening project, please wait... " ) ) ;
2022-07-20 21:32:25 -04:00
2022-07-13 13:26:22 -04:00
if ( Result - > Failed ( ) )
2022-07-07 16:15:00 -04:00
{
FMessageDialog : : Open ( EAppMsgType : : Ok , Result - > GetMessage ( ) ) ;
2022-08-18 14:19:03 -04:00
return false ;
2022-07-07 16:15:00 -04:00
}
2022-07-07 13:34:35 -04:00
2022-07-20 21:32:25 -04:00
PerforceClient = DetectSettings - > PerforceClient ;
2022-07-08 15:08:49 -04:00
WorkspaceSettings = UserSettings - > FindOrAddWorkspace ( * DetectSettings - > BranchClientPath ) ;
2022-07-20 21:32:25 -04:00
ProjectSettings = UserSettings - > FindOrAddProject ( * DetectSettings - > NewSelectedClientFileName ) ;
2022-07-07 13:34:35 -04:00
// Check if the project we've got open in this workspace is the one we're actually synced to
int CurrentChangeNumber = - 1 ;
2022-07-13 13:26:22 -04:00
if ( WorkspaceSettings - > CurrentProjectIdentifier = = DetectSettings - > NewSelectedProjectIdentifier )
2022-07-07 13:34:35 -04:00
{
CurrentChangeNumber = WorkspaceSettings - > CurrentChangeNumber ;
}
2022-07-08 15:08:49 -04:00
FString ClientKey = DetectSettings - > BranchClientPath . Replace ( * FString : : Printf ( TEXT ( " //%s/ " ) , * PerforceClient - > ClientName ) , TEXT ( " " ) ) ;
2022-07-13 13:26:22 -04:00
if ( ClientKey . EndsWith ( TEXT ( " / " ) ) )
2022-07-07 13:34:35 -04:00
{
ClientKey = ClientKey . Left ( ClientKey . Len ( ) - 1 ) ;
}
2022-08-11 15:08:33 -04:00
FString DataFolder = FString ( FPlatformProcess : : UserSettingsDir ( ) ) / TEXT ( " UnrealGameSync " ) ;
2022-07-20 21:32:25 -04:00
FString ProjectLogBaseName = DataFolder / FString : : Printf ( TEXT ( " %s@%s " ) , * PerforceClient - > ClientName , * ClientKey . Replace ( TEXT ( " / " ) , TEXT ( " $ " ) ) ) ;
FString TelemetryProjectIdentifier = UGSCore : : FPerforceUtils : : GetClientOrDepotDirectoryName ( * DetectSettings - > NewSelectedProjectIdentifier ) ;
FString SelectedProjectIdentifier = DetectSettings - > NewSelectedProjectIdentifier ;
2022-07-07 13:34:35 -04:00
2022-07-07 17:55:05 -04:00
FString LogFileName = DataFolder / FPaths : : GetPath ( ProjectFileName ) + TEXT ( " .sync.log " ) ;
2022-07-18 15:26:50 -04:00
GameSyncTabView - > SetSyncLogLocation ( LogFileName ) ; // Todo: if SetSyncLogLocation fails, then it failed to create a log file and may need to handle that
GameSyncTabView - > GetSyncLog ( ) - > AppendLine ( TEXT ( " Creating log at: " ) + LogFileName ) ;
2022-08-19 10:29:29 -04:00
Log = MakeShared < FLogWidgetTextWriter > ( GameSyncTabView - > GetSyncLog ( ) . ToSharedRef ( ) ) ;
2022-07-07 17:55:05 -04:00
2022-07-20 21:32:25 -04:00
Workspace = MakeShared < UGSCore : : FWorkspace > (
2022-07-08 15:08:49 -04:00
PerforceClient . ToSharedRef ( ) ,
DetectSettings - > BranchDirectoryName ,
ProjectFileName ,
DetectSettings - > BranchClientPath ,
DetectSettings - > NewSelectedClientFileName ,
2022-07-19 15:04:35 -04:00
SelectedProjectIdentifier ,
2022-07-08 15:08:49 -04:00
CurrentChangeNumber ,
WorkspaceSettings - > LastBuiltChangeNumber ,
TelemetryProjectIdentifier ,
2022-08-19 10:29:29 -04:00
Log . ToSharedRef ( ) ) ;
2022-07-07 13:34:35 -04:00
2022-07-20 21:32:25 -04:00
Workspace - > OnUpdateComplete = [ this ] ( TSharedRef < UGSCore : : FWorkspaceUpdateContext , ESPMode : : ThreadSafe > WorkspaceContext , UGSCore : : EWorkspaceUpdateResult SyncResult , const FString & StatusMessage ) {
2022-07-12 11:58:47 -04:00
OnWorkspaceSyncComplete ( WorkspaceContext , SyncResult , StatusMessage ) ;
} ;
2022-07-20 21:32:25 -04:00
CombinedSyncFilter = UGSCore : : FUserSettings : : GetCombinedSyncFilter (
2022-07-08 15:08:49 -04:00
Workspace - > GetSyncCategories ( ) ,
UserSettings - > SyncView ,
UserSettings - > SyncExcludedCategories ,
WorkspaceSettings - > SyncView ,
WorkspaceSettings - > SyncExcludedCategories ) ;
2022-07-07 13:34:35 -04:00
2022-07-12 21:26:56 -04:00
// Setup our Perforce and Event monitoring threads
FString BranchClientPath = DetectSettings - > BranchDirectoryName ;
FString SelectedClientFileName = DetectSettings - > NewSelectedClientFileName ;
// TODO create callback functions that will be queued for the main thread to generate and update the main table view
2022-07-20 21:32:25 -04:00
PerforceMonitor = MakeShared < UGSCore : : FPerforceMonitor > ( PerforceClient . ToSharedRef ( ) , BranchClientPath , SelectedClientFileName , SelectedProjectIdentifier , ProjectLogBaseName + " .p4.log " ) ;
2022-07-13 13:19:32 -04:00
PerforceMonitor - > OnUpdate = [ this ] { QueueMessageForMainThread ( [ this ] { UpdateGameTabBuildList ( ) ; } ) ; } ;
2022-07-12 21:26:56 -04:00
2022-09-14 17:22:00 -04:00
//PerforceMonitor->OnUpdateMetadata = [this]{ QueueMessageForMainThread([this] { UpdateGameTabBuildList(); }); }; //MessageQueue.Add([this]{ UpdateBuildMetadata(); }); };
PerforceMonitor - > OnChangeTypeQueryFinished = [ this ] { QueueMessageForMainThread ( [ this ] { UpdateGameTabBuildList ( ) ; } ) ; } ;
2022-07-12 21:26:56 -04:00
PerforceMonitor - > OnStreamChange = [ this ] { printf ( " PerforceMonitor->OnStreamChange \n " ) ; } ; // MessageQueue.Add([this]{ Owner->StreamChanged(this); }); };
/* TODO figure out if this is even working, and if so how to correctly use this
2022-07-13 13:19:32 -04:00
*/
2022-07-12 21:26:56 -04:00
FString SqlConnectionString ;
2022-07-20 21:32:25 -04:00
EventMonitor = MakeShared < UGSCore : : FEventMonitor > ( SqlConnectionString , UGSCore : : FPerforceUtils : : GetClientOrDepotDirectoryName ( * SelectedProjectIdentifier ) , PerforceClient - > UserName , ProjectLogBaseName + " .review.log " ) ;
2022-07-12 21:26:56 -04:00
EventMonitor - > OnUpdatesReady = [ this ] { printf ( " EventMonitor->OnUpdatesReady \n " ) ; } ; //MessageQueue.Add([this]{ UpdateReviews(); }); };
// Start the threads
PerforceMonitor - > Start ( ) ;
2022-07-13 13:19:32 -04:00
EventMonitor - > Start ( ) ;
2022-08-18 14:19:03 -04:00
return true ;
2022-07-07 13:34:35 -04:00
}
2023-02-16 02:03:16 -05:00
# undef LOCTEXT_NAMESPACE