diff --git a/components/onlinepackagemanager/opkman_const.pas b/components/onlinepackagemanager/opkman_const.pas index 7508e1f2c9..6905b86543 100644 --- a/components/onlinepackagemanager/opkman_const.pas +++ b/components/onlinepackagemanager/opkman_const.pas @@ -63,7 +63,7 @@ resourcestring rsLazarusPackageManager = 'Online Package Manager'; //main form - rsPackagesFound = '(%s packages found)'; + rsPackagesFound = '(%s repository packages found, containing %s lpk files, total size %s)'; rsMainFrm_VSTHeaderColumn_PackageName = 'Packages'; rsMainFrm_VSTHeaderColumn_LazarusPackage = 'Lazarus Package (.lpk)'; rsMainFrm_VSTHeaderColumn_Repository = 'Repository'; diff --git a/components/onlinepackagemanager/opkman_mainfrm.pas b/components/onlinepackagemanager/opkman_mainfrm.pas index 9bb002d02e..5e2a815f73 100644 --- a/components/onlinepackagemanager/opkman_mainfrm.pas +++ b/components/onlinepackagemanager/opkman_mainfrm.pas @@ -365,8 +365,7 @@ begin SetupMessage; mJSON.Text := AJSON; cbAll.Checked := False; - Caption := rsLazarusPackageManager + ' ' + Format(rsPackagesFound, [ - IntToStr(SerializablePackages.Count)]); + Caption := rsLazarusPackageManager + ' ' + SerializablePackages.QuickStatistics; if Assigned(Updates) then Updates.StartUpdate; end; diff --git a/components/onlinepackagemanager/opkman_serializablepackages.pas b/components/onlinepackagemanager/opkman_serializablepackages.pas index 4481c89275..d378a44427 100644 --- a/components/onlinepackagemanager/opkman_serializablepackages.pas +++ b/components/onlinepackagemanager/opkman_serializablepackages.pas @@ -289,6 +289,7 @@ type function GetPackageInstallState(const AMetaPackage: TMetaPackage): Integer; overload; procedure DeleteDownloadedZipFiles; procedure Sort(const ASortType: TSortType; const ASortOrder: TSortOrder); + function QuickStatistics: String; public property Count: Integer read GetCount; property DownloadCount: Integer read GetDownloadCount; @@ -1437,6 +1438,23 @@ begin end; end; +function TSerializablePackages.QuickStatistics: String; +var + I, J: Integer; + LazPackCnt: Integer; + TotSize: Int64; +begin + LazPackCnt := 0; + TotSize := 0; + for I := 0 to Count - 1 do + begin + TotSize := TotSize + Items[I].RepositoryFileSize; + for J := 0 to Items[I].FLazarusPackages.Count - 1 do + Inc(LazPackCnt); + end; + Result := Format(rsPackagesFound, [IntToStr(SerializablePackages.Count), IntToStr(LazPackCnt), FormatSize(TotSize)]); +end; + function TSerializablePackages.IsDependencyOk(PackageDependency: TPackageDependency; DependencyPackage: TLazarusPackage): Boolean; var