2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "SessionLauncherPrivatePCH.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const FName SessionLauncherTabName("SessionLauncher");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements the SessionLauncher module.
|
|
|
|
|
*/
|
|
|
|
|
class FSessionLauncherModule
|
|
|
|
|
: public ISessionLauncherModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
// ISessionLauncherModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual TSharedRef<class SWidget> CreateLauncherProgressPanel( const ILauncherWorkerRef& LauncherWorker ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
TSharedRef<SSessionLauncherProgress> Panel = SNew(SSessionLauncherProgress);
|
|
|
|
|
|
|
|
|
|
Panel->SetLauncherWorker(LauncherWorker);
|
|
|
|
|
|
|
|
|
|
return Panel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->RegisterTabSpawner(SessionLauncherTabName, FOnSpawnTab::CreateRaw(this, &FSessionLauncherModule::SpawnSessionLauncherTab))
|
|
|
|
|
.SetDisplayName(NSLOCTEXT("FSessionLauncherModule", "LauncherTabTitle", "Game Launcher"))
|
|
|
|
|
.SetTooltipText(NSLOCTEXT("FSessionLauncherModule", "LauncherTooltipText", "Open the Game Launcher tab."))
|
|
|
|
|
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "SessionLauncher.TabIcon"));
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-12 23:22:18 -04:00
|
|
|
virtual void ShutdownModule( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->UnregisterTabSpawner(SessionLauncherTabName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new session launcher 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> SpawnSessionLauncherTab( const FSpawnTabArgs& SpawnTabArgs )
|
|
|
|
|
{
|
|
|
|
|
const TSharedRef<SDockTab> DockTab = SNew(SDockTab)
|
|
|
|
|
.Icon(FEditorStyle::GetBrush("SessionLauncher.TabIcon"))
|
|
|
|
|
.TabRole(ETabRole::MajorTab);
|
|
|
|
|
|
|
|
|
|
ILauncherServicesModule& LauncherServicesModule = FModuleManager::LoadModuleChecked<ILauncherServicesModule>("LauncherServices");
|
|
|
|
|
ITargetDeviceServicesModule& TargetDeviceServicesModule = FModuleManager::LoadModuleChecked<ITargetDeviceServicesModule>("TargetDeviceServices");
|
|
|
|
|
|
|
|
|
|
FSessionLauncherModelRef Model = MakeShareable(new FSessionLauncherModel(
|
|
|
|
|
TargetDeviceServicesModule.GetDeviceProxyManager(),
|
|
|
|
|
LauncherServicesModule.CreateLauncher(),
|
|
|
|
|
LauncherServicesModule.GetProfileManager()
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
DockTab->SetContent(SNew(SSessionLauncher, DockTab, SpawnTabArgs.GetOwnerWindow(), Model));
|
|
|
|
|
|
|
|
|
|
return DockTab;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE(FSessionLauncherModule, SessionLauncher);
|