You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#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]
97 lines
3.1 KiB
C++
97 lines
3.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "CoreTypes.h"
|
|
#include "Styling/AppStyle.h"
|
|
#include "Framework/Docking/TabManager.h"
|
|
#include "IDeviceManagerModule.h"
|
|
#include "ITargetDeviceServicesModule.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "Templates/SharedPointer.h"
|
|
#include "Textures/SlateIcon.h"
|
|
#include "Widgets/DeclarativeSyntaxSupport.h"
|
|
#include "Widgets/SDeviceManager.h"
|
|
#include "Widgets/SWidget.h"
|
|
#include "Widgets/Docking/SDockTab.h"
|
|
#include "WorkspaceMenuStructure.h"
|
|
#include "WorkspaceMenuStructureModule.h"
|
|
|
|
|
|
static const FName DeviceManagerTabName("DeviceManager");
|
|
|
|
|
|
/**
|
|
* Implements the DeviceManager module.
|
|
*/
|
|
class FDeviceManagerModule
|
|
: public IDeviceManagerModule
|
|
{
|
|
public:
|
|
|
|
//~ IModuleInterface interface
|
|
|
|
virtual void StartupModule() override
|
|
{
|
|
// @todo gmp: implement an IoC container
|
|
ITargetDeviceServicesModule& TargetDeviceServicesModule = FModuleManager::LoadModuleChecked<ITargetDeviceServicesModule>(TEXT("TargetDeviceServices"));
|
|
|
|
TargetDeviceServiceManager = TargetDeviceServicesModule.GetDeviceServiceManager();
|
|
|
|
auto& TabSpawnerEntry = FGlobalTabmanager::Get()->RegisterNomadTabSpawner(DeviceManagerTabName, FOnSpawnTab::CreateRaw(this, &FDeviceManagerModule::SpawnDeviceManagerTab))
|
|
.SetDisplayName(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTabTitle", "Device Manager"))
|
|
.SetTooltipText(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTooltipText", "View and manage connected devices."))
|
|
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "DeviceDetails.TabIcon"));
|
|
|
|
#if WITH_EDITOR
|
|
TabSpawnerEntry.SetGroup(WorkspaceMenu::GetMenuStructure().GetDeveloperToolsPlatformsCategory());
|
|
#else
|
|
TabSpawnerEntry.SetGroup(WorkspaceMenu::GetMenuStructure().GetToolsCategory());
|
|
#endif
|
|
}
|
|
|
|
virtual void ShutdownModule() override
|
|
{
|
|
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(DeviceManagerTabName);
|
|
}
|
|
|
|
public:
|
|
|
|
//~ IDeviceManagerModule interface
|
|
|
|
virtual TSharedRef<SWidget> CreateDeviceManager(const TSharedRef<ITargetDeviceServiceManager>& DeviceServiceManager, const TSharedRef<SDockTab>& ConstructUnderMajorTab, const TSharedPtr<SWindow>& ConstructUnderWindow) override
|
|
{
|
|
return SNew(SDeviceManager, DeviceServiceManager, ConstructUnderMajorTab, ConstructUnderWindow);
|
|
}
|
|
|
|
private:
|
|
|
|
/**
|
|
* Creates a new device manager tab.
|
|
*
|
|
* @param SpawnTabArgs The arguments for the tab to spawn.
|
|
* @return The spawned tab.
|
|
*/
|
|
TSharedRef<SDockTab> SpawnDeviceManagerTab(const FSpawnTabArgs& SpawnTabArgs)
|
|
{
|
|
const TSharedRef<SDockTab> DockTab = SNew(SDockTab)
|
|
.TabRole(ETabRole::MajorTab);
|
|
|
|
DockTab->SetContent(CreateDeviceManager(TargetDeviceServiceManager.ToSharedRef(), DockTab, SpawnTabArgs.GetOwnerWindow()));
|
|
|
|
return DockTab;
|
|
}
|
|
|
|
private:
|
|
|
|
// @todo gmp: implement an IoC container
|
|
TSharedPtr<ITargetDeviceServiceManager> TargetDeviceServiceManager;
|
|
|
|
// default widget creator for platforms that don't specify their own
|
|
TSharedPtr<IDeviceManagerCustomPlatformWidgetCreator> DefaultWidgetCreator;
|
|
|
|
// custom widget creators
|
|
TMap<FString, TSharedPtr<IDeviceManagerCustomPlatformWidgetCreator>> CustomWidgetCreators;
|
|
};
|
|
|
|
|
|
IMPLEMENT_MODULE(FDeviceManagerModule, DeviceManager);
|