Opkman: Improve progress dialog. Issue #31499, patch from AlexeyT.

git-svn-id: trunk@54472 -
This commit is contained in:
balazs 2017-03-24 07:06:31 +00:00
parent 63a3095b0d
commit c2ded78c5a
2 changed files with 71 additions and 72 deletions

View File

@ -1,11 +1,11 @@
object ProgressFrm: TProgressFrm
Left = 534
Height = 284
Top = 243
Left = 513
Height = 320
Top = 288
Width = 502
BorderIcons = []
Caption = 'Downloading packages'
ClientHeight = 284
ClientHeight = 320
ClientWidth = 502
Color = clBtnFace
Constraints.MinHeight = 240
@ -15,53 +15,21 @@ object ProgressFrm: TProgressFrm
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyPress = FormKeyPress
OnResize = FormResize
OnShow = FormShow
PopupMode = pmExplicit
Position = poOwnerFormCenter
LCLVersion = '1.7'
object pnButtons: TPanel
Left = 0
Height = 41
Top = 243
Width = 502
Align = alBottom
BevelOuter = bvNone
ClientHeight = 41
ClientWidth = 502
TabOrder = 0
object bCancel: TButton
Left = 192
Height = 26
Top = 7
Width = 96
Caption = 'Cancel'
ModalResult = 2
OnClick = bCancelClick
TabOrder = 0
end
object cbExtractOpen: TCheckBox
Left = 16
Height = 19
Top = 11
Width = 138
Caption = 'Extract after download'
Checked = True
State = cbChecked
TabOrder = 1
end
end
object pnLabels: TPanel
Left = 0
Height = 243
Height = 249
Top = 0
Width = 497
Align = alClient
BorderSpacing.Right = 5
BevelOuter = bvNone
ClientHeight = 243
ClientHeight = 249
ClientWidth = 497
TabOrder = 1
TabOrder = 0
object lbPackageData: TLabel
Left = 88
Height = 1
@ -96,7 +64,7 @@ object ProgressFrm: TProgressFrm
ParentColor = False
end
object lbPackage: TLabel
Left = 16
Left = 8
Height = 15
Top = 12
Width = 47
@ -104,7 +72,7 @@ object ProgressFrm: TProgressFrm
ParentColor = False
end
object lbSpeed: TLabel
Left = 16
Left = 8
Height = 15
Top = 34
Width = 35
@ -112,7 +80,7 @@ object ProgressFrm: TProgressFrm
ParentColor = False
end
object lbElapsed: TLabel
Left = 16
Left = 8
Height = 15
Top = 56
Width = 43
@ -120,7 +88,7 @@ object ProgressFrm: TProgressFrm
ParentColor = False
end
object lbRemaining: TLabel
Left = 16
Left = 8
Height = 15
Top = 78
Width = 60
@ -128,40 +96,78 @@ object ProgressFrm: TProgressFrm
ParentColor = False
end
object pb: TProgressBar
Left = 16
Height = 20
Top = 164
Width = 473
Anchors = [akLeft, akRight, akBottom]
AnchorSideTop.Control = lbReceived
AnchorSideTop.Side = asrBottom
Left = 8
Height = 19
Top = 171
Width = 481
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
TabOrder = 0
end
object pbTotal: TProgressBar
Left = 16
AnchorSideTop.Control = lbReceivedTotal
AnchorSideTop.Side = asrBottom
Left = 8
Height = 20
Top = 208
Width = 473
Anchors = [akLeft, akRight, akBottom]
Top = 217
Width = 481
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
TabOrder = 1
end
object lbReceived: TLabel
Left = 16
Left = 8
Height = 15
Top = 149
Top = 150
Width = 50
Anchors = [akLeft, akBottom]
Caption = 'Received:'
ParentColor = False
end
object lbReceivedTotal: TLabel
Left = 16
AnchorSideTop.Control = pb
AnchorSideTop.Side = asrBottom
Left = 8
Height = 15
Top = 193
Top = 196
Width = 74
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 6
Caption = 'Received total'
ParentColor = False
end
end
object bpCancel: TButtonPanel
AnchorSideTop.Side = asrCenter
Left = 6
Height = 34
Top = 280
Width = 490
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
CancelButton.OnClick = bCancelClick
TabOrder = 2
ShowButtons = [pbCancel]
end
object cbExtractOpen: TCheckBox
Left = 6
Height = 19
Top = 255
Width = 490
Align = alBottom
BorderSpacing.Around = 6
Caption = 'Extract after download'
Checked = True
State = cbChecked
TabOrder = 1
end
object imTree: TImageList
left = 123
top = 72

View File

@ -29,17 +29,16 @@ interface
uses
SysUtils,
// LCL
Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, ExtCtrls,
Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, ExtCtrls, ButtonPanel,
// OpkMan
opkman_installer, opkman_common, opkman_const, opkman_downloader, opkman_zipper,
opkman_VirtualTrees;
opkman_VirtualTrees, Classes;
type
{ TProgressFrm }
TProgressFrm = class(TForm)
bCancel: TButton;
cbExtractOpen: TCheckBox;
imTree: TImageList;
lbElapsed: TLabel;
@ -54,15 +53,14 @@ type
lbSpeedData: TLabel;
pb: TProgressBar;
pbTotal: TProgressBar;
bpCancel: TButtonPanel;
pnLabels: TPanel;
pnButtons: TPanel;
tmWait: TTimer;
procedure bCancelClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure tmWaitTimer(Sender: TObject);
private
@ -205,11 +203,6 @@ begin
end;
end;
procedure TProgressFrm.FormResize(Sender: TObject);
begin
bCancel.Left := (Self.Width - bCancel.Width) div 2;
end;
procedure TProgressFrm.DoOnPackageDownloadProgress(Sender: TObject; AFrom, ATo: String;
ACnt, ATotCnt: Integer; ACurPos, ACurSize, ATotPos, ATotSize: Int64;
AElapsed, ARemaining, ASpeed: LongInt);
@ -503,7 +496,7 @@ end;
procedure TProgressFrm.bCancelClick(Sender: TObject);
begin
Self.Caption := rsProgressFrm_Info4;
bCancel.Enabled := False;
bpCancel.CancelButton.Enabled := False;
FCanClose := True;
case FType of
0: begin
@ -580,10 +573,10 @@ begin
lbSpeedData.Caption := rsProgressFrm_lbSpeedCalc_Caption;
lbElapsed.Caption := rsProgressFrm_lbElapsed_Caption;
lbRemaining.Caption := rsProgressFrm_lbRemaining_Caption;
pb.Top := lbReceived.Top + lbReceived.Height + 1;
pbTotal.Top := lbReceivedTotal.Top + lbReceivedTotal.Height + 1;
bCancel.Top := (pnButtons.Height - bCancel.Height) div 2;
cbExtractOpen.Top := bCancel.Top + (bCancel.Height - cbExtractOpen.Height) div 2;
//pb.Top := lbReceived.Top + lbReceived.Height + 1;
//pbTotal.Top := lbReceivedTotal.Top + lbReceivedTotal.Height + 1;
//bCancel.Top := (bpCancel.Height - bCancel.Height) div 2;
//cbExtractOpen.Top := bCancel.Top + (bCancel.Height - cbExtractOpen.Height) div 2;
Application.ProcessMessages;
end;