FReply SSessionLauncherDeployRepositorySettings::HandleBrowseButtonClicked( ) { IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); if ( DesktopPlatform ) { void* ParentWindowWindowHandle = NULL; FString FolderName; const FString Title = LOCTEXT("RepositoryBrowseTitle", "Choose a repository location").ToString(); const bool bFolderSelected = DesktopPlatform->OpenDirectoryDialog( 0, Title, RepositoryPathTextBox->GetText().ToString(), FolderName ); if ( bFolderSelected ) { if ( !FolderName.EndsWith(TEXT("/")) ) { FolderName += TEXT("/"); } RepositoryPathTextBox->SetText(FText::FromString(FolderName)); ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if(SelectedProfile.IsValid()) { SelectedProfile->SetPackageDirectory(FolderName); } } } return FReply::Handled(); }
void FLauncherProfileManager::LoadProfiles( ) { TArray<FString> ProfileFileNames; IFileManager::Get().FindFiles(ProfileFileNames, *(GetProfileFolder() / TEXT("*.ulp")), true, false); for (TArray<FString>::TConstIterator It(ProfileFileNames); It; ++It) { FString ProfileFilePath = GetProfileFolder() / *It; FArchive* ProfileFileReader = IFileManager::Get().CreateFileReader(*ProfileFilePath); if (ProfileFileReader != nullptr) { ILauncherProfilePtr LoadedProfile = LoadProfile(*ProfileFileReader); delete ProfileFileReader; if (LoadedProfile.IsValid()) { AddProfile(LoadedProfile.ToSharedRef()); } else { IFileManager::Get().Delete(*ProfileFilePath); } } } }
FReply SProjectLauncherDeployRepositorySettings::HandleBrowseButtonClicked( ) { IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); if ( DesktopPlatform ) { TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(AsShared()); void* ParentWindowHandle = (ParentWindow.IsValid() && ParentWindow->GetNativeWindow().IsValid()) ? ParentWindow->GetNativeWindow()->GetOSWindowHandle() : nullptr; FString FolderName; const bool bFolderSelected = DesktopPlatform->OpenDirectoryDialog( ParentWindowHandle, LOCTEXT("RepositoryBrowseTitle", "Choose a repository location").ToString(), RepositoryPathTextBox->GetText().ToString(), FolderName ); if ( bFolderSelected ) { if ( !FolderName.EndsWith(TEXT("/")) ) { FolderName += TEXT("/"); } RepositoryPathTextBox->SetText(FText::FromString(FolderName)); ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if(SelectedProfile.IsValid()) { SelectedProfile->SetPackageDirectory(FolderName); } } } return FReply::Handled(); }
FText SProjectLauncherLaunchPage::HandleLaunchModeComboButtonContentText( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { ELauncherProfileLaunchModes::Type LaunchMode = SelectedProfile->GetLaunchMode(); if (LaunchMode == ELauncherProfileLaunchModes::CustomRoles) { return LOCTEXT("LaunchModeComboButtonCustomRolesText", "Using custom roles"); } if (LaunchMode == ELauncherProfileLaunchModes::DefaultRole) { return LOCTEXT("LaunchModeComboButtonDefaultRoleText", "Using default role"); } if (LaunchMode == ELauncherProfileLaunchModes::DoNotLaunch) { return LOCTEXT("LaunchModeComboButtonDoNotLaunchText", "Do not launch"); } return LOCTEXT("LaunchModeComboButtonSelectText", "Select..."); } return FText::GetEmpty(); }
FText SSessionLauncherCookPage::HandleCookModeComboButtonContentText( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { ELauncherProfileCookModes::Type CookMode = SelectedProfile->GetCookMode(); if (CookMode == ELauncherProfileCookModes::ByTheBook) { return LOCTEXT("CookModeComboButton_ByTheBook", "By the book"); } if (CookMode == ELauncherProfileCookModes::DoNotCook) { return LOCTEXT("CookModeComboButton_DoNotCook", "Do not cook"); } if (CookMode == ELauncherProfileCookModes::OnTheFly) { return LOCTEXT("CookModeComboButton_OnTheFly", "On the fly"); } return LOCTEXT("CookModeComboButtonDefaultText", "Select..."); } return FText(); }
FText SProjectLauncherPackagePage::HandlePackagingModeComboButtonContentText( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { ELauncherProfilePackagingModes::Type PackagingMode = SelectedProfile->GetPackagingMode(); if (PackagingMode == ELauncherProfilePackagingModes::DoNotPackage) { return LOCTEXT("DoNotPackageAction", "Do not package"); } if (PackagingMode == ELauncherProfilePackagingModes::Locally) { return LOCTEXT("LocallyAction", "Package & store locally"); } if (PackagingMode == ELauncherProfilePackagingModes::SharedRepository) { return LOCTEXT("SharedRepositoryAction", "Package & store in repository"); } return LOCTEXT("PackagingModeComboButtonDefaultText", "Select..."); } return FText::GetEmpty(); }
void SProjectLauncherDeployRepositorySettings::OnTextChanged(const FText& InText) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if(SelectedProfile.IsValid()) { SelectedProfile->SetPackageDirectory(InText.ToString()); } }
void SProjectLauncherDeployFileServerSettings::HandleHideWindowCheckBoxCheckStateChanged( ESlateCheckBoxState::Type NewState ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetHideFileServerWindow(NewState == ESlateCheckBoxState::Checked); } }
void SProjectLauncherPackagePage::HandlePackagingModeMenuEntryClicked( ELauncherProfilePackagingModes::Type PackagingMode ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetPackagingMode(PackagingMode); } }
void SSessionLauncherCookPage::HandleCookModeMenuEntryClicked( ELauncherProfileCookModes::Type CookMode ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetCookMode(CookMode); } }
void SProjectLauncherDeployToDeviceSettings::HandleIncrementalCheckBoxCheckStateChanged( ECheckBoxState NewState ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetIncrementalDeploying(NewState == ECheckBoxState::Checked); } }
void FLaunchFromProfileCommand::Run(const FString& Params) { // Get the name of the profile from the command line. FString ProfileName; FParse::Value(FCommandLine::Get(), TEXT("-PROFILENAME="), ProfileName); if (ProfileName.IsEmpty()) { UE_LOG(LogUFECommands, Warning, TEXT("Profile name was found. Please use '-PROFILENAME=' in your command line.")); return; } // Loading the launcher services module to get the needed profile. ILauncherServicesModule& LauncherServicesModule = FModuleManager::LoadModuleChecked<ILauncherServicesModule>(TEXT("LauncherServices")); ILauncherProfileManagerRef ProfileManager = LauncherServicesModule.GetProfileManager(); ILauncherProfilePtr Profile = ProfileManager->FindProfile(ProfileName); // Loading the Device Proxy Manager to get the needed Device Manager. ITargetDeviceServicesModule& DeviceServiceModule = FModuleManager::LoadModuleChecked<ITargetDeviceServicesModule>(TEXT("TargetDeviceServices")); ITargetDeviceProxyManagerRef DeviceProxyManager = DeviceServiceModule.GetDeviceProxyManager(); UE_LOG(LogUFECommands, Display, TEXT("Begin the process of launching a project using the provided profile.")); ILauncherRef LauncherRef = LauncherServicesModule.CreateLauncher(); ILauncherWorkerPtr LauncherWorkerPtr = LauncherRef->Launch(DeviceProxyManager, Profile.ToSharedRef()); // This will allow us to pipe the launcher messages into the command window. LauncherWorkerPtr.Get()->OnOutputReceived().AddStatic(&FLaunchFromProfileCommand::MessageReceived); // Allows us to exit this command once the launcher worker has completed or is canceled LauncherWorkerPtr.Get()->OnCompleted().AddRaw(this, &FLaunchFromProfileCommand::LaunchCompleted); LauncherWorkerPtr.Get()->OnCanceled().AddRaw(this, &FLaunchFromProfileCommand::LaunchCanceled); TArray<ILauncherTaskPtr> TaskList; int32 NumOfTasks = LauncherWorkerPtr->GetTasks(TaskList); UE_LOG(LogUFECommands, Display, TEXT("There are '%i' tasks to be completed."), NumOfTasks); // Holds the current element in the TaskList array. int32 TaskIndex = 0; // Holds the name of the current tasked. FString TriggeredTask; bTestRunning = true; while (bTestRunning) { if (TaskIndex >= NumOfTasks) continue; ILauncherTaskPtr CurrentTask = TaskList[TaskIndex]; // Log the current task, but only once per run. if (CurrentTask->GetStatus() == ELauncherTaskStatus::Busy) { if (CurrentTask->GetDesc() == TriggeredTask) continue; TriggeredTask = *CurrentTask->GetDesc(); UE_LOG(LogUFECommands, Display, TEXT("Current Task is %s"), *TriggeredTask); TaskIndex++; } } }
void SProjectLauncherLaunchPage::HandleProfileManagerProfileSelected( const ILauncherProfilePtr& SelectedProfile, const ILauncherProfilePtr& PreviousProfile ) { if (PreviousProfile.IsValid()) { PreviousProfile->OnProjectChanged().RemoveAll(this); } if (SelectedProfile.IsValid()) { SelectedProfile->OnProjectChanged().AddSP(this, &SProjectLauncherLaunchPage::HandleProfileProjectChanged); } Refresh(); }
void SProjectLauncherDeployRepositorySettings::OnTextCommitted( const FText& InText, ETextCommit::Type CommitInfo) { if (CommitInfo == ETextCommit::OnEnter) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if(SelectedProfile.IsValid()) { SelectedProfile->SetPackageDirectory(InText.ToString()); } } }
void SProjectLauncherPackagePage::HandlePackagingModeMenuEntryClicked( ELauncherProfilePackagingModes::Type PackagingMode ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetPackagingMode(PackagingMode); check(ProjectLauncherPackagingSettings.IsValid()); ProjectLauncherPackagingSettings->UpdateDirectoryPathText(); } }
FText SProjectLauncherCookOnTheFlySettings::HandleCookOptionsTextBlockText() const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); FText result; if (SelectedProfile.IsValid()) { result = FText::FromString(SelectedProfile->GetCookOptions()); } return result; }
ESlateCheckBoxState::Type SProjectLauncherCookOnTheFlySettings::HandleIncrementalCheckBoxIsChecked( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->IsCookingIncrementally()) { return ESlateCheckBoxState::Checked; } } return ESlateCheckBoxState::Unchecked; }
EVisibility SProjectLauncherLaunchPage::HandleLaunchModeBoxVisibility( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->GetDeploymentMode() != ELauncherProfileDeploymentModes::DoNotDeploy) { return EVisibility::Visible; } } return EVisibility::Collapsed; }
ILauncherProfilePtr FLauncherProfileManager::GetProfile( const FGuid& ProfileId ) const { for (int32 ProfileIndex = 0; ProfileIndex < SavedProfiles.Num(); ++ProfileIndex) { ILauncherProfilePtr Profile = SavedProfiles[ProfileIndex]; if (Profile->GetId() == ProfileId) { return Profile; } } return nullptr; }
ESlateCheckBoxState::Type SProjectLauncherDeployFileServerSettings::HandleHideWindowCheckBoxIsChecked( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->IsFileServerHidden()) { return ESlateCheckBoxState::Checked; } } return ESlateCheckBoxState::Unchecked; }
EVisibility SSessionLauncherCookPage::HandleCookOnTheFlySettingsVisibility( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->GetCookMode() == ELauncherProfileCookModes::OnTheFly) { return EVisibility::Visible; } } return EVisibility::Collapsed; }
ECheckBoxState SProjectLauncherDeployToDeviceSettings::HandleIncrementalCheckBoxIsChecked( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->IsDeployingIncrementally()) { return ECheckBoxState::Checked; } } return ECheckBoxState::Unchecked; }
EVisibility SProjectLauncherLaunchPage::HandleValidationErrorIconVisibility( ELauncherProfileValidationErrors::Type Error ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->HasValidationError(Error)) { return EVisibility::Visible; } } return EVisibility::Collapsed; }
ILauncherProfilePtr FLauncherProfileManager::FindProfile( const FString& ProfileName ) { for (int32 ProfileIndex = 0; ProfileIndex < SavedProfiles.Num(); ++ProfileIndex) { ILauncherProfilePtr Profile = SavedProfiles[ProfileIndex]; if (Profile->GetName() == ProfileName) { return Profile; } } return nullptr; }
EVisibility SProjectLauncherCookOnTheFlySettings::HandleValidationErrorIconVisibility( ELauncherProfileValidationErrors::Type Error ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->HasValidationError(Error)) { return EVisibility::Visible; } } return EVisibility::Hidden; }
EVisibility SProjectLauncherSimpleCookPage::HandleCookByTheBookSettingsVisibility( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->GetCookMode() == ELauncherProfileCookModes::ByTheBook) { return EVisibility::Visible; } } return EVisibility::Collapsed; }
END_SLATE_FUNCTION_BUILD_OPTIMIZATION /* SProjectLauncherCookOnTheFlySettings callbacks *****************************************************************************/ void SProjectLauncherCookOnTheFlySettings::HandleIncrementalCheckBoxCheckStateChanged( ESlateCheckBoxState::Type NewState ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { SelectedProfile->SetIncrementalCooking(NewState == ESlateCheckBoxState::Checked); } }
EVisibility SProjectLauncherPackagePage::HandlePackagingSettingsAreaVisibility( ) const { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { ELauncherProfilePackagingModes::Type PackagingMode = SelectedProfile->GetPackagingMode(); if ((PackagingMode == ELauncherProfilePackagingModes::Locally) || (PackagingMode == ELauncherProfilePackagingModes::SharedRepository)) { return EVisibility::Visible; } } return EVisibility::Collapsed; }
void SProjectLauncherCookOnTheFlySettings::HandleCookerOptionsCommitted(const FText& NewText, ETextCommit::Type CommitType) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { FString useOptions = NewText.ToString(); switch (CommitType) { case ETextCommit::Default: case ETextCommit::OnCleared: useOptions = TEXT(""); break; default: break; } SelectedProfile->SetCookOptions(useOptions); } }
END_SLATE_FUNCTION_BUILD_OPTIMIZATION void SProjectLauncherLaunchPage::Refresh( ) { ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile(); if (SelectedProfile.IsValid()) { if (SelectedProfile->GetCookMode() == ELauncherProfileCookModes::ByTheBook) { AvailableCultures = SelectedProfile->GetCookedCultures(); } else { FInternationalization::Get().GetCultureNames(AvailableCultures); } AvailableMaps = FGameProjectHelper::GetAvailableMaps(SelectedProfile->GetProjectBasePath(), SelectedProfile->SupportsEngineMaps(), true); DefaultRoleEditor->Refresh(SelectedProfile->GetDefaultLaunchRole()); } else { AvailableCultures.Reset(); AvailableMaps.Reset(); DefaultRoleEditor->Refresh(NULL); } }