2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "DeviceManagerPrivatePCH.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
|
2014-10-09 12:34:55 -04:00
|
|
|
#include "WorkspaceMenuStructureModule.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
#include "SDockTab.h"
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
static const FName DeviceManagerTabName("DeviceManager");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the DeviceManager module.
|
|
|
|
|
*/
|
|
|
|
|
class FDeviceManagerModule
|
|
|
|
|
: public IDeviceManagerModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// IModuleInterface interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual void StartupModule( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// @todo gmp: implement an IoC container
|
|
|
|
|
ITargetDeviceServicesModule& TargetDeviceServicesModule = FModuleManager::LoadModuleChecked<ITargetDeviceServicesModule>(TEXT("TargetDeviceServices"));
|
|
|
|
|
|
|
|
|
|
TargetDeviceServiceManager = TargetDeviceServicesModule.GetDeviceServiceManager();
|
|
|
|
|
|
2014-10-09 12:34:55 -04:00
|
|
|
auto& TabSpawnerEntry = FGlobalTabmanager::Get()->RegisterNomadTabSpawner(DeviceManagerTabName, FOnSpawnTab::CreateRaw(this, &FDeviceManagerModule::SpawnDeviceManagerTab))
|
2014-03-14 14:13:41 -04:00
|
|
|
.SetDisplayName(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTabTitle", "Device Manager"))
|
2014-10-09 12:34:55 -04:00
|
|
|
.SetTooltipText(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTooltipText", "View and manage connected devices."))
|
2014-03-14 14:13:41 -04:00
|
|
|
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "DeviceDetails.TabIcon"));
|
2014-10-09 12:34:55 -04:00
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
TabSpawnerEntry.SetGroup(WorkspaceMenu::GetMenuStructure().GetDeveloperToolsMiscCategory());
|
|
|
|
|
#else
|
|
|
|
|
TabSpawnerEntry.SetGroup(WorkspaceMenu::GetMenuStructure().GetToolsCategory());
|
|
|
|
|
#endif
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual void ShutdownModule( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-10-09 12:34:55 -04:00
|
|
|
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(DeviceManagerTabName);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// IDeviceManagerModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual TSharedRef<SWidget> CreateDeviceManager( const ITargetDeviceServiceManagerRef& DeviceServiceManager, const TSharedRef<SDockTab>& ConstructUnderMajorTab, const TSharedPtr<SWindow>& ConstructUnderWindow ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return SNew(SDeviceManager, DeviceServiceManager, ConstructUnderMajorTab, ConstructUnderWindow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new device manager tab.
|
|
|
|
|
*
|
2014-06-12 23:22:18 -04:00
|
|
|
* @param SpawnTabArgs The arguments for the tab to spawn.
|
2014-03-14 14:13:41 -04:00
|
|
|
* @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
|
|
|
|
|
ITargetDeviceServiceManagerPtr TargetDeviceServiceManager;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FDeviceManagerModule, DeviceManager);
|