mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 12:00:15 +02:00
ide: check that version info table has all the required fields and add missing after loading from the project info
git-svn-id: trunk@23714 -
This commit is contained in:
parent
310b5da0c2
commit
5256443704
@ -51,11 +51,13 @@ type
|
|||||||
function GetValues(Key: string): string;
|
function GetValues(Key: string): string;
|
||||||
procedure SetValues(Key: string; const AValue: string);
|
procedure SetValues(Key: string; const AValue: string);
|
||||||
protected
|
protected
|
||||||
function KeyToIndex(const aKey: String): Integer;
|
|
||||||
procedure DoModified;
|
procedure DoModified;
|
||||||
|
function KeyToIndex(const aKey: String): Integer;
|
||||||
public
|
public
|
||||||
constructor Create(const aName: string); reintroduce;
|
constructor Create(const aName: string); reintroduce;
|
||||||
procedure Add(const aKey, aValue: string); reintroduce;
|
procedure Add(const aKey, aValue: string); reintroduce;
|
||||||
|
procedure AddDefault;
|
||||||
|
procedure AddRequired;
|
||||||
procedure Clear; reintroduce;
|
procedure Clear; reintroduce;
|
||||||
procedure Delete(const aIndex: integer); overload; reintroduce;
|
procedure Delete(const aIndex: integer); overload; reintroduce;
|
||||||
procedure Delete(const aKey: string); overload; reintroduce;
|
procedure Delete(const aKey: string); overload; reintroduce;
|
||||||
@ -433,6 +435,7 @@ begin
|
|||||||
StringTable.Clear;
|
StringTable.Clear;
|
||||||
for i := 0 to Node.Attributes.Count - 1 do
|
for i := 0 to Node.Attributes.Count - 1 do
|
||||||
StringTable[Node.Attributes[i].NodeName] := Node.Attributes[i].NodeValue;
|
StringTable[Node.Attributes[i].NodeName] := Node.Attributes[i].NodeValue;
|
||||||
|
StringTable.AddRequired;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -598,6 +601,22 @@ begin
|
|||||||
DoModified;
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectVersionStringTable.AddDefault;
|
||||||
|
begin
|
||||||
|
Add('Comments', '');
|
||||||
|
Add('CompanyName', '');
|
||||||
|
Add('FileDescription', '');
|
||||||
|
Add('FileVersion', '');
|
||||||
|
Add('InternalName', '');
|
||||||
|
Add('LegalCopyright', '');
|
||||||
|
Add('LegalTrademarks', '');
|
||||||
|
Add('OriginalFilename', '');
|
||||||
|
// - PrivateBuild
|
||||||
|
Add('ProductName', '');
|
||||||
|
Add('ProductVersion', '');
|
||||||
|
// - SpecialBuild
|
||||||
|
end;
|
||||||
|
|
||||||
function TProjectVersionStringTable.KeyToIndex(const aKey: String): Integer;
|
function TProjectVersionStringTable.KeyToIndex(const aKey: String): Integer;
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
@ -617,19 +636,7 @@ end;
|
|||||||
constructor TProjectVersionStringTable.Create(const aName: string);
|
constructor TProjectVersionStringTable.Create(const aName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(aName);
|
inherited Create(aName);
|
||||||
|
AddDefault;
|
||||||
Add('Comments', '');
|
|
||||||
Add('CompanyName', '');
|
|
||||||
Add('FileDescription', '');
|
|
||||||
Add('FileVersion', '');
|
|
||||||
Add('InternalName', '');
|
|
||||||
Add('LegalCopyright', '');
|
|
||||||
Add('LegalTrademarks', '');
|
|
||||||
Add('OriginalFilename', '');
|
|
||||||
// - PrivateBuild
|
|
||||||
Add('ProductName', '');
|
|
||||||
Add('ProductVersion', '');
|
|
||||||
// - SpecialBuild
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectVersionStringTable.Add(const aKey, aValue: string);
|
procedure TProjectVersionStringTable.Add(const aKey, aValue: string);
|
||||||
@ -638,6 +645,25 @@ begin
|
|||||||
DoModified;
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectVersionStringTable.AddRequired;
|
||||||
|
const
|
||||||
|
RequiredFields: array[0..6] of String = (
|
||||||
|
'CompanyName',
|
||||||
|
'FileDescription',
|
||||||
|
'FileVersion',
|
||||||
|
'InternalName',
|
||||||
|
'OriginalFilename',
|
||||||
|
'ProductName',
|
||||||
|
'ProductVersion'
|
||||||
|
);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i := Low(RequiredFields) to High(RequiredFields) do
|
||||||
|
if KeyToIndex(RequiredFields[i]) = -1 then
|
||||||
|
Add(RequiredFields[i], '');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectVersionStringTable.Clear;
|
procedure TProjectVersionStringTable.Clear;
|
||||||
begin
|
begin
|
||||||
if Count > 0 then
|
if Count > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user