From 112c4776729529b5fdb42d68ce980388791e96b0 Mon Sep 17 00:00:00 2001 From: Viktor Date: Tue, 30 Jan 2024 22:25:37 +0300 Subject: [PATCH 1/2] Fix for C++20 --- .../TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp index 3ba93f8..ec9889b 100644 --- a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp +++ b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp @@ -431,7 +431,7 @@ void UTolgeeEditorIntegrationSubsystem::Initialize(FSubsystemCollectionBase& Col { MainFrameModule.OnMainFrameCreationFinished().AddWeakLambda( this, - [=](TSharedPtr InRootWindow, bool bIsRunningStartupDialog) + [=, this](TSharedPtr InRootWindow, bool bIsRunningStartupDialog) { OnMainFrameReady(); } From 850c51fa34ee11ad9089450a45b946db242ed2dd Mon Sep 17 00:00:00 2001 From: Oprea Alexandru Date: Wed, 31 Jan 2024 10:01:53 +0200 Subject: [PATCH 2/2] converted lambda to member function --- .../TolgeeEditorIntegrationSubsystem.cpp | 17 ++++++----------- .../Private/TolgeeEditorIntegrationSubsystem.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp index ec9889b..e56e814 100644 --- a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp +++ b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.cpp @@ -13,9 +13,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -125,7 +125,7 @@ void UTolgeeEditorIntegrationSubsystem::PurgeUnusedKeys() FKeysDeletePayload Payload; for (const auto& Key : UnusedRemoteKeys) { - if(Key.RemoteId.IsSet()) + if (Key.RemoteId.IsSet()) { UE_LOG(LogTolgee, Log, TEXT("- id:%s namespace:%s key:%s"), *LexToString(Key.RemoteId.GetValue()), *Key.Namespace, *Key.Name); Payload.Ids.Add(Key.RemoteId.GetValue()); @@ -353,7 +353,7 @@ void UTolgeeEditorIntegrationSubsystem::OnUnusedKeysPurged(FHttpRequestPtr Reque GEngine->GetEngineSubsystem()->ManualFetch(); } -void UTolgeeEditorIntegrationSubsystem::OnMainFrameReady() +void UTolgeeEditorIntegrationSubsystem::OnMainFrameReady(TSharedPtr InRootWindow, bool bIsRunningStartupDialog) { // The browser plugin CEF version is too old to render the Tolgee website before 5.0 #if UE_VERSION_NEWER_THAN(5, 0, 0) @@ -425,17 +425,12 @@ void UTolgeeEditorIntegrationSubsystem::Initialize(FSubsystemCollectionBase& Col IMainFrameModule& MainFrameModule = IMainFrameModule::Get(); if (MainFrameModule.IsWindowInitialized()) { - OnMainFrameReady(); + const TSharedPtr RootWindow = FSlateApplication::Get().GetActiveTopLevelWindow(); + OnMainFrameReady(RootWindow, false); } else { - MainFrameModule.OnMainFrameCreationFinished().AddWeakLambda( - this, - [=, this](TSharedPtr InRootWindow, bool bIsRunningStartupDialog) - { - OnMainFrameReady(); - } - ); + MainFrameModule.OnMainFrameCreationFinished().AddUObject(this, &UTolgeeEditorIntegrationSubsystem::OnMainFrameReady); } #if ENGINE_MAJOR_VERSION > 4 diff --git a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.h b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.h index d2be966..0b8d543 100644 --- a/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.h +++ b/Source/TolgeeEditor/Private/TolgeeEditorIntegrationSubsystem.h @@ -67,7 +67,7 @@ class UTolgeeEditorIntegrationSubsystem : public UEditorSubsystem /** * @brief Callback executed when the editor main frame is ready to display the login pop-up */ - void OnMainFrameReady(); + void OnMainFrameReady(TSharedPtr InRootWindow, bool bIsRunningStartupDialog); /** * @brief Exports the locally available data to a file on disk to package it in the final build */