Files
Lauren Barnes 6248f8d412 Replacing legacy EditorStyle calls with AppStyle
#preflight 6272a74d2f6d177be3c6fdda
#rb Matt.Kuhlenschmidt

#ROBOMERGE-OWNER: Lauren.Barnes
#ROBOMERGE-AUTHOR: lauren.barnes
#ROBOMERGE-SOURCE: CL 20057269 via CL 20070159 via CL 20072035 via CL 20072203
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)
#ROBOMERGE-CONFLICT from-shelf

[CL 20105363 by Lauren Barnes in ue5-main branch]
2022-05-09 13:12:28 -04:00

79 lines
2.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ILauncherServicesModule.h"
#include "IProjectLauncherModule.h"
#include "ITargetDeviceServicesModule.h"
#include "Modules/ModuleManager.h"
#include "WorkspaceMenuStructure.h"
#include "WorkspaceMenuStructureModule.h"
#include "Styling/AppStyle.h"
#include "Framework/Docking/TabManager.h"
#include "Textures/SlateIcon.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/Docking/SDockTab.h"
#include "Models/ProjectLauncherModel.h"
#include "Widgets/SProjectLauncher.h"
static const FName ProjectLauncherTabName("ProjectLauncher");
/**
* Implements the SessionSProjectLauncher module.
*/
class FProjectLauncherModule
: public IProjectLauncherModule
{
public:
//~ IModuleInterface interface
virtual void StartupModule() override
{
// This is still experimental in the editor, so it'll be invoked specifically in FMainMenu if the experimental settings flag is set.
//@todo Enable this in the editor when no longer experimental
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(ProjectLauncherTabName, FOnSpawnTab::CreateRaw(this, &FProjectLauncherModule::SpawnProjectLauncherTab))
.SetDisplayName(NSLOCTEXT("FProjectLauncherModule", "ProjectLauncherTabTitle", "Project Launcher"))
.SetTooltipText(NSLOCTEXT("FProjectLauncherModule", "ProjectLauncherTooltipText", "Open the Project Launcher tab."))
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "Launcher.TabIcon"))
.SetGroup(WorkspaceMenu::GetMenuStructure().GetToolsCategory());
}
virtual void ShutdownModule() override
{
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(ProjectLauncherTabName);
}
private:
/**
* Creates a new session launcher tab.
*
* @param SpawnTabArgs The arguments for the tab to spawn.
* @return The spawned tab.
*/
TSharedRef<SDockTab> SpawnProjectLauncherTab(const FSpawnTabArgs& SpawnTabArgs)
{
const TSharedRef<SDockTab> DockTab = SNew(SDockTab)
.TabRole(ETabRole::NomadTab);
ILauncherServicesModule& ProjectLauncherServicesModule = FModuleManager::LoadModuleChecked<ILauncherServicesModule>("LauncherServices");
ITargetDeviceServicesModule& TargetDeviceServicesModule = FModuleManager::LoadModuleChecked<ITargetDeviceServicesModule>("TargetDeviceServices");
TSharedRef<FProjectLauncherModel> Model = MakeShareable(new FProjectLauncherModel(
TargetDeviceServicesModule.GetDeviceProxyManager(),
ProjectLauncherServicesModule.CreateLauncher(),
ProjectLauncherServicesModule.GetProfileManager()
));
DockTab->SetContent(SNew(SProjectLauncher, DockTab, SpawnTabArgs.GetOwnerWindow(), Model));
return DockTab;
}
};
IMPLEMENT_MODULE(FProjectLauncherModule, ProjectLauncher);