mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 14:39:09 +02:00
PoChecker:
- refactor PoCheckerSettings. - less verbosity git-svn-id: trunk@46443 -
This commit is contained in:
parent
7c57e7d617
commit
bcb6f02f1a
@ -249,7 +249,7 @@ begin
|
||||
PrevItem := ChildPoListBox.Items[Idx]
|
||||
else
|
||||
PrevItem := '';
|
||||
debugln('TPoCheckerForm.LangFilterChange: PrevItem = "',PrevItem,'"');
|
||||
//debugln('TPoCheckerForm.LangFilterChange: PrevItem = "',PrevItem,'"');
|
||||
Filter := LangFilter.Items.Strings[LangFilter.ItemIndex];
|
||||
if (LangFilter.ItemIndex > 0) then
|
||||
begin
|
||||
@ -775,7 +775,6 @@ end;
|
||||
|
||||
procedure TPoCheckerForm.SaveConfig;
|
||||
begin
|
||||
FPoCheckerSettings.SaveSettingsOnExit := True; //ToDo: create a checkbox for this
|
||||
FPoCheckerSettings.LastSelectedFile := FSelectedPoName;
|
||||
FPoCheckerSettings.SelectDirectoryFilename := SelectDirectoryDialog.Filename;
|
||||
FPoCheckerSettings.OpenDialogFilename := OpenDialog.FileName;
|
||||
|
@ -29,8 +29,6 @@ type
|
||||
FSelectDirectoryFilename: String;
|
||||
FTestTypes: TPoTestTypes;
|
||||
FTestOptions: TPoTestOptions;
|
||||
FLoadSettings: Boolean;
|
||||
FSaveSettingsOnExit: Boolean;
|
||||
FMasterPoList: TStringList;
|
||||
FChildPoList: TStringList;
|
||||
FLastSelectedFile: String;
|
||||
@ -59,7 +57,7 @@ type
|
||||
procedure SaveChildrenPoList;
|
||||
procedure SetChildPoList(AValue: TStrings);
|
||||
procedure SetMasterPoList(AValue: TStrings);
|
||||
|
||||
procedure ResetAllProperties;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -68,7 +66,6 @@ type
|
||||
procedure SaveConfig;
|
||||
|
||||
property Filename: String read FFilename;
|
||||
property SaveSettingsOnExit: Boolean read FSaveSettingsOnExit write FSaveSettingsOnExit;
|
||||
property TestTypes: TPoTestTypes read FTestTypes write FTestTypes;
|
||||
property TestOptions: TPoTestOptions read FTestOptions write FTestOptions;
|
||||
property ExternalEditorName: String read FExternalEditorName write FExternalEditorName;
|
||||
@ -437,18 +434,34 @@ begin
|
||||
FMasterPoList.Assign(AValue);
|
||||
end;
|
||||
|
||||
constructor TPoCheckerSettings.Create;
|
||||
procedure TPoCheckerSettings.ResetAllProperties;
|
||||
begin
|
||||
try
|
||||
FTestTypes := [];
|
||||
FTestOptions := [];
|
||||
FMainFormGeometry := Rect(-1,-1,-1,-1);
|
||||
FMainFormGeometry := DefaultRect;
|
||||
FGraphFormGeometry := DefaultRect;
|
||||
FResultsFormGeometry := DefaultRect;
|
||||
FMainFormWindowState := wsNormal;
|
||||
FResultsFormWindowState := wsNormal;
|
||||
FGraphFormWindowState := wsNormal;
|
||||
FExternalEditorName := '';
|
||||
FOpenDialogFilename := '';
|
||||
FSelectDirectoryFilename := '';
|
||||
FLastSelectedFile := '';
|
||||
if Assigned(FMasterPoList) then FMasterPoList.Free;
|
||||
FMasterPoList := TStringList.Create;
|
||||
FMasterPoList.Sorted := True;
|
||||
FMasterPoList.Duplicates := dupIgnore;
|
||||
if Assigned(FChildPoList) then FChildPoList.Free;
|
||||
FChildPoList := TStringList.Create;
|
||||
FChildPoList.Sorted := True;
|
||||
FChildPoList.Duplicates := dupIgnore;
|
||||
end;
|
||||
|
||||
constructor TPoCheckerSettings.Create;
|
||||
begin
|
||||
try
|
||||
ResetAllProperties;
|
||||
{$ifdef POCHECKERSTANDALONE}
|
||||
FFilename := GetAndCreateConfigPath;
|
||||
if (FFilename <> '') then FFilename := AppendPathDelim(FFilename);
|
||||
@ -482,9 +495,6 @@ end;
|
||||
procedure TPoCheckerSettings.LoadConfig;
|
||||
begin
|
||||
try
|
||||
FLoadSettings := FConfig.GetValue(pLoadSettings+'Value',False);
|
||||
if FLoadSettings then
|
||||
begin
|
||||
FTestTypes := LoadTestTypes;
|
||||
FTestOptions := LoadTestOptions;
|
||||
FLastSelectedFile := LoadLastSelectedFile;
|
||||
@ -494,10 +504,8 @@ begin
|
||||
LoadWindowsGeometry;
|
||||
LoadMasterPoList(FMasterPoList);
|
||||
LoadChildPoList(FChildPoList);
|
||||
end;
|
||||
except
|
||||
FTestTypes := [];
|
||||
FTestOptions := [];
|
||||
ResetAllProperties;
|
||||
debugln('TPoCheckerSettings.LoadConfig: Error loading config.');
|
||||
end;
|
||||
end;
|
||||
@ -506,9 +514,9 @@ procedure TPoCheckerSettings.SaveConfig;
|
||||
begin
|
||||
try
|
||||
FConfig.SetDeleteValue('Version','1.0','');
|
||||
FConfig.SetValue(pLoadSettings+'Value',FSaveSettingsOnExit);
|
||||
if FSaveSettingsOnExit then
|
||||
begin
|
||||
//the next line can be reomoved after some time
|
||||
FConfig.DeletePath(pLoadSettings);
|
||||
|
||||
SaveLastSelectedFile;
|
||||
SaveTestTypes;
|
||||
SaveTestOptions;
|
||||
@ -518,12 +526,6 @@ begin
|
||||
SaveWindowsGeometry;
|
||||
SaveMasterPoList;
|
||||
SaveChildrenPoList;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FConfig.DeletePath(pMasterPoFiles);
|
||||
FConfig.DeletePath(pChildPoFiles);
|
||||
end;
|
||||
FConfig.WriteToDisk;
|
||||
except
|
||||
debugln('TPoCheckerSettings.SaveConfig: Error saving config.');
|
||||
|
Loading…
Reference in New Issue
Block a user