mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:39:20 +02:00
fppkg: Fixed package filtering and some cleanup
git-svn-id: trunk@54612 -
This commit is contained in:
parent
4d5f7394a0
commit
cfff97567b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1449,7 +1449,6 @@ components/fppkg/src/fppkg_optionsfrm.pas svneol=native#text/plain
|
||||
components/fppkg/src/fppkgpackagemanager.lpk svneol=native#text/plain
|
||||
components/fppkg/src/fppkgpackagemanager.pas svneol=native#text/plain
|
||||
components/fppkg/src/fppkgworkerthread.pas svneol=native#text/plain
|
||||
components/fppkg/src/laz_pkgcommands.pas svneol=native#text/plain
|
||||
components/fppkg/src/laz_pkgrepos.pas svneol=native#text/plain
|
||||
components/fppkg/src/lazfppkgmanagerintf.pas svneol=native#text/plain
|
||||
components/fppkg/standalone/lazarusfppkg.ico -text svneol=unset#image/x-icon
|
||||
|
@ -77,8 +77,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPkgDetailsForm.FormShow(Sender: TObject);
|
||||
var
|
||||
pkg: TLazPackageData;
|
||||
begin
|
||||
if PackageName = '' then
|
||||
exit;
|
||||
@ -86,17 +84,17 @@ begin
|
||||
//pkg := FLazPackages.FindPackage(PackageName);
|
||||
|
||||
NameLabel.Caption := PackageName;
|
||||
DescriptionMemo.Text:= pkg.Description;
|
||||
// DescriptionMemo.Text:= pkg.Description;
|
||||
|
||||
AuthorLabel.Caption:= 'Author: ' + pkg.Author;
|
||||
VersionLabel.Caption:= 'Version: ' + pkg.AvialableVersion;
|
||||
LicenseLabel.Caption:= 'License: ' + pkg.License;
|
||||
HomePageURLLabel.Caption:= 'Homepage: ' + pkg.HomepageURL;
|
||||
DownloadURLLabel.Caption:= 'Download: ' + pkg.DownloadURL;
|
||||
FileNameLabel.Caption:= 'Filename: ' + pkg.FileName;
|
||||
EmailLabel.Caption:= 'Email: ' + pkg.Email;
|
||||
OSLabel.Caption:= 'OS: ' + pkg.OS;
|
||||
CPULabel.Caption:= 'CPU: ' + pkg.CPU;
|
||||
// AuthorLabel.Caption:= 'Author: ' + pkg.Author;
|
||||
// VersionLabel.Caption:= 'Version: ' + pkg.AvialableVersion;
|
||||
// LicenseLabel.Caption:= 'License: ' + pkg.License;
|
||||
// HomePageURLLabel.Caption:= 'Homepage: ' + pkg.HomepageURL;
|
||||
// DownloadURLLabel.Caption:= 'Download: ' + pkg.DownloadURL;
|
||||
// FileNameLabel.Caption:= 'Filename: ' + pkg.FileName;
|
||||
// EmailLabel.Caption:= 'Email: ' + pkg.Email;
|
||||
// OSLabel.Caption:= 'OS: ' + pkg.OS;
|
||||
// CPULabel.Caption:= 'CPU: ' + pkg.CPU;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -11,7 +11,7 @@ object FppkgForm: TFppkgForm
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.7'
|
||||
LCLVersion = '1.9.0.0'
|
||||
object ToolBar: TToolBar
|
||||
Left = 0
|
||||
Height = 56
|
||||
|
@ -143,9 +143,9 @@ type
|
||||
|
||||
function PkgColumnValue(AName: string; pkg: TLazPackage): string;
|
||||
|
||||
function FindSearchPhrase(pkg: TLazPackageData): boolean;
|
||||
function FindCategory(pkg: TLazPackageData): boolean;
|
||||
function FindSupport(pkg: TLazPackageData): boolean;
|
||||
function FindSearchPhrase(pkg: TLazPackage): boolean;
|
||||
function FindCategory(pkg: TLazPackage): boolean;
|
||||
function FindSupport(pkg: TLazPackage): boolean;
|
||||
procedure GetSelectedPackages(var s: TStrings);
|
||||
|
||||
procedure MaybeCreateLocalDirs;
|
||||
@ -527,6 +527,7 @@ begin
|
||||
OptionsForm.ShowModal;
|
||||
|
||||
//to be sure setup the view again
|
||||
SetupColumns;
|
||||
UpdatePackageListView;
|
||||
end;
|
||||
|
||||
@ -608,7 +609,6 @@ end;
|
||||
procedure TFppkgForm.HandleWorkerThreadDone(var Msg: TLMessage);
|
||||
var
|
||||
s: String;
|
||||
SB: TMemoScrollbar;
|
||||
begin
|
||||
FLogMonitor.Enter;
|
||||
try
|
||||
@ -634,7 +634,7 @@ begin
|
||||
ForceDirectories(FFPpkg.Options.GlobalSection.CompilerConfigDir);
|
||||
end;
|
||||
|
||||
function TFppkgForm.FindSearchPhrase(pkg: TLazPackageData): boolean;
|
||||
function TFppkgForm.FindSearchPhrase(pkg: TLazPackage): boolean;
|
||||
var
|
||||
i: integer;
|
||||
searchmask: string;
|
||||
@ -659,7 +659,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFppkgForm.FindCategory(pkg: TLazPackageData): boolean;
|
||||
function TFppkgForm.FindCategory(pkg: TLazPackage): boolean;
|
||||
var
|
||||
i: integer;
|
||||
searchmask: string;
|
||||
@ -688,19 +688,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFppkgForm.FindSupport(pkg: TLazPackageData): boolean;
|
||||
function TFppkgForm.FindSupport(pkg: TLazPackage): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
//FPC
|
||||
Result := Result or (SupportCheckGroup.Checked[0] and (pkg.Category = 'FPC'));
|
||||
Result := Result or (SupportCheckGroup.Checked[0] and (pkg.Support = 'FPC'));
|
||||
|
||||
//Lazarus
|
||||
Result := Result or (SupportCheckGroup.Checked[1] and (pkg.Category = 'Lazarus'));
|
||||
Result := Result or (SupportCheckGroup.Checked[1] and (pkg.Support = 'Lazarus'));
|
||||
|
||||
//Rest
|
||||
Result := Result or (SupportCheckGroup.Checked[2] and
|
||||
((pkg.Category <> 'FPC') and (pkg.Category <> 'Lazarus')));
|
||||
((pkg.Support <> 'FPC') and (pkg.Support <> 'Lazarus')));
|
||||
end;
|
||||
|
||||
procedure TFppkgForm.GetSelectedPackages(var s: TStrings);
|
||||
@ -738,6 +738,8 @@ begin
|
||||
'Version' : Result := pkg.Version;
|
||||
'Info' : Result := pkg.GetInfo(FFPpkg);
|
||||
'Description' : Result := pkg.Description;
|
||||
'Keywords': Result := pkg.Keywords;
|
||||
'Category': Result := pkg.Category;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -757,7 +759,7 @@ begin
|
||||
begin
|
||||
pkg := FLazPackages.PkgData[i];
|
||||
|
||||
//if FindSearchPhrase(pkg) and FindCategory(pkg) and FindSupport(pkg) then
|
||||
if FindSearchPhrase(pkg) and FindCategory(pkg) and FindSupport(pkg) then
|
||||
begin
|
||||
li := PackageListView.Items.Add;
|
||||
|
||||
@ -775,14 +777,14 @@ begin
|
||||
end;
|
||||
|
||||
//add images to supported packages
|
||||
{ if LowerCase(pkg.Support) = 'fpc' then
|
||||
if LowerCase(pkg.Support) = 'fpc' then
|
||||
li.ImageIndex := FPC_SUPPORTED
|
||||
else
|
||||
if LowerCase(pkg.Support) = 'lazarus' then
|
||||
li.ImageIndex := LAZARUS_SUPPORTED
|
||||
else
|
||||
li.ImageIndex := COMMUNITY_SUPPORTED;
|
||||
} end;
|
||||
end;
|
||||
end;
|
||||
|
||||
PackageListView.EndUpdate;
|
||||
@ -809,11 +811,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ s := TStringList.Create;
|
||||
DoRun(FppkgCfg, 'laz_list', s);
|
||||
s.Free;
|
||||
end; }
|
||||
|
||||
//setup the categories listview
|
||||
CategoryCheckListBox.Clear;
|
||||
CategoryCheckListBox.Items.Add('All');
|
||||
@ -821,10 +818,10 @@ begin
|
||||
begin
|
||||
pkg := FLazPackages.PkgData[i];
|
||||
|
||||
// if pkg.Category = '' then
|
||||
cat := 'Unknown';
|
||||
// else
|
||||
// cat := pkg.Category;
|
||||
if pkg.Category = '' then
|
||||
cat := 'Unknown'
|
||||
else
|
||||
cat := pkg.Category;
|
||||
|
||||
if CategoryCheckListBox.Items.IndexOf(cat) = -1 then
|
||||
CategoryCheckListBox.Items.Add(cat);
|
||||
|
@ -171,11 +171,10 @@ begin
|
||||
AddPkgColumn('Info', True);
|
||||
|
||||
AddPkgColumn('Description', False);
|
||||
{
|
||||
AddPkgColumn('Keywords', False);
|
||||
AddPkgColumn('Category', False);
|
||||
AddPkgColumn('Support', False);
|
||||
AddPkgColumn('Author', False);
|
||||
{ AddPkgColumn('Author', False);
|
||||
AddPkgColumn('License', False);
|
||||
AddPkgColumn('HomepageURL', False);
|
||||
AddPkgColumn('DownloadURL', False);
|
||||
@ -280,21 +279,12 @@ begin
|
||||
//setup verbosity
|
||||
with VerbosityCheckGroup do
|
||||
begin
|
||||
{$IF FPC_FULLVERSION > 20602}
|
||||
Checked[Items.IndexOf('Error')] := llError in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Warning')] := llWarning in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Info')] := llInfo in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Commands')] := llCommands in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Debug')] := llDebug in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Progress')] := llProgres in LazPkgOptions.Verbosity;
|
||||
{$ELSE}
|
||||
Checked[Items.IndexOf('Error')] := vlError in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Warning')] := vlWarning in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Info')] := vlInfo in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Commands')] := vlCommands in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Debug')] := vlDebug in LazPkgOptions.Verbosity;
|
||||
Checked[Items.IndexOf('Progress')] := vlProgres in LazPkgOptions.Verbosity;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -306,7 +296,6 @@ begin
|
||||
LazPkgOptions.Verbosity := [];
|
||||
with VerbosityCheckGroup do
|
||||
begin
|
||||
{$IF FPC_FULLVERSION > 20602}
|
||||
if Checked[Items.IndexOf('Error')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [llError];
|
||||
if Checked[Items.IndexOf('Warning')] then
|
||||
@ -319,20 +308,6 @@ begin
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [llDebug];
|
||||
if Checked[Items.IndexOf('Progress')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [llProgres];
|
||||
{$ELSE}
|
||||
if Checked[Items.IndexOf('Error')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlError];
|
||||
if Checked[Items.IndexOf('Warning')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlWarning];
|
||||
if Checked[Items.IndexOf('Info')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlInfo];
|
||||
if Checked[Items.IndexOf('Commands')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlCommands];
|
||||
if Checked[Items.IndexOf('Debug')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlDebug];
|
||||
if Checked[Items.IndexOf('Progress')] then
|
||||
LazPkgOptions.Verbosity := LazPkgOptions.Verbosity + [vlProgres];
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
Close;
|
||||
|
@ -1,30 +0,0 @@
|
||||
unit laz_pkgcommands;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
inter face
|
||||
|
||||
uses
|
||||
pkghandler;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
pkgglobals, pkgoptions, pkgdownload, pkgrepos, laz_pkgrepos, pkgfpmake;
|
||||
|
||||
type
|
||||
{ TCommandLazListPackages }
|
||||
|
||||
TCommandLazListPackages = Class(TPackagehandler)
|
||||
Public
|
||||
Procedure Execute;override;
|
||||
end;
|
||||
|
||||
procedure TCommandLazListPackages.Execute;
|
||||
begin
|
||||
//Laz_ListPackages;
|
||||
end;
|
||||
|
||||
initialization
|
||||
//RegisterPkgHandler('laz_list',TCommandLazListPackages);
|
||||
end.
|
@ -9,7 +9,7 @@ uses
|
||||
LMessages,
|
||||
fgl,
|
||||
pkgFppkg,
|
||||
fprepos{$IF FPC_FULLVERSION > 20602}, fpmkunit{$ENDIF};
|
||||
fprepos;
|
||||
|
||||
const
|
||||
WM_LogMessageWaiting = LM_USER + 1;
|
||||
@ -32,9 +32,12 @@ type
|
||||
FName: string;
|
||||
FPackageManager: TpkgFPpkg;
|
||||
FPPackageList: TLazFPPackageList;
|
||||
function GetCategory: string;
|
||||
function GetDefaultFPPackage: TFPPackage;
|
||||
function GetDescription: string;
|
||||
function GetKeywords: string;
|
||||
function GetState: TLazPackageInstallState;
|
||||
function GetSupport: string;
|
||||
function GetVersion: string;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -48,46 +51,21 @@ type
|
||||
property PackageManager: TpkgFPpkg read FPackageManager write FPackageManager;
|
||||
property Version: string read GetVersion;
|
||||
property Description: string read GetDescription;
|
||||
property Category: string read GetCategory;
|
||||
property Keywords: string read GetKeywords;
|
||||
property Support: string read GetSupport;
|
||||
end;
|
||||
|
||||
TLazPackageList = specialize TFPGObjectList<TLazPackage>;
|
||||
|
||||
type
|
||||
TLazPackageData = record
|
||||
Name: string;
|
||||
InstalledVersion: string;
|
||||
AvialableVersion: string;
|
||||
Description: string;
|
||||
Keywords: string;
|
||||
Category: string;
|
||||
State: string;
|
||||
Support: string;
|
||||
Author: string;
|
||||
License: string;
|
||||
HomepageURL: string;
|
||||
DownloadURL: string;
|
||||
FileName: string;
|
||||
Email: string;
|
||||
OS: string;
|
||||
CPU: string;
|
||||
end;
|
||||
|
||||
TPackageSortType = (stNone);
|
||||
|
||||
{ TLazPackages }
|
||||
|
||||
TLazPackages = class(TComponent)
|
||||
private
|
||||
FPackageManager: TpkgFPpkg;
|
||||
FPkgData: array of TLazPackageData;
|
||||
FSort: TPackageSortType;
|
||||
FSortType: TPackageSortType;
|
||||
FLazPackageList: TLazPackageList;
|
||||
function GetCount: integer;
|
||||
function GetLazPackage(index: integer): TLazPackage;
|
||||
function GetPkgData(index: integer): TLazPackageData;
|
||||
procedure SetSort(const AValue: TPackageSortType);
|
||||
procedure SetSortType(const AValue: TPackageSortType);
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -96,12 +74,8 @@ type
|
||||
property PkgData[index: integer]: TLazPackage read GetLazPackage;
|
||||
property Count: integer read GetCount;
|
||||
procedure AddFPPackage(AFPPackage: TFPPackage);
|
||||
procedure Add(Pkg: TLazPackageData);
|
||||
procedure Clear;
|
||||
|
||||
property SortType: TPackageSortType read FSortType write SetSortType;
|
||||
procedure Sort;
|
||||
function FindPackage(const AName: string): TLazPackageData;
|
||||
property PackageManager: TpkgFPpkg read FPackageManager write FPackageManager;
|
||||
end;
|
||||
|
||||
@ -137,11 +111,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetCategory: string;
|
||||
begin
|
||||
Result := GetDefaultFPPackage.Category;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetDescription: string;
|
||||
begin
|
||||
Result := GetDefaultFPPackage.Description;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetKeywords: string;
|
||||
begin
|
||||
Result := GetDefaultFPPackage.Keywords;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetInfo(PackageManager: TpkgFPpkg): string;
|
||||
var
|
||||
Package: TFPPackage;
|
||||
@ -176,6 +160,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetSupport: string;
|
||||
begin
|
||||
result := GetDefaultFPPackage.Support;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetVersion: string;
|
||||
begin
|
||||
result := GetDefaultFPPackage.Version.AsString;
|
||||
@ -205,11 +194,6 @@ end;
|
||||
|
||||
{ TLazPackages }
|
||||
|
||||
function TLazPackages.GetPkgData(index: integer): TLazPackageData;
|
||||
begin
|
||||
Result := FPkgData[index];
|
||||
end;
|
||||
|
||||
function TLazPackages.GetCount: integer;
|
||||
begin
|
||||
Result := FLazPackageList.Count;
|
||||
@ -220,26 +204,10 @@ begin
|
||||
result := FLazPackageList.Items[index];
|
||||
end;
|
||||
|
||||
procedure TLazPackages.SetSort(const AValue: TPackageSortType);
|
||||
begin
|
||||
if FSort = AValue then
|
||||
exit;
|
||||
FSort := AValue;
|
||||
end;
|
||||
|
||||
procedure TLazPackages.SetSortType(const AValue: TPackageSortType);
|
||||
begin
|
||||
if FSortType = AValue then
|
||||
exit;
|
||||
FSortType := AValue;
|
||||
end;
|
||||
|
||||
constructor TLazPackages.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FLazPackageList := TLazPackageList.Create(False);
|
||||
|
||||
SortType := stNone;
|
||||
end;
|
||||
|
||||
destructor TLazPackages.Destroy;
|
||||
@ -268,34 +236,10 @@ begin
|
||||
FLazPackageList.Add(LazPackage);
|
||||
end;
|
||||
|
||||
procedure TLazPackages.Add(Pkg: TLazPackageData);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TLazPackages.Clear;
|
||||
begin
|
||||
FLazPackageList.Clear;
|
||||
end;
|
||||
|
||||
procedure TLazPackages.Sort;
|
||||
begin
|
||||
case SortType of
|
||||
//no sorting
|
||||
stNone:
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackages.FindPackage(const AName: string): TLazPackageData;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
if FPkgData[i].Name = AName then
|
||||
begin
|
||||
Result := FPkgData[i];
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="7">
|
||||
<Units Count="4">
|
||||
<Unit0>
|
||||
<Filename Value="lazarusfppkg.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -60,25 +60,13 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\src\laz_pkgcommands.pas"/>
|
||||
<Filename Value="..\src\laz_pkgrepos.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\src\laz_pkgrepos.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\src\laz_pkghandler.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\src\fppkg_lpk.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\..\fpc-trunk\packages\fppkg\src\pkgfclweb.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit6>
|
||||
</Unit3>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -89,7 +77,7 @@
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\src;..\..\..\..\fpc-trunk\packages\fppkg\src"/>
|
||||
<OtherUnitFiles Value="..\src"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
@ -118,6 +106,7 @@
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
<Enabled Value="False"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
|
Loading…
Reference in New Issue
Block a user