1414interface
1515
1616uses
17+ // Delphi
18+ SysUtils,
19+ // Project
1720 UBaseObjects,
1821 USettings;
1922
@@ -24,7 +27,11 @@ TCompilerSettings = class(TNoConstructObject)
2427 const
2528 AllCompilersConfigSection = ssCompilers;
2629 PermitStartupDetectionKey = ' PermitStartupDetection' ;
30+ ListFPCAtTopKey = ' Lists:FPCAtTop' ;
31+ ListDelphiOldestFirstKey = ' Lists:DelphiOldestFirst' ;
2732 class function ReadStorage : ISettingsSection;
33+ class procedure DoSaveProperty (const WriteProp: TProc<ISettingsSection>);
34+ class procedure SaveProperty (const Key: string; const Value : Boolean);
2835 class function GetPermitStartupDetection : Boolean; static;
2936 class procedure SetPermitStartupDetection (const Value : Boolean); static;
3037 public
@@ -37,6 +44,16 @@ implementation
3744
3845{ TCompilerSettings }
3946
47+ class procedure TCompilerSettings.DoSaveProperty (
48+ const WriteProp: TProc<ISettingsSection>);
49+ var
50+ Stg: ISettingsSection;
51+ begin
52+ Stg := ReadStorage;
53+ WriteProp(Stg);
54+ Stg.Save;
55+ end ;
56+
4057class function TCompilerSettings.GetPermitStartupDetection : Boolean;
4158begin
4259 Result := ReadStorage.GetBoolean(PermitStartupDetectionKey, True);
@@ -47,14 +64,21 @@ class function TCompilerSettings.ReadStorage: ISettingsSection;
4764 Result := Settings.ReadSection(AllCompilersConfigSection);
4865end ;
4966
67+ class procedure TCompilerSettings.SaveProperty (const Key: string;
68+ const Value : Boolean);
69+ begin
70+ DoSaveProperty(
71+ procedure(Stg: ISettingsSection)
72+ begin
73+ Stg.SetBoolean(Key, Value )
74+ end
75+ );
76+ end ;
77+
5078class procedure TCompilerSettings.SetPermitStartupDetection (
5179 const Value : Boolean);
52- var
53- Stg: ISettingsSection;
5480begin
55- Stg := ReadStorage;
56- Stg.SetBoolean(PermitStartupDetectionKey, Value );
57- Stg.Save;
81+ SaveProperty(PermitStartupDetectionKey, Value );
5882end ;
5983
6084end .
0 commit comments