Beispiel #1
0
void SSuperSearchBox::ActOnSuggestion(TSharedPtr<FSearchEntry> SearchEntry, FString const& Category)
{
	if (SearchEntry->bCategory == false)
	{
		EntryClicked = SearchEntry;
#if WITH_EDITOR
		if (SearchEntry->URL.IsEmpty())
		{
			UBlueprint* Blueprint = LoadObject<UBlueprint>(nullptr, *(SearchEntry->AssetData.ObjectPath.ToString()));
			UEditorTutorial* Tutorial = Blueprint->GeneratedClass->GetDefaultObject<UEditorTutorial>();
			IIntroTutorials& IntroTutorials = IIntroTutorials::Get();
			
			FWidgetPath OutWidgetPath;
			TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(SuggestionBox.ToSharedRef(), OutWidgetPath);

			IntroTutorials.LaunchTutorial(Tutorial, true, ParentWindow);
		}
		else
#endif
		{
			if (Category == TEXT("documentation"))
			{
				// append some tracking data to the URL
				FString const FinalURL = AddQueryStringToURL(SearchEntry->URL, TEXT("utm_source=editor&utm_medium=search&utm_campaign=user_initiated"));
				FPlatformProcess::LaunchURL(*FinalURL, NULL, NULL);
			}
			else
			{
				FPlatformProcess::LaunchURL(*SearchEntry->URL, NULL, NULL);
			}
		}

		SuggestionBox->SetIsOpen(false);
	}
}
Beispiel #2
0
void SSuperSearchBox::ActOnSuggestion(TSharedPtr<FSearchEntry> SearchEntry, FString const& Category)
{
	if (SearchEntry->bCategory == false)
	{
		EntryClicked = SearchEntry;
#if WITH_EDITOR
		// Broadcast text change to anyone registered for it
		FSuperSearchModule& SuperSearchModule = FModuleManager::LoadModuleChecked< FSuperSearchModule >(TEXT("SuperSearch"));		
		SuperSearchModule.GetActOnSearchTextClicked().Broadcast(SearchEntry);

		// See if the search has tutorial hits
		if (SearchEntry->URL.IsEmpty())
		{
			UBlueprint* Blueprint = LoadObject<UBlueprint>(nullptr, *(SearchEntry->AssetData.ObjectPath.ToString()));
			if( Blueprint != nullptr )
			{
				UEditorTutorial* Tutorial = Blueprint->GeneratedClass->GetDefaultObject<UEditorTutorial>();
				if( Tutorial!= nullptr)
				{
					IIntroTutorials& IntroTutorials = IIntroTutorials::Get();

					FWidgetPath OutWidgetPath;
					TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(SuggestionBox.ToSharedRef(), OutWidgetPath);

					IntroTutorials.LaunchTutorial(Tutorial, IIntroTutorials::ETutorialStartType::TST_RESTART, ParentWindow);
				}
			} 
		}
		else
#endif
		{
			// Check for documentation hits
			if (Category == TEXT("documentation"))
			{
				// append some tracking data to the URL
				FString const FinalURL = AddQueryStringToURL(SearchEntry->URL, TEXT("utm_source=editor&utm_medium=search&utm_campaign=user_initiated"));
				FPlatformProcess::LaunchURL(*FinalURL, NULL, NULL);
			}
			else
			{
				FPlatformProcess::LaunchURL(*SearchEntry->URL, NULL, NULL);
			}
		}

		SuggestionBox->SetIsOpen(false);
	}
}