From 3f43bdb16be2fbb91331b98f5b889b50eba030e2 Mon Sep 17 00:00:00 2001 From: Jordon Brooks Date: Wed, 15 May 2024 21:31:08 +0100 Subject: [PATCH] Added getter and delegate for automatic profile switching --- Source/HarmonyLink/Private/Objects/HarmonyLinkGraphics.cpp | 6 ++++++ Source/HarmonyLink/Public/Objects/HarmonyLinkGraphics.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/Source/HarmonyLink/Private/Objects/HarmonyLinkGraphics.cpp b/Source/HarmonyLink/Private/Objects/HarmonyLinkGraphics.cpp index 62c6c14..ad88487 100644 --- a/Source/HarmonyLink/Private/Objects/HarmonyLinkGraphics.cpp +++ b/Source/HarmonyLink/Private/Objects/HarmonyLinkGraphics.cpp @@ -260,6 +260,12 @@ EProfile UHarmonyLinkGraphics::GetActiveProfile() const void UHarmonyLinkGraphics::SetAutomaticSwitching(const bool bAutomaticSwitch) { _bAutomaticSwitch = bAutomaticSwitch; + OnAutomaticSwitchChanged.Broadcast(_bAutomaticSwitch); +} + +bool UHarmonyLinkGraphics::GetAutomaticSwitching() const +{ + return _bAutomaticSwitch; } void UHarmonyLinkGraphics::DestroySettings() diff --git a/Source/HarmonyLink/Public/Objects/HarmonyLinkGraphics.h b/Source/HarmonyLink/Public/Objects/HarmonyLinkGraphics.h index 69e167a..810a071 100644 --- a/Source/HarmonyLink/Public/Objects/HarmonyLinkGraphics.h +++ b/Source/HarmonyLink/Public/Objects/HarmonyLinkGraphics.h @@ -10,6 +10,7 @@ #include "HarmonyLinkGraphics.generated.h" DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnProfileChanged, EProfile, Profile); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAutomaticSwitchChanged, bool, bAutomaticSwich); /** * @@ -25,6 +26,9 @@ public: UPROPERTY(BlueprintAssignable) FOnProfileChanged OnProfileChanged; + + UPROPERTY(BlueprintAssignable) + FOnAutomaticSwitchChanged OnAutomaticSwitchChanged; UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings") void LoadConfig(const bool bForceReload = false); @@ -51,6 +55,9 @@ public: UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings") void SetAutomaticSwitching(const bool bAutomaticSwitch); + UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink Settings") + bool GetAutomaticSwitching() const; + static void DestroySettings(); private: