Files
UnrealEngineUWP/Engine/Source/Developer/OutputLog/Private/OutputLogStyle.cpp
lauren barnes 53488dc718 Updating CrashReportClient style to only use images from certain folders, and moving developer tool style setup to individual style classes.
#jira UE-152623
#rb Josh.Adams, Patrick.Boutot, Patrick.Laflamme, Louise.Rasmussen
#preflight 628d6c5faf7a2e956b8de990

#ROBOMERGE-OWNER: lauren.barnes
#ROBOMERGE-AUTHOR: lauren.barnes
#ROBOMERGE-SOURCE: CL 20366551 via CL 20368551 via CL 20369147 via CL 20369164
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20370889 by lauren barnes in ue5-main branch]
2022-05-25 16:27:45 -04:00

83 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "OutputLogStyle.h"
#include "Styling/SlateStyle.h"
#include "Styling/SlateStyleMacros.h"
#include "Styling/SlateTypes.h"
#include "../Public/OutputLogSettings.h"
#include "Styling/StyleColors.h"
#include "Styling/StarshipCoreStyle.h"
#include "Styling/SlateStyleRegistry.h"
#include "Styling/CoreStyle.h"
FName FOutputLogStyle::StyleName("OutputLogStyle");
TUniquePtr<FOutputLogStyle> FOutputLogStyle::Inst(nullptr);
const FName& FOutputLogStyle::GetStyleSetName() const
{
return StyleName;
}
const FOutputLogStyle& FOutputLogStyle::Get()
{
if (!Inst.IsValid())
{
Inst = TUniquePtr<FOutputLogStyle>(new FOutputLogStyle);
}
return *(Inst.Get());
}
void FOutputLogStyle::Shutdown()
{
Inst.Reset();
}
FOutputLogStyle::FOutputLogStyle()
: FSlateStyleSet(StyleName)
{
const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon20x20(20.0f, 20.0f);
SetParentStyleName(FAppStyle::GetAppStyleSetName());
SetContentRoot(FPaths::EngineContentDir() / TEXT("Slate"));
// Output Log Window
{
const UOutputLogSettings* Settings = GetDefault<UOutputLogSettings>();
const int32 LogFontSize = Settings ? Settings->LogFontSize : 9;
FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle<FTextBlockStyle>("NormalText");
const FTextBlockStyle NormalLogText = FTextBlockStyle(NormalText)
.SetFont(DEFAULT_FONT("Mono", LogFontSize))
.SetColorAndOpacity(FStyleColors::Foreground)
.SetSelectedBackgroundColor(FStyleColors::Highlight)
.SetHighlightColor(FStyleColors::Black);
Set("Log.Normal", NormalLogText);
Set("Log.Command", FTextBlockStyle(NormalLogText)
.SetColorAndOpacity(FStyleColors::AccentGreen)
);
Set("Log.Warning", FTextBlockStyle(NormalLogText)
.SetColorAndOpacity(FStyleColors::Warning)
);
Set("Log.Error", FTextBlockStyle(NormalLogText)
.SetColorAndOpacity(FStyleColors::Error)
);
Set("DebugConsole.Icon", new IMAGE_BRUSH_SVG("Starship/Common/Console", Icon16x16));
}
FSlateStyleRegistry::RegisterSlateStyle(*this);
}
FOutputLogStyle::~FOutputLogStyle()
{
FSlateStyleRegistry::UnRegisterSlateStyle(*this);
}