Opkman: Show community description in the hint window.

git-svn-id: trunk@58756 -
This commit is contained in:
balazs 2018-08-22 08:04:06 +00:00
parent 3a70dfe1f1
commit ad0354c154
6 changed files with 144 additions and 31 deletions

View File

@ -215,6 +215,7 @@ resourcestring
rsMainFrm_rsUninstall_Nothing = 'None of the checked packages are installed. Nothing to uninstall.'; rsMainFrm_rsUninstall_Nothing = 'None of the checked packages are installed. Nothing to uninstall.';
rsMainFrm_rsUninstall_Error = 'Cannot uninstall package "%s"!'; rsMainFrm_rsUninstall_Error = 'Cannot uninstall package "%s"!';
rsMainFrm_rsDestDirError = 'Cannot create directory "%s". Operation aborted.'; rsMainFrm_rsDestDirError = 'Cannot create directory "%s". Operation aborted.';
rsMainFrm_rsPackageInformation = 'Quick package information for "%s"';
//progress form //progress form
rsProgressFrm_Caption0 = 'Downloading packages'; rsProgressFrm_Caption0 = 'Downloading packages';

View File

@ -15,22 +15,116 @@ object ShowHintFrm: TShowHintFrm
OnKeyUp = FormKeyUp OnKeyUp = FormKeyUp
PopupMode = pmExplicit PopupMode = pmExplicit
LCLVersion = '1.9.0.0' LCLVersion = '1.9.0.0'
object sbLazPackages: TScrollBox object pnMain: TPanel
Left = 0 AnchorSideLeft.Control = Owner
Height = 325 AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 10
Height = 315
Top = 0 Top = 0
Width = 563 Width = 543
HorzScrollBar.Page = 1
VertScrollBar.Page = 1
Align = alClient Align = alClient
AutoSize = True Anchors = [akLeft, akRight, akBottom]
BorderStyle = bsNone BorderSpacing.Left = 10
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
BevelInner = bvLowered
ClientHeight = 315
ClientWidth = 543
Color = 15460842
ParentColor = False
TabOrder = 0 TabOrder = 0
object pnPackageName: TPanel
AnchorSideLeft.Control = pnMain
AnchorSideRight.Control = pnMain
AnchorSideRight.Side = asrBottom
Left = 12
Height = 22
Top = 2
Width = 519
Align = alTop
BorderSpacing.Left = 10
BorderSpacing.Right = 10
BevelOuter = bvNone
Caption = 'Package Name'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
end
object pnDescription: TPanel
Left = 2
Height = 57
Top = 24
Width = 539
Align = alTop
BevelOuter = bvNone
ClientHeight = 57
ClientWidth = 539
ParentFont = False
TabOrder = 1
object mDescription: TMemo
AnchorSideLeft.Control = pnDescription
AnchorSideTop.Control = pnDescription
AnchorSideRight.Control = pnDescription
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnDescription
AnchorSideBottom.Side = asrBottom
Left = 10
Height = 53
Top = 2
Width = 519
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Top = 2
BorderSpacing.Right = 10
BorderSpacing.Bottom = 2
BorderStyle = bsNone
Color = 15460842
Font.CharSet = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Pitch = fpVariable
Font.Quality = fqDraft
Lines.Strings = (
'aaaaaaaaaa'
'bbbbbbbb'
)
ParentFont = False
ReadOnly = True
TabOrder = 0
end
end
object sbLazPackages: TScrollBox
AnchorSideLeft.Control = pnMain
AnchorSideTop.Control = pnDescription
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pnMain
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pnMain
AnchorSideBottom.Side = asrBottom
Left = 12
Height = 228
Top = 83
Width = 519
HorzScrollBar.Page = 1
VertScrollBar.Page = 1
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 10
BorderSpacing.Top = 2
BorderSpacing.Right = 10
BorderSpacing.Bottom = 2
BorderStyle = bsNone
TabOrder = 2
end
end end
object tmWait: TTimer object tmWait: TTimer
Enabled = False Enabled = False
OnTimer = tmWaitTimer OnTimer = tmWaitTimer
left = 7 left = 40
top = 12 top = 160
end end
end end

View File

@ -33,7 +33,7 @@ uses
//LCL //LCL
Controls, Graphics, Dialogs, ExtCtrls, Menus, LCLType, Controls, Graphics, Dialogs, ExtCtrls, Menus, LCLType,
//Interface //Interface
LCLIntf, LCLIntf, StdCtrls,
//OpkMan //OpkMan
virtualtrees; virtualtrees;
@ -42,6 +42,10 @@ type
{ TShowHintFrm } { TShowHintFrm }
TShowHintFrm = class(TForm) TShowHintFrm = class(TForm)
mDescription: TMemo;
pnDescription: TPanel;
pnMain: TPanel;
pnPackageName: TPanel;
sbLazPackages: TScrollBox; sbLazPackages: TScrollBox;
tmWait: TTimer; tmWait: TTimer;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -69,8 +73,8 @@ implementation
{ TShowHintFrm } { TShowHintFrm }
uses opkman_visualtree, opkman_serializablepackages, opkman_showhintbase uses opkman_visualtree, opkman_serializablepackages, opkman_showhintbase,
{$IFDEF LclGtk2}, gtk2 {$ENDIF}; opkman_options, opkman_const {$IFDEF LclGtk2}, gtk2 {$ENDIF};
procedure TShowHintFrm.FormCreate(Sender: TObject); procedure TShowHintFrm.FormCreate(Sender: TObject);
begin begin
@ -167,7 +171,9 @@ var
TotHeight: Integer; TotHeight: Integer;
begin begin
Data := VisualTree.VST.GetNodeData(ANode); Data := VisualTree.VST.GetNodeData(ANode);
Caption := Data^.PackageDisplayName; Caption := Format(rsMainFrm_rsPackageInformation, [Data^.PackageDisplayName]);
pnPackageName.Caption := Data^.PackageDisplayName;
mDescription.Text := Data^.CommunityDescription;
for I := FFrames.Count - 1 downto 0 do for I := FFrames.Count - 1 downto 0 do
begin begin
CurFrame := TfrShowHint(FFrames.Items[I]); CurFrame := TfrShowHint(FFrames.Items[I]);
@ -189,8 +195,7 @@ begin
CurFrame.Init; CurFrame.Init;
CurFrame.pnPackageName.Caption := ' ' + LazPackage.Name; CurFrame.pnPackageName.Caption := ' ' + LazPackage.Name;
FFrames.Add(CurFrame); FFrames.Add(CurFrame);
if FFrames.Count > 1 then CurFrame.pnBase.BorderSpacing.Bottom := 5;
CurFrame.pnBase.BorderSpacing.Bottom := 5;
CurFrame.Parent := sbLazPackages; CurFrame.Parent := sbLazPackages;
CurFrame.CalcHeight(CurFrame.mDescription, Trim(LazPackage.Description)); CurFrame.CalcHeight(CurFrame.mDescription, Trim(LazPackage.Description));
CurFrame.CalcHeight(CurFrame.mLicense, Trim(LazPackage.License)); CurFrame.CalcHeight(CurFrame.mLicense, Trim(LazPackage.License));
@ -201,9 +206,13 @@ begin
end; end;
Node := VisualTree.VST.GetNextSibling(Node); Node := VisualTree.VST.GetNextSibling(Node);
end; end;
if (TotHeight < 51) or (TotHeight > 325) then // if FFrames.Count > 1 then
TotHeight := 325; TfrShowHint(FFrames.Items[0]).pnBuffer.Visible := True;
TotHeight := TotHeight + pnPackageName.Height + pnDescription.Height + 25;
if (TotHeight < 51) or (TotHeight > 350) then
TotHeight := 350;
Self.Height := TotHeight; Self.Height := TotHeight;
sbLazPackages.SetFocus;
end; end;
procedure TShowHintFrm.SetupTimer(const AInterval: Integer); procedure TShowHintFrm.SetupTimer(const AInterval: Integer);

View File

@ -10,28 +10,25 @@ object frShowHint: TfrShowHint
DesignLeft = 388 DesignLeft = 388
DesignTop = 227 DesignTop = 227
object pnBase: TPanel object pnBase: TPanel
Left = 10 Left = 0
Height = 178 Height = 178
Top = 10 Top = 10
Width = 539 Width = 559
Align = alClient Align = alClient
BorderSpacing.Left = 10
BorderSpacing.Top = 10 BorderSpacing.Top = 10
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
BevelInner = bvLowered BevelInner = bvLowered
ClientHeight = 178 ClientHeight = 178
ClientWidth = 539 ClientWidth = 559
TabOrder = 0 TabOrder = 0
object pnDescription: TPanel object pnDescription: TPanel
Left = 2 Left = 2
Height = 73 Height = 73
Top = 24 Top = 24
Width = 535 Width = 555
Align = alTop Align = alTop
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 73 ClientHeight = 73
ClientWidth = 535 ClientWidth = 555
ParentFont = False ParentFont = False
TabOrder = 0 TabOrder = 0
object mDescription: TMemo object mDescription: TMemo
@ -44,7 +41,7 @@ object frShowHint: TfrShowHint
Left = 20 Left = 20
Height = 51 Height = 51
Top = 19 Top = 19
Width = 508 Width = 528
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 20 BorderSpacing.Left = 20
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -78,11 +75,11 @@ object frShowHint: TfrShowHint
Left = 2 Left = 2
Height = 79 Height = 79
Top = 97 Top = 97
Width = 535 Width = 555
Align = alTop Align = alTop
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 79 ClientHeight = 79
ClientWidth = 535 ClientWidth = 555
ParentFont = False ParentFont = False
TabOrder = 1 TabOrder = 1
object mLicense: TMemo object mLicense: TMemo
@ -95,7 +92,7 @@ object frShowHint: TfrShowHint
Left = 20 Left = 20
Height = 51 Height = 51
Top = 19 Top = 19
Width = 508 Width = 528
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 20 BorderSpacing.Left = 20
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -124,7 +121,7 @@ object frShowHint: TfrShowHint
Left = 2 Left = 2
Height = 22 Height = 22
Top = 2 Top = 2
Width = 535 Width = 555
Align = alTop Align = alTop
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Package Name' Caption = 'Package Name'
@ -133,4 +130,14 @@ object frShowHint: TfrShowHint
TabOrder = 2 TabOrder = 2
end end
end end
object pnBuffer: TPanel
Left = 0
Height = 10
Top = 188
Width = 559
Align = alBottom
BevelOuter = bvNone
TabOrder = 1
Visible = False
end
end end

View File

@ -40,6 +40,7 @@ type
lbLicense: TLabel; lbLicense: TLabel;
mDescription: TMemo; mDescription: TMemo;
mLicense: TMemo; mLicense: TMemo;
pnBuffer: TPanel;
pnPackageName: TPanel; pnPackageName: TPanel;
pnBase: TPanel; pnBase: TPanel;
pnDescription: TPanel; pnDescription: TPanel;

View File

@ -468,6 +468,7 @@ begin
GrandChildData^.DataType := 19; GrandChildData^.DataType := 19;
Inc(UniqueID); Inc(UniqueID);
GrandChildData^.ButtonID := UniqueID; GrandChildData^.ButtonID := UniqueID;
Data^.CommunityDescription := SerializablePackages.Items[I].CommunityDescription;;
end; end;
FVST.SortTree(0, VirtualTrees.sdAscending); FVST.SortTree(0, VirtualTrees.sdAscending);
ExpandEx; ExpandEx;