mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 04:19:20 +02:00
IDE: install/uninstall package dialog: fixed icons, added info about current state
git-svn-id: trunk@36518 -
This commit is contained in:
parent
6066a53c8c
commit
eb22eb28b9
@ -4015,6 +4015,10 @@ resourcestring
|
|||||||
|
|
||||||
// open installed packages dialog
|
// open installed packages dialog
|
||||||
lisOIPFilename = 'Filename: %s';
|
lisOIPFilename = 'Filename: %s';
|
||||||
|
lisCurrentState = 'Current state: ';
|
||||||
|
lisInstalled = 'installed';
|
||||||
|
lisNotInstalled = 'not installed';
|
||||||
|
lisState = 'State: ';
|
||||||
lisOIPThisPackageWasAutomaticallyCreated = '%sThis package was automatically created';
|
lisOIPThisPackageWasAutomaticallyCreated = '%sThis package was automatically created';
|
||||||
lisOIPThisPackageIsInstalledButTheLpkFileWasNotFound = '%sThis package is '
|
lisOIPThisPackageIsInstalledButTheLpkFileWasNotFound = '%sThis package is '
|
||||||
+'installed, but the lpk file was not found';
|
+'installed, but the lpk file was not found';
|
||||||
|
@ -101,7 +101,8 @@ type
|
|||||||
procedure SetOldInstalledPackages(const AValue: TPkgDependency);
|
procedure SetOldInstalledPackages(const AValue: TPkgDependency);
|
||||||
procedure AssignOldInstalledPackagesToList;
|
procedure AssignOldInstalledPackagesToList;
|
||||||
function PackageInInstallList(PkgName: string): boolean;
|
function PackageInInstallList(PkgName: string): boolean;
|
||||||
function ChooseImageIndex(Str: String; Data: TObject; var AIsEnabled: Boolean): Integer;
|
function GetPkgImgIndex(APackage: TLazPackage; InInstallList: boolean): integer;
|
||||||
|
function GetAvailablePkgImageIndex(Str: String; Data: TObject; var AIsEnabled: Boolean): Integer;
|
||||||
procedure UpdateAvailablePackages(Immediately: boolean = false);
|
procedure UpdateAvailablePackages(Immediately: boolean = false);
|
||||||
procedure UpdateNewInstalledPackages;
|
procedure UpdateNewInstalledPackages;
|
||||||
procedure OnIteratePackages(APackageID: TLazPackageID);
|
procedure OnIteratePackages(APackageID: TLazPackageID);
|
||||||
@ -176,7 +177,7 @@ begin
|
|||||||
NoteLabel.Caption:=lisToInstallYouMustCompileAndRestartTheIDE;
|
NoteLabel.Caption:=lisToInstallYouMustCompileAndRestartTheIDE;
|
||||||
|
|
||||||
AvailablePkgGroupBox.Caption:=lisDoNotInstall;
|
AvailablePkgGroupBox.Caption:=lisDoNotInstall;
|
||||||
AvailableFilterEdit.OnGetImageIndex:=@ChooseImageIndex;
|
AvailableFilterEdit.OnGetImageIndex:=@GetAvailablePkgImageIndex;
|
||||||
|
|
||||||
ExportButton.Caption:=lisExportList;
|
ExportButton.Caption:=lisExportList;
|
||||||
ImportButton.Caption:=lisImportList;
|
ImportButton.Caption:=lisImportList;
|
||||||
@ -360,21 +361,40 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TInstallPkgSetDialog.ChooseImageIndex(Str: String; Data: TObject;
|
function TInstallPkgSetDialog.GetPkgImgIndex(APackage: TLazPackage;
|
||||||
var AIsEnabled: Boolean): Integer;
|
InInstallList: boolean): integer;
|
||||||
var
|
|
||||||
Pkg: TLazPackageID;
|
|
||||||
APackage: TLazPackage;
|
|
||||||
begin
|
begin
|
||||||
Pkg:=TLazPackageID(Data);
|
if APackage.Installed<>pitNope then begin
|
||||||
Result:=ImgIndexPackage;
|
// is not currently installed
|
||||||
if (Pkg is TLazPackage) then begin
|
if InInstallList then begin
|
||||||
APackage:=TLazPackage(Pkg);
|
// is installed and will be installed
|
||||||
if APackage.Installed<>pitNope then
|
Result:=ImgIndexPackage;
|
||||||
Result:=ImgIndexUninstallPackage; // is installed and will be uninstalled
|
end
|
||||||
|
else begin
|
||||||
|
// is installed and will be uninstalled
|
||||||
|
Result:=ImgIndexUninstallPackage;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// is currently installed
|
||||||
|
if InInstallList then begin
|
||||||
|
// is not installed and will be installed
|
||||||
|
Result:=ImgIndexInstallPackage;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// is not installed and will be not be installed
|
||||||
|
Result:=ImgIndexPackage;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TInstallPkgSetDialog.GetAvailablePkgImageIndex(Str: String; Data: TObject;
|
||||||
|
var AIsEnabled: Boolean): Integer;
|
||||||
|
begin
|
||||||
|
Result:=ImgIndexPackage;
|
||||||
|
if (Data is TLazPackage) then
|
||||||
|
Result:=GetPkgImgIndex(TLazPackage(Data),false);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TInstallPkgSetDialog.UpdateAvailablePackages(Immediately: boolean);
|
procedure TInstallPkgSetDialog.UpdateAvailablePackages(Immediately: boolean);
|
||||||
var
|
var
|
||||||
ANode: TAVLTreeNode;
|
ANode: TAVLTreeNode;
|
||||||
@ -438,8 +458,7 @@ begin
|
|||||||
ImgIndex:=ImgIndexInstallPackage;
|
ImgIndex:=ImgIndexInstallPackage;
|
||||||
if NewPackageID is TLazPackage then begin
|
if NewPackageID is TLazPackage then begin
|
||||||
APackage:=TLazPackage(NewPackageID);
|
APackage:=TLazPackage(NewPackageID);
|
||||||
if APackage.Installed<>pitNope then
|
ImgIndex:=GetPkgImgIndex(APackage,true);
|
||||||
ImgIndex:=ImgIndexInstalledPackage; // stay installed
|
|
||||||
end;
|
end;
|
||||||
TVNode.ImageIndex:=ImgIndex;
|
TVNode.ImageIndex:=ImgIndex;
|
||||||
TVNode.SelectedIndex:=ImgIndex;
|
TVNode.SelectedIndex:=ImgIndex;
|
||||||
@ -506,6 +525,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInstallPkgSetDialog.UpdatePackageInfo(Tree: TTreeView);
|
procedure TInstallPkgSetDialog.UpdatePackageInfo(Tree: TTreeView);
|
||||||
|
var
|
||||||
|
InfoStr: string;
|
||||||
|
|
||||||
|
procedure AddState(const NewState: string);
|
||||||
|
begin
|
||||||
|
if (InfoStr<>'') and (InfoStr[length(InfoStr)]<>' ') then
|
||||||
|
InfoStr:=InfoStr+', ';
|
||||||
|
InfoStr:=InfoStr+NewState;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
PkgName: String;
|
PkgName: String;
|
||||||
PkgID: TLazPackageID;
|
PkgID: TLazPackageID;
|
||||||
@ -554,10 +583,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if Author<>'' then
|
if Author<>'' then
|
||||||
PkgInfoMemo.Lines.Add(lisPckOptsAuthor + ' ' + Author);
|
PkgInfoMemo.Lines.Add(lisPckOptsAuthor + ': ' + Author);
|
||||||
if Description<>'' then
|
if Description<>'' then
|
||||||
PkgInfoMemo.Lines.Add(lisPckOptsDescriptionAbstract
|
PkgInfoMemo.Lines.Add(lisPckOptsDescriptionAbstract
|
||||||
+ ': ' + Description);
|
+ ': ' + Description);
|
||||||
|
if FSelectedPkg<>nil then
|
||||||
|
begin
|
||||||
|
PkgInfoMemo.Lines.Add(Format(lisOIPFilename, [FSelectedPkg.Filename]));
|
||||||
|
InfoStr:=lisCurrentState;
|
||||||
|
if FSelectedPkg.Installed<>pitNope then
|
||||||
|
AddState(lisInstalled)
|
||||||
|
else
|
||||||
|
AddState(lisNotInstalled);
|
||||||
|
if FSelectedPkg.AutoCreated then
|
||||||
|
AddState(lisPckExplAutoCreated);
|
||||||
|
PkgInfoMemo.Lines.Add(InfoStr);
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
PkgId.Free;
|
PkgId.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user