void UUnitTestCommandlet::CreateCustomEngine(const FString& Params)
{
	// @todo #JohnBLowPri: Fix StandaloneRenderer support for static builds
#if !IS_MONOLITHIC
	FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());
#endif
}
Esempio n. 2
0
void RunSlateViewer( const TCHAR* CommandLine )
{
    // start up the main loop
    GEngineLoop.PreInit(CommandLine);

    // crank up a normal Slate application using the platform's standalone renderer
    FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());

    // Load the source code access module
    ISourceCodeAccessModule& SourceCodeAccessModule = FModuleManager::LoadModuleChecked<ISourceCodeAccessModule>( FName( "SourceCodeAccess" ) );

    // Manually load in the source code access plugins, as standalone programs don't currently support plugins.
#if PLATFORM_MAC
    IModuleInterface& XCodeSourceCodeAccessModule = FModuleManager::LoadModuleChecked<IModuleInterface>( FName( "XCodeSourceCodeAccess" ) );
    SourceCodeAccessModule.SetAccessor(FName("XCodeSourceCodeAccess"));
#elif PLATFORM_WINDOWS
    IModuleInterface& VisualStudioSourceCodeAccessModule = FModuleManager::LoadModuleChecked<IModuleInterface>( FName( "VisualStudioSourceCodeAccess" ) );
    SourceCodeAccessModule.SetAccessor(FName("VisualStudioSourceCodeAccess"));
#endif

    // set the application name
    FGlobalTabmanager::Get()->SetApplicationTitle(LOCTEXT("AppTitle", "Slate Viewer"));
    FModuleManager::LoadModuleChecked<ISlateReflectorModule>("SlateReflector").RegisterTabSpawner(WorkspaceMenu::DeveloperMenu);

    FGlobalTabmanager::Get()->RegisterNomadTabSpawner("WebBrowserTab", FOnSpawnTab::CreateStatic(&SpawnWebBrowserTab))
    .SetDisplayName(LOCTEXT("WebBrowserTab", "Web Browser"));

    if (FParse::Param(FCommandLine::Get(), TEXT("perftest")))
    {
        // Bring up perf test
        SummonPerfTestSuite();
    }
    else
    {
        // Bring up the test suite.
        RestoreSlateTestSuite();
    }


#if WITH_SHARED_POINTER_TESTS
    SharedPointerTesting::TestSharedPointer<ESPMode::Fast>();
    SharedPointerTesting::TestSharedPointer<ESPMode::ThreadSafe>();
#endif

    // loop while the server does the rest
    while (!GIsRequestingExit)
    {
        FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);
        FStats::AdvanceFrame(false);
        FTicker::GetCoreTicker().Tick(FApp::GetDeltaTime());
        FSlateApplication::Get().PumpMessages();
        FSlateApplication::Get().Tick();
        FPlatformProcess::Sleep(0);
    }

    FSlateApplication::Shutdown();
}
Esempio n. 3
0
void FUserInterfaceCommand::InitializeSlateApplication( const FString& LayoutIni )
{
	FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());
	FGlobalTabmanager::Get()->SetApplicationTitle(NSLOCTEXT("UnrealFrontend", "AppTitle", "Unreal Frontend"));

	// load widget reflector
	const bool bAllowDebugTools = FParse::Param(FCommandLine::Get(), TEXT("DebugTools"));

	if (bAllowDebugTools)
	{
		ISlateReflectorModule* SlateReflectorModule = FModuleManager::GetModulePtr<ISlateReflectorModule>("SlateReflector");

		if (SlateReflectorModule != nullptr)
		{
			SlateReflectorModule->RegisterTabSpawner(UserInterfaceCommand::DeveloperTools);
		}
	}

	// restore application layout
	TSharedRef<FTabManager::FLayout> NewLayout = FTabManager::NewLayout("SessionFrontendLayout_v1.1")
		->AddArea
		(
			FTabManager::NewArea(1280.f, 720.0f)
				->Split
				(
					FTabManager::NewStack()
						->AddTab(FName("DeviceManager"), ETabState::OpenedTab)
						->AddTab(FName("MessagingDebugger"), ETabState::ClosedTab)
						->AddTab(FName("SessionFrontend"), ETabState::OpenedTab)
						->AddTab(FName("ProjectLauncher"), ETabState::OpenedTab)
				)
		)
		->AddArea
		(
			FTabManager::NewArea(600.0f, 600.0f)
				->SetWindow(FVector2D(10.0f, 10.0f), false)
				->Split
				(
					FTabManager::NewStack()->AddTab("WidgetReflector", bAllowDebugTools ? ETabState::OpenedTab : ETabState::ClosedTab)
				)
		);

	UserInterfaceCommand::ApplicationLayout = FLayoutSaveRestore::LoadFromConfig(LayoutIni, NewLayout);
	FGlobalTabmanager::Get()->RestoreFrom(UserInterfaceCommand::ApplicationLayout.ToSharedRef(), TSharedPtr<SWindow>());
}
Esempio n. 4
0
void RunCrashReportClient(const TCHAR* CommandLine)
{
	// Override the stack size for the thread pool.
	FQueuedThreadPool::OverrideStackSize = 256 * 1024;

	// Set up the main loop
	GEngineLoop.PreInit(CommandLine);

	// Initialize config.
	FCrashReportClientConfig::Get();

	const bool bUnattended = 
#if CRASH_REPORT_UNATTENDED_ONLY
		true;
#else
		FApp::IsUnattended();
#endif // CRASH_REPORT_UNATTENDED_ONLY

	// Set up the main ticker
	FMainLoopTiming MainLoop(IdealTickRate, bUnattended ? EMainLoopOptions::CoreTickerOnly : EMainLoopOptions::UsingSlate);

	// Find the report to upload in the command line arguments
	ParseCommandLine(CommandLine);

	// Increase the HttpSendTimeout to 5 minutes
	GConfig->SetFloat(TEXT("HTTP"), TEXT("HttpSendTimeout"), 5*60.0f, GEngineIni);

	FPlatformErrorReport::Init();
	auto ErrorReport = LoadErrorReport();
	
	if( ErrorReport.HasFilesToUpload() )
	{
		// Send analytics.
		extern FCrashDescription& GetCrashDescription();
		GetCrashDescription().SendAnalytics();
	}

	if (bUnattended)
	{
		ErrorReport.SetUserComment( NSLOCTEXT( "CrashReportClient", "UnattendedMode", "Sent in the unattended mode" ), false );
		FCrashReportClientUnattended CrashReportClient( ErrorReport );

		// loop until the app is ready to quit
		while (!GIsRequestingExit)
		{
			MainLoop.Tick();
		}
	}
	else
	{
#if !CRASH_REPORT_UNATTENDED_ONLY
		// crank up a normal Slate application using the platform's standalone renderer
		FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());

		// Prepare the custom Slate styles
		FCrashReportClientStyle::Initialize();

		// Create the main implementation object
		TSharedRef<FCrashReportClient> CrashReportClient = MakeShareable(new FCrashReportClient(ErrorReport));

		// open up the app window	
		TSharedRef<SCrashReportClient> ClientControl = SNew(SCrashReportClient, CrashReportClient);

		auto Window = FSlateApplication::Get().AddWindow(
			SNew(SWindow)
			.Title(NSLOCTEXT("CrashReportClient", "CrashReportClientAppName", "Unreal Engine 4 Crash Reporter"))
			.ClientSize(InitialWindowDimensions)
			[
				ClientControl
			]);

		Window->SetRequestDestroyWindowOverride(FRequestDestroyWindowOverride::CreateSP(CrashReportClient, &FCrashReportClient::RequestCloseWindow));

		// Setting focus seems to have to happen after the Window has been added
		FSlateApplication::Get().ClearKeyboardFocus(EFocusCause::Cleared);

		// Debugging code
		if (RunWidgetReflector)
		{
			FSlateApplication::Get().AddWindow(
				SNew(SWindow)
				.ClientSize(FVector2D(800, 600))
				[
					FModuleManager::LoadModuleChecked<ISlateReflectorModule>("SlateReflector").GetWidgetReflector()
				]);
		}

		// loop until the app is ready to quit
		while (!GIsRequestingExit)
		{
			MainLoop.Tick();

			if (CrashReportClient->ShouldWindowBeHidden())
			{
				Window->HideWindow();
			}
		}

		// Clean up the custom styles
		FCrashReportClientStyle::Shutdown();

		// Close down the Slate application
		FSlateApplication::Shutdown();
#endif // !CRASH_REPORT_UNATTENDED_ONLY
	}

	FPlatformErrorReport::ShutDown();

	FEngineLoop::AppPreExit();
	FTaskGraphInterface::Shutdown();

	FEngineLoop::AppExit();
}
Esempio n. 5
0
void RunSymbolDebugger(const TCHAR* CommandLine)
{
	// start up the main loop
	GEngineLoop.PreInit(CommandLine);

	// crank up a normal Slate application using the platform's standalone renderer
	FSlateApplication::InitializeAsStandaloneApplication( GetStandardStandaloneRenderer() );

	// The source control plugins currently rely on EditorStyle being loaded
	FModuleManager::LoadModuleChecked<IEditorStyleModule>("EditorStyle");

	// Load in the perforce source control plugin, as standalone programs don't currently support plugins and
	// we don't support any other provider apart from Perforce in this module.
	IModuleInterface& PerforceSourceControlModule = FModuleManager::LoadModuleChecked<IModuleInterface>( FName( "PerforceSourceControl" ) );

	// make sure our provider is set to Perforce
	ISourceControlModule& SourceControlModule = FModuleManager::LoadModuleChecked<ISourceControlModule>( FName( "SourceControl" ) );
	SourceControlModule.SetProvider(FName("Perforce"));

	// Create the symbol debugger helper
	TSharedPtr<FSymbolDebugger> SymbolDebugger = MakeShareable(new FSymbolDebugger());
	checkf(SymbolDebugger.IsValid(), TEXT("Failed to create SymbolDebugger"));

	// open up the SymbolDebugger windows
	{
		TSharedRef<SWindow> Window = SNew(SWindow)
		.Title(NSLOCTEXT("SymbolDebugger", "SymbolDebuggerAppName", "Symbol Debugger"))
		.ClientSize(FVector2D(400, 300))
		[
			SNew(SSymbolDebugger)
			.OnGetCurrentMethod(SymbolDebugger.Get(), &FSymbolDebugger::GetCurrentMethod)
			.OnSetCurrentMethod(SymbolDebugger.Get(), &FSymbolDebugger::SetCurrentMethod)
			.OnGetMethodText(SymbolDebugger.Get(), &FSymbolDebugger::GetMethodText)
			.OnSetMethodText(SymbolDebugger.Get(), &FSymbolDebugger::SetMethodText)
			.OnFileOpen(SymbolDebugger.Get(), &FSymbolDebugger::OnFileOpen)
			.OnGetTextField(SymbolDebugger.Get(), &FSymbolDebugger::GetTextField)
			.OnSetTextField(SymbolDebugger.Get(), &FSymbolDebugger::SetTextField)
			.OnGetCurrentAction(SymbolDebugger.Get(), &FSymbolDebugger::GetCurrentAction)
			.IsActionEnabled(SymbolDebugger.Get(), &FSymbolDebugger::IsActionEnabled)
			.OnAction(SymbolDebugger.Get(), &FSymbolDebugger::OnAction)
			.OnGetStatusText(SymbolDebugger.Get(), &FSymbolDebugger::GetStatusText)
			.HasActionCompleted(SymbolDebugger.Get(), &FSymbolDebugger::ActionHasCompleted)
		];
	
		FSlateApplication::Get().AddWindow(Window);
	}

#if WITH_SHARED_POINTER_TESTS
	SharedPointerTesting::TestSharedPointer< ESPMode::Fast >();
	SharedPointerTesting::TestSharedPointer< ESPMode::ThreadSafe >();
#endif

	// loop while the server does the rest
	double LastTime = FPlatformTime::Seconds();
	while (!GIsRequestingExit)
	{
		FSlateApplication::Get().PumpMessages();
		FSlateApplication::Get().Tick();
		ISourceControlModule::Get().Tick();

		// Tick the helper
		SymbolDebugger->Tick();

		// Sleep
		FPlatformProcess::Sleep(0);
	}

	PerforceSourceControlModule.ShutdownModule();

	FSlateApplication::Shutdown();
}
void RunAllarBuilderClient(const TCHAR* CommandLine)
{
	GEngineLoop.PreInit(CommandLine);

	UE_LOG(LogAllarBuilder, Display, TEXT("Hello World"));

	// Set up the main ticker
	FMainLoopTiming MainLoop(IdealTickRate);

	// crank up a normal Slate application using the platform's standalone renderer
	FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());

	// Prepare the custom Slate styles
	FAllarBuilderClientStyle::Initialize();

	// Create the main implementation object
	TSharedRef<FAllarBuilderClient> AllarBuilderClient = MakeShareable(new FAllarBuilderClient());

	TSharedRef<FSlateStyleSet> Style = FAllarBuilderClientStyle::GetPtr().ToSharedRef();

	// open up the app window	
	TSharedRef<SAllarBuilderClient> ClientControl = SNew(SAllarBuilderClient, AllarBuilderClient, Style);

	auto Window = FSlateApplication::Get().AddWindow(
		SNew(SWindow)
		.Title(NSLOCTEXT("AllarBuilder", "AllarBuilderClientAppName", "Allar's Unreal Engine 4 Development Launcher"))	
		.ClientSize(InitialWindowDimensions)
		.SupportsMaximize(false)
		[
			ClientControl
		]
	);

	// Debugging code
	if (true)
	{
		FSlateApplication::Get().AddWindow(
			SNew(SWindow)
			.ClientSize(FVector2D(720, 600))
			.ScreenPosition(FVector2D(0, 1080))
			.AutoCenter(EAutoCenter::None)
			[
				FModuleManager::LoadModuleChecked<ISlateReflectorModule>("SlateReflector").GetWidgetReflector()
			]);
	}

	// Setting focus seems to have to happen after the Window has been added
	FSlateApplication::Get().ClearKeyboardFocus(EFocusCause::Cleared);

	// loop until the app is ready to quit
	while (!GIsRequestingExit)
	{
		MainLoop.Tick();
	}

	Window->SetRequestDestroyWindowOverride(FRequestDestroyWindowOverride::CreateSP(AllarBuilderClient, &FAllarBuilderClient::RequestCloseWindow));

	// Clean up the custom styles
	FAllarBuilderClientStyle::Shutdown();

	// Close down the Slate application
	FSlateApplication::Shutdown();

	FEngineLoop::AppPreExit();
	FTaskGraphInterface::Shutdown();

	FEngineLoop::AppExit();
}