You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
216 lines
6.4 KiB
C++
216 lines
6.4 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DetailCustomizationsPrivatePCH.h"
|
|
#include "MacTargetSettingsDetails.h"
|
|
#include "TargetPlatform.h"
|
|
#include "SExternalImageReference.h"
|
|
#include "IExternalImagePickerModule.h"
|
|
#include "GameProjectGenerationModule.h"
|
|
#include "ISourceControlModule.h"
|
|
|
|
namespace MacTargetSettingsDetailsConstants
|
|
{
|
|
/** The filename for the game splash screen */
|
|
const FString GameSplashFileName(TEXT("Splash/Splash.bmp"));
|
|
|
|
/** The filename for the editor splash screen */
|
|
const FString EditorSplashFileName(TEXT("Splash/EdSplash.bmp"));
|
|
}
|
|
|
|
#define LOCTEXT_NAMESPACE "MacTargetSettingsDetails"
|
|
|
|
TSharedRef<IDetailCustomization> FMacTargetSettingsDetails::MakeInstance()
|
|
{
|
|
return MakeShareable(new FMacTargetSettingsDetails);
|
|
}
|
|
|
|
namespace EMacImageScope
|
|
{
|
|
enum Type
|
|
{
|
|
Engine,
|
|
GameOverride
|
|
};
|
|
}
|
|
|
|
/* Helper function used to generate filenames for splash screens */
|
|
static FString GetSplashFilename(EMacImageScope::Type Scope, bool bIsEditorSplash)
|
|
{
|
|
FString Filename;
|
|
|
|
if (Scope == EMacImageScope::Engine)
|
|
{
|
|
Filename = FPaths::EngineContentDir();
|
|
}
|
|
else
|
|
{
|
|
Filename = FPaths::GameContentDir();
|
|
}
|
|
|
|
if(bIsEditorSplash)
|
|
{
|
|
Filename /= MacTargetSettingsDetailsConstants::EditorSplashFileName;
|
|
}
|
|
else
|
|
{
|
|
Filename /= MacTargetSettingsDetailsConstants::GameSplashFileName;
|
|
}
|
|
|
|
Filename = FPaths::ConvertRelativePathToFull(Filename);
|
|
|
|
return Filename;
|
|
}
|
|
|
|
/* Helper function used to generate filenames for icons */
|
|
static FString GetIconFilename(EMacImageScope::Type Scope)
|
|
{
|
|
const FString& PlatformName = FModuleManager::GetModuleChecked<ITargetPlatformModule>("MacTargetPlatform").GetTargetPlatform()->PlatformName();
|
|
|
|
if (Scope == EMacImageScope::Engine)
|
|
{
|
|
FString Filename = FPaths::EngineDir() / FString(TEXT("Source/Runtime/Launch/Resources")) / PlatformName / FString("UE4.icns");
|
|
return FPaths::ConvertRelativePathToFull(Filename);
|
|
}
|
|
else
|
|
{
|
|
FString Filename = FPaths::GameDir() / TEXT("Build/Mac/Application.icns");
|
|
if(!FPaths::FileExists(Filename))
|
|
{
|
|
FString LegacyFilename = FPaths::GameSourceDir() / FString(FApp::GetGameName()) / FString(TEXT("Resources")) / PlatformName / FString(FApp::GetGameName()) + TEXT(".icns");
|
|
if(FPaths::FileExists(LegacyFilename))
|
|
{
|
|
Filename = LegacyFilename;
|
|
}
|
|
}
|
|
return FPaths::ConvertRelativePathToFull(Filename);
|
|
}
|
|
}
|
|
|
|
void FMacTargetSettingsDetails::CustomizeDetails( IDetailLayoutBuilder& DetailBuilder )
|
|
{
|
|
// Add the splash image customization
|
|
const FText EditorSplashDesc(LOCTEXT("EditorSplashLabel", "Editor Splash"));
|
|
IDetailCategoryBuilder& SplashCategoryBuilder = DetailBuilder.EditCategory(TEXT("Splash"));
|
|
FDetailWidgetRow& EditorSplashWidgetRow = SplashCategoryBuilder.AddCustomRow(EditorSplashDesc);
|
|
|
|
const FString EditorSplash_TargetImagePath = GetSplashFilename(EMacImageScope::GameOverride, true);
|
|
const FString EditorSplash_DefaultImagePath = GetSplashFilename(EMacImageScope::Engine, true);
|
|
|
|
EditorSplashWidgetRow
|
|
.NameContent()
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.Padding( FMargin( 0, 1, 0, 1 ) )
|
|
.FillWidth(1.0f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(EditorSplashDesc)
|
|
.Font(DetailBuilder.GetDetailFont())
|
|
]
|
|
]
|
|
.ValueContent()
|
|
.MaxDesiredWidth(500.0f)
|
|
.MinDesiredWidth(100.0f)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.FillWidth(1.0f)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SNew(SExternalImageReference, EditorSplash_DefaultImagePath, EditorSplash_TargetImagePath)
|
|
.FileDescription(EditorSplashDesc)
|
|
.OnGetPickerPath(FOnGetPickerPath::CreateSP(this, &FMacTargetSettingsDetails::GetPickerPath))
|
|
.OnPostExternalImageCopy(FOnPostExternalImageCopy::CreateSP(this, &FMacTargetSettingsDetails::HandlePostExternalIconCopy))
|
|
]
|
|
];
|
|
|
|
const FText GameSplashDesc(LOCTEXT("GameSplashLabel", "Game Splash"));
|
|
FDetailWidgetRow& GameSplashWidgetRow = SplashCategoryBuilder.AddCustomRow(GameSplashDesc);
|
|
|
|
const FString GameSplash_TargetImagePath = GetSplashFilename(EMacImageScope::GameOverride, false);
|
|
const FString GameSplash_DefaultImagePath = GetSplashFilename(EMacImageScope::Engine, false);
|
|
|
|
GameSplashWidgetRow
|
|
.NameContent()
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.Padding( FMargin( 0, 1, 0, 1 ) )
|
|
.FillWidth(1.0f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(GameSplashDesc)
|
|
.Font(DetailBuilder.GetDetailFont())
|
|
]
|
|
]
|
|
.ValueContent()
|
|
.MaxDesiredWidth(500.0f)
|
|
.MinDesiredWidth(100.0f)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.FillWidth(1.0f)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SNew(SExternalImageReference, GameSplash_DefaultImagePath, GameSplash_TargetImagePath)
|
|
.FileDescription(GameSplashDesc)
|
|
.OnGetPickerPath(FOnGetPickerPath::CreateSP(this, &FMacTargetSettingsDetails::GetPickerPath))
|
|
.OnPostExternalImageCopy(FOnPostExternalImageCopy::CreateSP(this, &FMacTargetSettingsDetails::HandlePostExternalIconCopy))
|
|
]
|
|
];
|
|
|
|
IDetailCategoryBuilder& IconsCategoryBuilder = DetailBuilder.EditCategory(TEXT("Icon"));
|
|
FDetailWidgetRow& GameIconWidgetRow = IconsCategoryBuilder.AddCustomRow(LOCTEXT("GameIconLabel", "Game Icon"));
|
|
GameIconWidgetRow
|
|
.NameContent()
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.Padding( FMargin( 0, 1, 0, 1 ) )
|
|
.FillWidth(1.0f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(LOCTEXT("GameIconLabel", "Game Icon"))
|
|
.Font(DetailBuilder.GetDetailFont())
|
|
]
|
|
]
|
|
.ValueContent()
|
|
.MaxDesiredWidth(500.0f)
|
|
.MinDesiredWidth(100.0f)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.FillWidth(1.0f)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SNew(SExternalImageReference, GetIconFilename(EMacImageScope::Engine), GetIconFilename(EMacImageScope::GameOverride))
|
|
.FileDescription(GameSplashDesc)
|
|
.OnPreExternalImageCopy(FOnPreExternalImageCopy::CreateSP(this, &FMacTargetSettingsDetails::HandlePreExternalIconCopy))
|
|
.OnGetPickerPath(FOnGetPickerPath::CreateSP(this, &FMacTargetSettingsDetails::GetPickerPath))
|
|
.OnPostExternalImageCopy(FOnPostExternalImageCopy::CreateSP(this, &FMacTargetSettingsDetails::HandlePostExternalIconCopy))
|
|
]
|
|
];
|
|
}
|
|
|
|
|
|
bool FMacTargetSettingsDetails::HandlePreExternalIconCopy(const FString& InChosenImage)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
|
|
FString FMacTargetSettingsDetails::GetPickerPath()
|
|
{
|
|
return FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_OPEN);
|
|
}
|
|
|
|
|
|
bool FMacTargetSettingsDetails::HandlePostExternalIconCopy(const FString& InChosenImage)
|
|
{
|
|
FEditorDirectories::Get().SetLastDirectory(ELastDirectory::GENERIC_OPEN, FPaths::GetPath(InChosenImage));
|
|
return true;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|