SourceControl: Added cvar to force the modal dialog to always show up as a modal dialog, ignoring the preference of the calling code.

#preflight 64102f84c41a0a2a77063d17

[CL 24633200 by wouter burgers in ue5-main branch]
This commit is contained in:
wouter burgers
2023-03-14 07:39:31 -04:00
parent b2e46520d6
commit ddaa200319
3 changed files with 18 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#include "SourceControlHelpers.h"
#include "SourceControlAssetDataCache.h"
#include "SourceControlFileStatusMonitor.h"
#include "SourceControlCVars.h"
#include "Misc/Paths.h"
#if SOURCE_CONTROL_WITH_SLATE
@@ -109,8 +110,15 @@ void FSourceControlModule::ShowLoginDialog(const FSourceControlLoginClosed& InOn
// Get Active Provider Name
ActiveProviderName = GetProvider().GetName().ToString();
// if we are forcing a modal dialog, change the preference now
ELoginWindowMode::Type LoginWindowMode = InLoginWindowMode;
if(SourceControlCVars::CVarSourceControlEnableLoginDialogModal.GetValueOnAnyThread())
{
LoginWindowMode = ELoginWindowMode::Modal;
}
// if we are showing a modal version of the dialog & a modeless version already exists, we must destroy the modeless dialog first
if(InLoginWindowMode == ELoginWindowMode::Modal && SourceControlLoginPtr.IsValid())
if(LoginWindowMode == ELoginWindowMode::Modal && SourceControlLoginPtr.IsValid())
{
// unhook the delegate so it doesn't fire in this case
SourceControlLoginWindowPtr->SetOnWindowClosed(FOnWindowClosed());
@@ -157,7 +165,7 @@ void FSourceControlModule::ShowLoginDialog(const FSourceControlLoginClosed& InOn
TSharedPtr<SWindow> RootWindow = FGlobalTabmanager::Get()->GetRootWindow();
if(RootWindow.IsValid())
{
if(InLoginWindowMode == ELoginWindowMode::Modal)
if(LoginWindowMode == ELoginWindowMode::Modal)
{
FSlateApplication::Get().AddModalWindow(SourceControlLoginWindowPtr.ToSharedRef(), RootWindow);
}
@@ -168,7 +176,7 @@ void FSourceControlModule::ShowLoginDialog(const FSourceControlLoginClosed& InOn
}
else
{
if(InLoginWindowMode == ELoginWindowMode::Modal)
if(LoginWindowMode == ELoginWindowMode::Modal)
{
FSlateApplication::Get().AddModalWindow(SourceControlLoginWindowPtr.ToSharedRef(), RootWindow);
}