2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
#include "SettingsPrivatePCH.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* FSettingsSection structors
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
FSettingsSection::FSettingsSection( const ISettingsCategoryRef& InCategory, const FName& InName, const FText& InDisplayName, const FText& InDescription, const TWeakObjectPtr<UObject>& InSettingsObject )
|
|
|
|
|
: Category(InCategory)
|
|
|
|
|
, Description(InDescription)
|
|
|
|
|
, DisplayName(InDisplayName)
|
|
|
|
|
, Name(InName)
|
|
|
|
|
, SettingsObject(InSettingsObject)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FSettingsSection::FSettingsSection( const ISettingsCategoryRef& InCategory, const FName& InName, const FText& InDisplayName, const FText& InDescription, const TSharedRef<SWidget>& InCustomWidget )
|
|
|
|
|
: Category(InCategory)
|
|
|
|
|
, CustomWidget(InCustomWidget)
|
|
|
|
|
, Description(InDescription)
|
|
|
|
|
, DisplayName(InDisplayName)
|
|
|
|
|
, Name(InName)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ISettingsSection interface
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanEdit() const
|
|
|
|
|
{
|
|
|
|
|
if (CanEditDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return CanEditDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanExport() const
|
|
|
|
|
{
|
|
|
|
|
return (ExportDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanImport() const
|
|
|
|
|
{
|
|
|
|
|
return (ImportDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanResetDefaults() const
|
|
|
|
|
{
|
- Generate AndroidManifest.xml from ProjectSettings
- Moved some Android settings to ProjectSettings, re-enabled SDK settings
- Removed SigningConfig.xml, and moved those settings into project settings
- Added concept of NotForLicensees and NoRedist engine and project config settings
- Removed BaseInternalGame.ini, replaced with NotForLicensees/BaseGame.ini
- Moved User*.ini to end of .ini hierarchy
- Added support for CLASS_GlobalUserConfig, so their settings will be saved to <AppData>/.../User*.ini (useful for SDK paths, etc)
- Enabled AndroidPlatformEditor module on Mac
- Changed Mac Build.sh to allow for Android on the commandline (just pass through if it's not an Xcode platform name)
- Iterative Android packaging now looks at just the important .ini sections, NOT entire .ini files
#codereview jamie.dale,james.moran,michael.trepka,robert.jones,chris.babcock
[CL 2413870 by Josh Adams in Main branch]
2015-01-21 11:17:55 -05:00
|
|
|
return (ResetDefaultsDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig)));
|
2014-10-27 07:53:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanSave() const
|
|
|
|
|
{
|
|
|
|
|
return (SaveDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::CanSaveDefaults() const
|
|
|
|
|
{
|
- Generate AndroidManifest.xml from ProjectSettings
- Moved some Android settings to ProjectSettings, re-enabled SDK settings
- Removed SigningConfig.xml, and moved those settings into project settings
- Added concept of NotForLicensees and NoRedist engine and project config settings
- Removed BaseInternalGame.ini, replaced with NotForLicensees/BaseGame.ini
- Moved User*.ini to end of .ini hierarchy
- Added support for CLASS_GlobalUserConfig, so their settings will be saved to <AppData>/.../User*.ini (useful for SDK paths, etc)
- Enabled AndroidPlatformEditor module on Mac
- Changed Mac Build.sh to allow for Android on the commandline (just pass through if it's not an Xcode platform name)
- Iterative Android packaging now looks at just the important .ini sections, NOT entire .ini files
#codereview jamie.dale,james.moran,michael.trepka,robert.jones,chris.babcock
[CL 2413870 by Josh Adams in Main branch]
2015-01-21 11:17:55 -05:00
|
|
|
return (SaveDefaultsDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig)));
|
2014-10-27 07:53:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::Export( const FString& Filename )
|
|
|
|
|
{
|
|
|
|
|
if (ExportDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return ExportDelegate.Execute(Filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SettingsObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->SaveConfig(CPF_Config, *Filename);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TWeakPtr<ISettingsCategory> FSettingsSection::GetCategory()
|
|
|
|
|
{
|
|
|
|
|
return Category;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TWeakPtr<SWidget> FSettingsSection::GetCustomWidget() const
|
|
|
|
|
{
|
|
|
|
|
return CustomWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FText& FSettingsSection::GetDescription() const
|
|
|
|
|
{
|
|
|
|
|
return Description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FText& FSettingsSection::GetDisplayName() const
|
|
|
|
|
{
|
|
|
|
|
return DisplayName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FName& FSettingsSection::GetName() const
|
|
|
|
|
{
|
|
|
|
|
return Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TWeakObjectPtr<UObject> FSettingsSection::GetSettingsObject() const
|
|
|
|
|
{
|
|
|
|
|
return SettingsObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FText FSettingsSection::GetStatus() const
|
|
|
|
|
{
|
|
|
|
|
if (StatusDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return StatusDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FText::GetEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::HasDefaultSettingsObject()
|
|
|
|
|
{
|
|
|
|
|
if (!SettingsObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
- Generate AndroidManifest.xml from ProjectSettings
- Moved some Android settings to ProjectSettings, re-enabled SDK settings
- Removed SigningConfig.xml, and moved those settings into project settings
- Added concept of NotForLicensees and NoRedist engine and project config settings
- Removed BaseInternalGame.ini, replaced with NotForLicensees/BaseGame.ini
- Moved User*.ini to end of .ini hierarchy
- Added support for CLASS_GlobalUserConfig, so their settings will be saved to <AppData>/.../User*.ini (useful for SDK paths, etc)
- Enabled AndroidPlatformEditor module on Mac
- Changed Mac Build.sh to allow for Android on the commandline (just pass through if it's not an Xcode platform name)
- Iterative Android packaging now looks at just the important .ini sections, NOT entire .ini files
#codereview jamie.dale,james.moran,michael.trepka,robert.jones,chris.babcock
[CL 2413870 by Josh Adams in Main branch]
2015-01-21 11:17:55 -05:00
|
|
|
// @todo userconfig: Should we add GlobalUserConfig here?
|
2014-10-27 07:53:18 -04:00
|
|
|
return SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::Import( const FString& Filename )
|
|
|
|
|
{
|
|
|
|
|
if (ImportDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return ImportDelegate.Execute(Filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SettingsObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->LoadConfig(SettingsObject->GetClass(), *Filename, UE4::LCPF_PropagateToInstances);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::ResetDefaults()
|
|
|
|
|
{
|
|
|
|
|
if (ResetDefaultsDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return ResetDefaultsDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
- Generate AndroidManifest.xml from ProjectSettings
- Moved some Android settings to ProjectSettings, re-enabled SDK settings
- Removed SigningConfig.xml, and moved those settings into project settings
- Added concept of NotForLicensees and NoRedist engine and project config settings
- Removed BaseInternalGame.ini, replaced with NotForLicensees/BaseGame.ini
- Moved User*.ini to end of .ini hierarchy
- Added support for CLASS_GlobalUserConfig, so their settings will be saved to <AppData>/.../User*.ini (useful for SDK paths, etc)
- Enabled AndroidPlatformEditor module on Mac
- Changed Mac Build.sh to allow for Android on the commandline (just pass through if it's not an Xcode platform name)
- Iterative Android packaging now looks at just the important .ini sections, NOT entire .ini files
#codereview jamie.dale,james.moran,michael.trepka,robert.jones,chris.babcock
[CL 2413870 by Josh Adams in Main branch]
2015-01-21 11:17:55 -05:00
|
|
|
if (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig))
|
2014-10-27 07:53:18 -04:00
|
|
|
{
|
|
|
|
|
FString ConfigName = SettingsObject->GetClass()->GetConfigName();
|
|
|
|
|
|
|
|
|
|
GConfig->EmptySection(*SettingsObject->GetClass()->GetPathName(), ConfigName);
|
|
|
|
|
GConfig->Flush(false);
|
|
|
|
|
|
2015-04-20 09:35:49 -04:00
|
|
|
FConfigCacheIni::LoadGlobalIniFile(ConfigName, *FPaths::GetBaseFilename(ConfigName), nullptr, true);
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
SettingsObject->ReloadConfig(nullptr, nullptr, UE4::LCPF_PropagateToInstances|UE4::LCPF_PropagateToChildDefaultObjects);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::Save()
|
|
|
|
|
{
|
|
|
|
|
if (ModifiedDelegate.IsBound() && !ModifiedDelegate.Execute())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SaveDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return SaveDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SettingsObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
if (SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig))
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->UpdateDefaultConfigFile();
|
|
|
|
|
}
|
- Generate AndroidManifest.xml from ProjectSettings
- Moved some Android settings to ProjectSettings, re-enabled SDK settings
- Removed SigningConfig.xml, and moved those settings into project settings
- Added concept of NotForLicensees and NoRedist engine and project config settings
- Removed BaseInternalGame.ini, replaced with NotForLicensees/BaseGame.ini
- Moved User*.ini to end of .ini hierarchy
- Added support for CLASS_GlobalUserConfig, so their settings will be saved to <AppData>/.../User*.ini (useful for SDK paths, etc)
- Enabled AndroidPlatformEditor module on Mac
- Changed Mac Build.sh to allow for Android on the commandline (just pass through if it's not an Xcode platform name)
- Iterative Android packaging now looks at just the important .ini sections, NOT entire .ini files
#codereview jamie.dale,james.moran,michael.trepka,robert.jones,chris.babcock
[CL 2413870 by Josh Adams in Main branch]
2015-01-21 11:17:55 -05:00
|
|
|
else if (SettingsObject->GetClass()->HasAnyClassFlags(CLASS_GlobalUserConfig))
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->UpdateGlobalUserConfigFile();
|
|
|
|
|
}
|
2014-10-27 07:53:18 -04:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->SaveConfig();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::SaveDefaults()
|
|
|
|
|
{
|
|
|
|
|
if (SaveDefaultsDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return SaveDefaultsDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SettingsObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->UpdateDefaultConfigFile();
|
|
|
|
|
SettingsObject->ReloadConfig(nullptr, nullptr, UE4::LCPF_PropagateToInstances);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|