You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Luc.Eygasier, Sebastien.Lussier #rnx #preflight 622895d331133a23da78a4ca ### Misc - FPerforceSourceControlRevision, FPerforceConnection and FPerforceSourceControlLabel now own a reference to their FPerforceSourceControlProvider and accesses the connection settings from that rather than via the module singleton. - FPerforceSourceControlCommand now accesses the connection settings by finding the FPerforceSourceControlProvider that the given IPerforceSourceControlWorker references. - FPerforceSourceControlProvider now owns it's own FPerforceSourceControlSettings rather than accessing a shared one owned by the module. - Marked a number of derived classes as final. ### FPerforceConnection - ::EnsureValidConnection can now work without a valid client (although most commands will require a client to run, things like p4 print does not). -- Due to this change we might not catch cases where the the system cannot connect to source control as the user is not logged in as this would get caught when we checked the workspace by calling ::TestConnection. -- To get around this ::EnsureValidConnection will now call "p4 login -s" via the newly added TestLoginConnection. - Renamed ::TestConnection to ::TestClientConnection as we are really testing the connection to the specified workspace. - There does seem to be some inconsistency in the logging, depending how a perforce source control provider first creates its connection as in some cases FPerforceConnection::EnsureValidConnection gets called first and in other cases FPerforceConnection::EstablishConnection is called. We should unify these paths but this change list is already so large I am opting to postpone this to it's own work item. ### FPerforceSourceControlModule - Removed all of the singleton style accessors so that classes inside of the module can no longer assume that there is only one FPerforceSourceControlProvider. Updated the documentation to match. - Since there is no reason for classes in the module to need to access FPerforceSourceControlModule, ::Get has been removed - The responsibility to register all of the worker creation delegates has been moved to IPerforceSourceControlWorker so that all source control providers can share them. - ::GetProvider has been removed, if a class inside the module needs access to a provider then a reference to it's provider will be given to it at construction time. - ::SetLastError, ::AccessSettings and ::SaveSettings are now called directly on FPerforceSourceControlSettings ### FPerforceSourceControlSettings - This class now takes the name of the system that owns it as a parameter in the constructor -- The name will be used to identify where to store the settings in the config file, unless the name is blank in which case the pre-existing default location will be used. - This will allow for multiple source control providers to store their connection info. ### SPerforceSourceControlSettings - Moved FGetWorkspaces from SPerforceSourceControlSettings.h to its own header file to reduce the number of places that need to include the slate headers. - Move the fwd declares to the top of the header base don recent coding standards discussions. - Instead of accessing the source control provider via FPerforceSourceControlModule the dialog is now given a pointer to one when constructed. -- This pointer is assumed to always be valid and should be a reference if the slate system supported it. ### PerforceSourceControlOperations - IPerforceSourceControlWorker now takes a reference to the owning FPerforceSourceControlProvider in it's constructor. All derived workers have been updated to this. - Moved the registering of worker creation delegates from the module cpp to a new static method IPerforceSourceControlWorker::RegisterWorkers -- This should make it easier to find when adding a new worker and allows source control providers to share the same map of delegates rather than duplicating it. -- This means we also need a new static method IPerforceSourceControlWorker::CreateWorker for instantiating new workers based on the given name. ### FSourceControlInitSettings - This is a new class that is used to set up a newly created source control provider. - The settings are expected to be given in the same way you would override settings via the cmdline. The existing perforce cmdline code has been updated to use this class. - This still has the downside that the calling code needs to know the type of source control provider, but I don't really see a good way around this unless we refactor the entire API to be feature based. [CL 19318801 by paul chipchase in ue5-main branch]
156 lines
6.4 KiB
C++
156 lines
6.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
/**
|
|
* Interface for talking to source control clients
|
|
*/
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "ISourceControlModule.h"
|
|
#include "SourceControlAssetDataCache.h"
|
|
#include "SourceControlSettings.h"
|
|
#include "DefaultSourceControlProvider.h"
|
|
|
|
class SSourceControlLogin;
|
|
class SWindow;
|
|
|
|
class FSourceControlModule : public ISourceControlModule
|
|
{
|
|
public:
|
|
FSourceControlModule();
|
|
|
|
/** IModuleInterface implementation */
|
|
virtual void StartupModule() override;
|
|
virtual void ShutdownModule() override;
|
|
|
|
/** ISourceControlModule implementation */
|
|
virtual void GetProviderNames(TArray<FName>& OutProviderNames) override;
|
|
virtual void Tick() override;
|
|
virtual void QueueStatusUpdate(const TArray<UPackage*>& InPackages) override;
|
|
virtual void QueueStatusUpdate(const TArray<FString>& InFilenames) override;
|
|
virtual void QueueStatusUpdate(UPackage* InPackage) override;
|
|
virtual void QueueStatusUpdate(const FString& InFilename) override;
|
|
virtual bool IsEnabled() const override;
|
|
virtual ISourceControlProvider& GetProvider() const override;
|
|
virtual TUniquePtr<ISourceControlProvider> CreateProvider(const FName& ProviderName, const FStringView& OwnerName, const FSourceControlInitSettings& InitialSettings) const override;
|
|
virtual FSourceControlAssetDataCache& GetAssetDataCache() override;
|
|
virtual void SetProvider( const FName& InName ) override;
|
|
virtual void ShowLoginDialog(const FSourceControlLoginClosed& InOnSourceControlLoginClosed, ELoginWindowMode::Type InLoginWindowMode, EOnLoginWindowStartup::Type InOnLoginWindowStartup = EOnLoginWindowStartup::ResetProviderToNone) override;
|
|
virtual bool GetUseGlobalSettings() const override;
|
|
virtual void SetUseGlobalSettings(bool bIsUseGlobalSettings) override;
|
|
virtual FDelegateHandle RegisterProviderChanged(const FSourceControlProviderChanged::FDelegate& SourceControlProviderChanged) override;
|
|
virtual void UnregisterProviderChanged(FDelegateHandle Handle) override;
|
|
virtual void RegisterPreSubmitDataValidation(const FSourceControlPreSubmitDataValidationDelegate& PreSubmitDataValidationDelegate) override;
|
|
virtual void UnregisterPreSubmitDataValidation() override;
|
|
virtual FSourceControlPreSubmitDataValidationDelegate GetRegisteredPreSubmitDataValidation() override;
|
|
|
|
virtual FDelegateHandle RegisterPreSubmitFinalize(const FSourceControlPreSubmitFinalizeDelegate::FDelegate& Delegate) override;
|
|
virtual void UnregisterPreSubmitFinalize(FDelegateHandle Handle) override;
|
|
virtual const FSourceControlPreSubmitFinalizeDelegate& GetOnPreSubmitFinalize() const override;
|
|
|
|
virtual FDelegateHandle RegisterFilesDeleted(const FSourceControlFilesDeletedDelegate::FDelegate& InDelegate) override;
|
|
virtual void UnregisterFilesDeleted(FDelegateHandle InHandle) override;
|
|
virtual const FSourceControlFilesDeletedDelegate& GetOnFilesDeleted() const override;
|
|
|
|
virtual void RegisterSourceControlProjectDirDelegate(const FSourceControlProjectDirDelegate& SourceControlProjectDirDelegate) override;
|
|
virtual void UnregisterSourceControlProjectDirDelegate() override;
|
|
virtual FString GetSourceControlProjectDir() const override;
|
|
|
|
/** Save the settings to the ini file */
|
|
void SaveSettings();
|
|
|
|
/**
|
|
* Get the number of currently registered source control providers.
|
|
*/
|
|
int32 GetNumSourceControlProviders();
|
|
|
|
/**
|
|
* Set the current source control provider by index.
|
|
*/
|
|
void SetCurrentSourceControlProvider(int32 ProviderIndex);
|
|
|
|
/**
|
|
* Get the name of the source control provider at the specified index.
|
|
*/
|
|
FName GetSourceControlProviderName(int32 ProviderIndex);
|
|
|
|
/**
|
|
* Get the one and only login widget, if any.
|
|
*/
|
|
TSharedPtr<class SSourceControlLogin> GetLoginWidget() const;
|
|
|
|
/**
|
|
* Gets a reference to the source control module instance.
|
|
*
|
|
* @return A reference to the source control module.
|
|
*/
|
|
static FSourceControlModule& Get()
|
|
{
|
|
return FModuleManager::LoadModuleChecked<FSourceControlModule>("SourceControl");
|
|
}
|
|
|
|
private:
|
|
/** Refresh & initialize the current source control provider */
|
|
void InitializeSourceControlProviders();
|
|
|
|
/** Close the current source control provider & set the current to default - 'None' */
|
|
void ClearCurrentSourceControlProvider();
|
|
|
|
/** Set the current source control provider to the passed-in value */
|
|
void SetCurrentSourceControlProvider(ISourceControlProvider& InProvider);
|
|
|
|
/** Delegate called when the source control window is closed */
|
|
void OnSourceControlDialogClosed(const TSharedRef<class SWindow>& InWindow);
|
|
|
|
/** Delegate handling when source control features are registered */
|
|
void HandleModularFeatureRegistered(const FName& Type, IModularFeature* ModularFeature);
|
|
|
|
/** Delegate handling when source control features are unregistered */
|
|
void HandleModularFeatureUnregistered(const FName& Type, IModularFeature* ModularFeature);
|
|
|
|
private:
|
|
/** The settings object */
|
|
FSourceControlSettings SourceControlSettings;
|
|
|
|
/** Current source control provider */
|
|
ISourceControlProvider* CurrentSourceControlProvider;
|
|
|
|
/** Source control provider we use if there are none registered */
|
|
FDefaultSourceControlProvider DefaultSourceControlProvider;
|
|
|
|
/** The login window we may be using */
|
|
TSharedPtr<SWindow> SourceControlLoginWindowPtr;
|
|
|
|
/** The login window control we may be using */
|
|
TSharedPtr<class SSourceControlLogin> SourceControlLoginPtr;
|
|
|
|
/** Files pending a status update */
|
|
TArray<FString> PendingStatusUpdateFiles;
|
|
|
|
/** Flag to disable source control - used temporarily when login is in progress */
|
|
bool bTemporarilyDisabled;
|
|
|
|
/** Active Provider name to track source control provider changes */
|
|
FString ActiveProviderName;
|
|
|
|
/** For notifying when the source provider is changed */
|
|
FSourceControlProviderChanged OnSourceControlProviderChanged;
|
|
|
|
/** To call when doing pre-submit data validation */
|
|
FSourceControlPreSubmitDataValidationDelegate OnSourceControlPreSubmitDataValidation;
|
|
|
|
/** To be called right before files are submitted, allowing for additional last minute validation. @see FSourceControlPreSubmitFinalizeDelegate */
|
|
FSourceControlPreSubmitFinalizeDelegate OnPresubmitFinalize;
|
|
|
|
/** To be called after a source control operations deleted files */
|
|
FSourceControlFilesDeletedDelegate OnFilesDeleted;
|
|
|
|
/** Used to cache source controlled AssetData information */
|
|
FSourceControlAssetDataCache AssetDataCache;
|
|
|
|
/** Delegate used to return the current project base directory */
|
|
FSourceControlProjectDirDelegate SourceControlProjectDirDelegate;
|
|
};
|