mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 07:59:28 +02:00
Refresh package description and license after update. Request by @minesadorada.
git-svn-id: trunk@53650 -
This commit is contained in:
parent
43faacf7f0
commit
705c67a190
@ -670,7 +670,6 @@ begin
|
|||||||
VisualTree.UpdatePackageStates;
|
VisualTree.UpdatePackageStates;
|
||||||
if NeedToRebuild then
|
if NeedToRebuild then
|
||||||
begin
|
begin
|
||||||
TerminateUpdates;
|
|
||||||
EnableDisableControls(False);
|
EnableDisableControls(False);
|
||||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||||
EnableDisableControls(True);
|
EnableDisableControls(True);
|
||||||
@ -750,7 +749,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
if NeedToRebuild then
|
if NeedToRebuild then
|
||||||
begin
|
begin
|
||||||
TerminateUpdates;
|
|
||||||
EnableDisableControls(False);
|
EnableDisableControls(False);
|
||||||
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
IDECommands.ExecuteIDECommand(Self, ecBuildLazarus);
|
||||||
EnableDisableControls(True);
|
EnableDisableControls(True);
|
||||||
|
@ -132,6 +132,8 @@ type
|
|||||||
FPackageAbsolutePath: String;
|
FPackageAbsolutePath: String;
|
||||||
FInstalledFileName: String;
|
FInstalledFileName: String;
|
||||||
FInstalledFileVersion: String;
|
FInstalledFileVersion: String;
|
||||||
|
FInstalledFileDescription: String;
|
||||||
|
FInstalledFileLincese: String;
|
||||||
FUpdateVersion: String;
|
FUpdateVersion: String;
|
||||||
FForceNotify: Boolean;
|
FForceNotify: Boolean;
|
||||||
FInternalVersion: Integer;
|
FInternalVersion: Integer;
|
||||||
@ -165,6 +167,8 @@ type
|
|||||||
property InternalVersion: Integer read FInternalVersion write FInternalVersion;
|
property InternalVersion: Integer read FInternalVersion write FInternalVersion;
|
||||||
property InternalVersionOld: Integer read FInternalVersionOld write FInternalVersionOld;
|
property InternalVersionOld: Integer read FInternalVersionOld write FInternalVersionOld;
|
||||||
property HasUpdate: Boolean read FHasUpdate write FHasUpdate;
|
property HasUpdate: Boolean read FHasUpdate write FHasUpdate;
|
||||||
|
property InstalledFileDescription: String read FInstalledFileDescription write FInstalledFileDescription;
|
||||||
|
property InstalledFileLincese: String read FInstalledFileLincese write FInstalledFileLincese;
|
||||||
published
|
published
|
||||||
property Name: String read FName write FName;
|
property Name: String read FName write FName;
|
||||||
property Author: String read FAuthor write FAuthor;
|
property Author: String read FAuthor write FAuthor;
|
||||||
@ -259,7 +263,9 @@ type
|
|||||||
function IsPackageExtracted(const APackage: TPackage): Boolean;
|
function IsPackageExtracted(const APackage: TPackage): Boolean;
|
||||||
function IsPackageInstalled(const APackageFile: TPackageFile; const APackageBaseDir: String): Boolean;
|
function IsPackageInstalled(const APackageFile: TPackageFile; const APackageBaseDir: String): Boolean;
|
||||||
function IsAtLeastOnePackageFileInstalled(const APackage: TPackage): Boolean;
|
function IsAtLeastOnePackageFileInstalled(const APackage: TPackage): Boolean;
|
||||||
function GetRuntimePackageVersion(const APath: String): String;
|
function GetPackageVersion(const APath: String): String;
|
||||||
|
function GetPackageDescription(const APath: String): String;
|
||||||
|
function GetPackageLicense(const APath: String): String;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -1038,7 +1044,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSerializablePackages.GetRuntimePackageVersion(const APath: String): String;
|
function TSerializablePackages.GetPackageVersion(const APath: String): String;
|
||||||
|
|
||||||
function VersionBound(const AVersion: Integer): Integer;
|
function VersionBound(const AVersion: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
@ -1073,6 +1079,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSerializablePackages.GetPackageDescription(const APath: String): String;
|
||||||
|
var
|
||||||
|
XMLConfig: TXMLConfig;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
XMLConfig := TXMLConfig.Create(APath);
|
||||||
|
try
|
||||||
|
Result := XMLConfig.GetValue('Package/Description/Value', '');
|
||||||
|
finally
|
||||||
|
XMLConfig.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSerializablePackages.GetPackageLicense(const APath: String): String;
|
||||||
|
var
|
||||||
|
XMLConfig: TXMLConfig;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
XMLConfig := TXMLConfig.Create(APath);
|
||||||
|
try
|
||||||
|
Result := XMLConfig.GetValue('Package/License/Value', '');
|
||||||
|
finally
|
||||||
|
XMLConfig.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TSerializablePackages.IsPackageInstalled(const APackageFile: TPackageFile;
|
function TSerializablePackages.IsPackageInstalled(const APackageFile: TPackageFile;
|
||||||
const APackageBaseDir: String): Boolean;
|
const APackageBaseDir: String): Boolean;
|
||||||
@ -1095,6 +1127,8 @@ function TSerializablePackages.IsPackageInstalled(const APackageFile: TPackageFi
|
|||||||
IntToStr(Package.Version.Minor) + '.' +
|
IntToStr(Package.Version.Minor) + '.' +
|
||||||
IntToStr(Package.Version.Release) + '.' +
|
IntToStr(Package.Version.Release) + '.' +
|
||||||
IntToStr(Package.Version.Build);
|
IntToStr(Package.Version.Build);
|
||||||
|
APackageFile.InstalledFileDescription := GetPackageDescription(Package.Filename);
|
||||||
|
APackageFile.InstalledFileLincese := GetPackageLicense(Package.Filename);
|
||||||
Result := True;
|
Result := True;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
@ -1114,7 +1148,9 @@ begin
|
|||||||
if Result then
|
if Result then
|
||||||
begin
|
begin
|
||||||
APackageFile.InstalledFileName := Options.LocalRepositoryPackages + APackageBaseDir + APackageFile.FPackageRelativePath + APackageFile.Name;
|
APackageFile.InstalledFileName := Options.LocalRepositoryPackages + APackageBaseDir + APackageFile.FPackageRelativePath + APackageFile.Name;
|
||||||
APackageFile.InstalledFileVersion := GetRuntimePackageVersion(APackageFile.InstalledFileName);
|
APackageFile.InstalledFileVersion := GetPackageVersion(APackageFile.InstalledFileName);
|
||||||
|
APackageFile.InstalledFileDescription := GetPackageDescription(APackageFile.InstalledFileName);
|
||||||
|
APackageFile.InstalledFileLincese := GetPackageLicense(APackageFile.InstalledFileName);
|
||||||
Result := True;
|
Result := True;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -321,7 +321,10 @@ begin
|
|||||||
GrandChildNode := FVST.AddChild(ChildNode);
|
GrandChildNode := FVST.AddChild(ChildNode);
|
||||||
FVST.IsDisabled[GrandChildNode] := FVST.IsDisabled[GrandChildNode^.Parent];
|
FVST.IsDisabled[GrandChildNode] := FVST.IsDisabled[GrandChildNode^.Parent];
|
||||||
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
||||||
GrandChildData^.Description := PackageFile.Description;
|
if ChildData^.InstalledVersion <> '' then
|
||||||
|
GrandChildData^.Description := PackageFile.InstalledFileDescription
|
||||||
|
else
|
||||||
|
GrandChildData^.Description := PackageFile.Description;
|
||||||
GrandChildData^.DataType := 3;
|
GrandChildData^.DataType := 3;
|
||||||
Inc(UniqueID);
|
Inc(UniqueID);
|
||||||
CreateButton(UniqueID, GrandChildData);
|
CreateButton(UniqueID, GrandChildData);
|
||||||
@ -360,7 +363,10 @@ begin
|
|||||||
GrandChildNode := FVST.AddChild(ChildNode);
|
GrandChildNode := FVST.AddChild(ChildNode);
|
||||||
FVST.IsDisabled[GrandChildNode] := FVST.IsDisabled[GrandChildNode^.Parent];
|
FVST.IsDisabled[GrandChildNode] := FVST.IsDisabled[GrandChildNode^.Parent];
|
||||||
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
||||||
GrandChildData^.License := PackageFile.License;
|
if ChildData^.InstalledVersion <> '' then
|
||||||
|
GrandChildData^.License := PackageFile.InstalledFileLincese
|
||||||
|
else
|
||||||
|
GrandChildData^.License := PackageFile.License;
|
||||||
GrandChildData^.DataType := 9;
|
GrandChildData^.DataType := 9;
|
||||||
Inc(UniqueID);
|
Inc(UniqueID);
|
||||||
CreateButton(UniqueID, GrandChildData);
|
CreateButton(UniqueID, GrandChildData);
|
||||||
@ -1035,11 +1041,17 @@ begin
|
|||||||
if Data^.DataType in [3..19] then
|
if Data^.DataType in [3..19] then
|
||||||
begin
|
begin
|
||||||
FVST.IsDisabled[Node] := FVST.IsDisabled[Node^.Parent];
|
FVST.IsDisabled[Node] := FVST.IsDisabled[Node^.Parent];
|
||||||
FVST.ReinitNode(Node, False);
|
|
||||||
FVST.RepaintNode(Node);
|
|
||||||
if (Data^.DataType = 3) or (Data^.DataType = 9) then
|
if (Data^.DataType = 3) or (Data^.DataType = 9) then
|
||||||
|
begin
|
||||||
|
case Data^.DataType of
|
||||||
|
3: Data^.Description := PackageFile.InstalledFileDescription;
|
||||||
|
9: Data^.License := PackageFile.InstalledFileLincese;
|
||||||
|
end;
|
||||||
if Assigned(Data^.Button) then
|
if Assigned(Data^.Button) then
|
||||||
Data^.Button.Enabled := not FVST.IsDisabled[Node];
|
Data^.Button.Enabled := not FVST.IsDisabled[Node];
|
||||||
|
end;
|
||||||
|
FVST.ReinitNode(Node, False);
|
||||||
|
FVST.RepaintNode(Node);
|
||||||
end;
|
end;
|
||||||
Node := FVST.GetNext(Node);
|
Node := FVST.GetNext(Node);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user