2019-12-26 15:32:37 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-10-27 07:53:18 -04:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "SettingsSection.h"
|
|
|
|
|
#include "Misc/Paths.h"
|
|
|
|
|
#include "Misc/ConfigCacheIni.h"
|
2022-05-31 16:25:06 -04:00
|
|
|
#include "Misc/ConfigContext.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "UObject/Class.h"
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
{
|
2020-09-01 14:07:48 -04:00
|
|
|
return (ResetDefaultsDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig | CLASS_ProjectUserConfig)));
|
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
|
|
|
|
|
{
|
2020-09-01 14:07:48 -04:00
|
|
|
return (SaveDefaultsDelegate.IsBound() || (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig | CLASS_ProjectUserConfig)));
|
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())
|
|
|
|
|
{
|
2021-03-30 07:51:13 -04:00
|
|
|
SettingsObject->LoadConfig(SettingsObject->GetClass(), *Filename, UE::LCPF_PropagateToInstances);
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FSettingsSection::ResetDefaults()
|
|
|
|
|
{
|
|
|
|
|
if (ResetDefaultsDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
return ResetDefaultsDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-01 14:07:48 -04:00
|
|
|
if (SettingsObject.IsValid() && SettingsObject->GetClass()->HasAnyClassFlags(CLASS_Config) && !SettingsObject->GetClass()->HasAnyClassFlags(CLASS_DefaultConfig | CLASS_GlobalUserConfig | CLASS_ProjectUserConfig))
|
2014-10-27 07:53:18 -04:00
|
|
|
{
|
|
|
|
|
FString ConfigName = SettingsObject->GetClass()->GetConfigName();
|
|
|
|
|
|
|
|
|
|
GConfig->EmptySection(*SettingsObject->GetClass()->GetPathName(), ConfigName);
|
|
|
|
|
GConfig->Flush(false);
|
|
|
|
|
|
2022-05-31 16:25:06 -04:00
|
|
|
FConfigContext::ForceReloadIntoGConfig().Load(*FPaths::GetBaseFilename(ConfigName));
|
2014-10-27 07:53:18 -04:00
|
|
|
|
2021-03-30 07:51:13 -04:00
|
|
|
SettingsObject->ReloadConfig(nullptr, nullptr, UE::LCPF_PropagateToInstances|UE::LCPF_PropagateToChildDefaultObjects);
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-05 07:37:40 -04:00
|
|
|
bool FSettingsSection::NotifySectionOnPropertyModified()
|
|
|
|
|
{
|
|
|
|
|
bool bShouldSaveChanges = true;
|
|
|
|
|
// Notify the section that it has been modified
|
|
|
|
|
if (ModifiedDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
// return value of FOnModified indicates whether the modifications should be saved.
|
|
|
|
|
bShouldSaveChanges = ModifiedDelegate.Execute();
|
|
|
|
|
}
|
|
|
|
|
return bShouldSaveChanges;
|
|
|
|
|
}
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
SettingsObject->TryUpdateDefaultConfigFile();
|
2014-10-27 07:53:18 -04:00
|
|
|
}
|
- 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();
|
|
|
|
|
}
|
2020-09-01 14:07:48 -04:00
|
|
|
else if (SettingsObject->GetClass()->HasAnyClassFlags(CLASS_ProjectUserConfig))
|
|
|
|
|
{
|
|
|
|
|
SettingsObject->UpdateProjectUserConfigFile();
|
|
|
|
|
}
|
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())
|
|
|
|
|
{
|
2021-10-27 15:14:40 -04:00
|
|
|
SettingsObject->TryUpdateDefaultConfigFile();
|
2021-03-30 07:51:13 -04:00
|
|
|
SettingsObject->ReloadConfig(nullptr, nullptr, UE::LCPF_PropagateToInstances);
|
2014-10-27 07:53:18 -04:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-11-14 07:59:12 -05:00
|
|
|
|
|
|
|
|
void FSettingsSection::Select()
|
|
|
|
|
{
|
|
|
|
|
if (SelectDelegate.IsBound())
|
|
|
|
|
{
|
|
|
|
|
SelectDelegate.Execute();
|
|
|
|
|
}
|
2021-10-27 15:14:40 -04:00
|
|
|
}
|