Added detection of battery and proceeds to load battery profile
This commit is contained in:
parent
5c9a3256d6
commit
1a1b445302
2 changed files with 26 additions and 10 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "Objects/HarmonyLinkGraphics.h"
|
||||
#include "ComponentRecreateRenderStateContext.h"
|
||||
#include "HarmonyLink.h"
|
||||
#include "HarmonyLinkLibrary.h"
|
||||
|
||||
UHarmonyLinkGraphics* UHarmonyLinkGraphics::Instance = nullptr;
|
||||
FString UHarmonyLinkGraphics::IniLocation = "HarmonyLink";
|
||||
|
@ -156,11 +157,22 @@ void UHarmonyLinkGraphics::ApplySettings(const bool bCheckForCommandLineOverride
|
|||
|
||||
UHarmonyLinkGraphics* UHarmonyLinkGraphics::GetSettings()
|
||||
{
|
||||
if (!Instance)
|
||||
// Check if we already initialised
|
||||
if (Instance)
|
||||
{
|
||||
Instance = NewObject<UHarmonyLinkGraphics>();
|
||||
Instance->AddToRoot();
|
||||
Instance->LoadConfig();
|
||||
return Instance;
|
||||
}
|
||||
|
||||
// Proceed to create a new singleton instance
|
||||
Instance = NewObject<UHarmonyLinkGraphics>();
|
||||
Instance->AddToRoot();
|
||||
Instance->LoadConfig();
|
||||
|
||||
const FBattery BatteryStatus = UHarmonyLinkLibrary::GetBatteryStatus();
|
||||
|
||||
if (BatteryStatus.HasBattery)
|
||||
{
|
||||
Instance->ApplyProfile(EProfile::BATTERY);
|
||||
}
|
||||
|
||||
return Instance;
|
||||
|
@ -250,6 +262,11 @@ void UHarmonyLinkGraphics::LoadDefaults()
|
|||
}
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::ApplyProfile(EProfile Profile)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::DebugPrintProfiles() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("DebugPrintProfiles started."));
|
||||
|
|
|
@ -38,18 +38,17 @@ public:
|
|||
private:
|
||||
void CreateDefaultConfigFile();
|
||||
bool LoadSettingsFromConfig();
|
||||
|
||||
bool LoadSection(const FConfigFile& ConfigFile, const TPair<EProfile, FName> Profile);
|
||||
|
||||
void SaveSection(FSettingsProfile& SettingsProfile, const bool bFlush = false) const;
|
||||
|
||||
void LoadDefaults();
|
||||
|
||||
void DebugPrintProfiles() const;
|
||||
static void PrintDebugSection(FSettingsProfile& SettingsProfile);
|
||||
void ApplyProfile(EProfile Profile);
|
||||
|
||||
static void ResetInstance();
|
||||
|
||||
// Debugging
|
||||
void DebugPrintProfiles() const;
|
||||
static void PrintDebugSection(FSettingsProfile& SettingsProfile);
|
||||
|
||||
static FString IniLocation;
|
||||
|
||||
TMap<EProfile, FName> ProfileNames = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue