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_Error = 'Cannot uninstall package "%s"!';
rsMainFrm_rsDestDirError = 'Cannot create directory "%s". Operation aborted.';
rsMainFrm_rsPackageInformation = 'Quick package information for "%s"';
//progress form
rsProgressFrm_Caption0 = 'Downloading packages';

View File

@ -15,22 +15,116 @@ object ShowHintFrm: TShowHintFrm
OnKeyUp = FormKeyUp
PopupMode = pmExplicit
LCLVersion = '1.9.0.0'
object sbLazPackages: TScrollBox
Left = 0
Height = 325
object pnMain: TPanel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 10
Height = 315
Top = 0
Width = 563
HorzScrollBar.Page = 1
VertScrollBar.Page = 1
Width = 543
Align = alClient
AutoSize = True
BorderStyle = bsNone
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
BevelInner = bvLowered
ClientHeight = 315
ClientWidth = 543
Color = 15460842
ParentColor = False
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
object tmWait: TTimer
Enabled = False
OnTimer = tmWaitTimer
left = 7
top = 12
left = 40
top = 160
end
end

View File

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

View File

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

View File

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

View File

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