Skip to content

Commit

Permalink
Fix build UE version before 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SRombauts committed Jun 12, 2023
1 parent b815e2d commit 30039b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Source/GitSourceControl/GitSourceControl.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class GitSourceControl : ModuleRules
{
public GitSourceControl(ReadOnlyTargetRules Target) : base(Target)
{
IWYUSupport = IWYUSupport.Full;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PrivatePCHHeaderFile = "Private/GitSourceControlPrivatePCH.h";

Expand All @@ -23,7 +22,6 @@ public GitSourceControl(ReadOnlyTargetRules Target) : base(Target)
"DesktopWidgets",
"EditorStyle",
"UnrealEd",
//? "LevelEditor",
"SourceControl",
"Projects",
}
Expand Down
2 changes: 1 addition & 1 deletion Source/GitSourceControl/Private/GitSourceControlState.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class FGitSourceControlState : public ISourceControlState
virtual TSharedPtr<class ISourceControlRevision, ESPMode::ThreadSafe> FindHistoryRevision(int32 RevisionNumber) const override;
virtual TSharedPtr<class ISourceControlRevision, ESPMode::ThreadSafe> FindHistoryRevision(const FString& InRevision) const override;
virtual TSharedPtr<class ISourceControlRevision, ESPMode::ThreadSafe> GetBaseRevForMerge() const override;
virtual TSharedPtr<class ISourceControlRevision, ESPMode::ThreadSafe> GetCurrentRevision() const; /* override NOTE: added in UE5.2 */
#if ENGINE_MAJOR_VERSION == 5
virtual FSlateIcon GetIcon() const override;
#else
Expand Down Expand Up @@ -93,7 +94,6 @@ class FGitSourceControlState : public ISourceControlState
virtual bool CanDelete() const override;
virtual bool IsConflicted() const override;
virtual bool CanRevert() const override;
virtual TSharedPtr<ISourceControlRevision, ESPMode::ThreadSafe> GetCurrentRevision() const override;

public:
/** History of the item, if any */
Expand Down
28 changes: 25 additions & 3 deletions Source/GitSourceControl/Private/SGitSourceControlSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
#include "Widgets/Notifications/SNotificationList.h"
#include "Framework/Notifications/NotificationManager.h"
#include "EditorDirectories.h"
#include "Runtime/Launch/Resources/Version.h"
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
#include "Styling/AppStyle.h"
#else
#include "EditorStyleSet.h"
#endif
#include "SourceControlOperations.h"
#include "GitSourceControlModule.h"
#include "GitSourceControlUtils.h"
Expand All @@ -32,7 +37,11 @@

void SGitSourceControlSettings::Construct(const FArguments& InArgs)
{
const FSlateFontInfo Font = FAppStyle::Get().GetFontStyle(TEXT("SourceControl.LoginWindow.Font"));
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
const FSlateFontInfo Font = FAppStyle::GetFontStyle(TEXT("SourceControl.LoginWindow.Font"));
#else
const FSlateFontInfo Font = FEditorStyle::GetFontStyle(TEXT("SourceControl.LoginWindow.Font"));
#endif

bAutoCreateGitIgnore = true;
bAutoCreateReadme = true;
Expand All @@ -52,10 +61,12 @@ void SGitSourceControlSettings::Construct(const FArguments& InArgs)

ChildSlot
[
#if ENGINE_MAJOR_VERSION == 4
SNew(SBorder)
.BorderImage(FAppStyle::Get().GetBrush("DetailsView.CategoryBottom"))
.BorderImage(FEditorStyle::GetBrush("DetailsView.CategoryBottom"))
.Padding(FMargin(0.0f, 3.0f, 0.0f, 0.0f))
[
#endif
SNew(SVerticalBox)
// Path to the Git command line executable
+ SVerticalBox::Slot()
Expand All @@ -76,8 +87,13 @@ void SGitSourceControlSettings::Construct(const FArguments& InArgs)
.FillWidth(2.0f)
[
SNew(SFilePathPicker)
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
.BrowseButtonImage(FAppStyle::Get().GetBrush("PropertyWindow.Button_Ellipsis"))
.BrowseButtonStyle(FAppStyle::Get(), "HoverHintOnly")
#else
.BrowseButtonImage(FEditorStyle::GetBrush("PropertyWindow.Button_Ellipsis"))
.BrowseButtonStyle(FEditorStyle::Get(), "HoverHintOnly")
#endif
.BrowseDirectory(FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_OPEN))
.BrowseTitle(LOCTEXT("BinaryPathBrowseTitle", "File picker..."))
.FilePath(this, &SGitSourceControlSettings::GetBinaryPathString)
Expand Down Expand Up @@ -419,7 +435,9 @@ void SGitSourceControlSettings::Construct(const FArguments& InArgs)
.ContentPadding(6)
]
]
#if ENGINE_MAJOR_VERSION == 4
]
#endif
];
}

Expand Down Expand Up @@ -673,7 +691,11 @@ void SGitSourceControlSettings::DisplaySuccessNotification(const FSourceControlO
const FText NotificationText = FText::Format(LOCTEXT("InitialCommit_Success", "{0} operation was successfull!"), FText::FromName(InOperation->GetName()));
FNotificationInfo Info(NotificationText);
Info.bUseSuccessFailIcons = true;
Info.Image = FAppStyle::Get().GetBrush(TEXT("NotificationList.SuccessImage"));
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
Info.Image = FAppStyle::GetBrush(TEXT("NotificationList.SuccessImage"));
#else
Info.Image = FEditorStyle::GetBrush(TEXT("NotificationList.SuccessImage"));
#endif
FSlateNotificationManager::Get().AddNotification(Info);
}

Expand Down

0 comments on commit 30039b3

Please sign in to comment.