14
14
interface
15
15
16
16
uses
17
+ // Delphi
18
+ SysUtils,
19
+ // Project
17
20
UBaseObjects,
18
21
USettings;
19
22
@@ -24,7 +27,11 @@ TCompilerSettings = class(TNoConstructObject)
24
27
const
25
28
AllCompilersConfigSection = ssCompilers;
26
29
PermitStartupDetectionKey = ' PermitStartupDetection' ;
30
+ ListFPCAtTopKey = ' Lists:FPCAtTop' ;
31
+ ListDelphiOldestFirstKey = ' Lists:DelphiOldestFirst' ;
27
32
class function ReadStorage : ISettingsSection;
33
+ class procedure DoSaveProperty (const WriteProp: TProc<ISettingsSection>);
34
+ class procedure SaveProperty (const Key: string; const Value : Boolean);
28
35
class function GetPermitStartupDetection : Boolean; static;
29
36
class procedure SetPermitStartupDetection (const Value : Boolean); static;
30
37
public
@@ -37,6 +44,16 @@ implementation
37
44
38
45
{ TCompilerSettings }
39
46
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
+
40
57
class function TCompilerSettings.GetPermitStartupDetection : Boolean;
41
58
begin
42
59
Result := ReadStorage.GetBoolean(PermitStartupDetectionKey, True);
@@ -47,14 +64,21 @@ class function TCompilerSettings.ReadStorage: ISettingsSection;
47
64
Result := Settings.ReadSection(AllCompilersConfigSection);
48
65
end ;
49
66
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
+
50
78
class procedure TCompilerSettings.SetPermitStartupDetection (
51
79
const Value : Boolean);
52
- var
53
- Stg: ISettingsSection;
54
80
begin
55
- Stg := ReadStorage;
56
- Stg.SetBoolean(PermitStartupDetectionKey, Value );
57
- Stg.Save;
81
+ SaveProperty(PermitStartupDetectionKey, Value );
58
82
end ;
59
83
60
84
end .
0 commit comments