mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 21:39:12 +02:00
Opkman: Improve progress dialog. Issue #31499, patch from AlexeyT.
git-svn-id: trunk@54472 -
This commit is contained in:
parent
63a3095b0d
commit
c2ded78c5a
@ -1,11 +1,11 @@
|
|||||||
object ProgressFrm: TProgressFrm
|
object ProgressFrm: TProgressFrm
|
||||||
Left = 534
|
Left = 513
|
||||||
Height = 284
|
Height = 320
|
||||||
Top = 243
|
Top = 288
|
||||||
Width = 502
|
Width = 502
|
||||||
BorderIcons = []
|
BorderIcons = []
|
||||||
Caption = 'Downloading packages'
|
Caption = 'Downloading packages'
|
||||||
ClientHeight = 284
|
ClientHeight = 320
|
||||||
ClientWidth = 502
|
ClientWidth = 502
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Constraints.MinHeight = 240
|
Constraints.MinHeight = 240
|
||||||
@ -15,53 +15,21 @@ object ProgressFrm: TProgressFrm
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnKeyPress = FormKeyPress
|
OnKeyPress = FormKeyPress
|
||||||
OnResize = FormResize
|
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
PopupMode = pmExplicit
|
PopupMode = pmExplicit
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
LCLVersion = '1.7'
|
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
|
object pnLabels: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 243
|
Height = 249
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 497
|
Width = 497
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Right = 5
|
BorderSpacing.Right = 5
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 243
|
ClientHeight = 249
|
||||||
ClientWidth = 497
|
ClientWidth = 497
|
||||||
TabOrder = 1
|
TabOrder = 0
|
||||||
object lbPackageData: TLabel
|
object lbPackageData: TLabel
|
||||||
Left = 88
|
Left = 88
|
||||||
Height = 1
|
Height = 1
|
||||||
@ -96,7 +64,7 @@ object ProgressFrm: TProgressFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lbPackage: TLabel
|
object lbPackage: TLabel
|
||||||
Left = 16
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 12
|
Top = 12
|
||||||
Width = 47
|
Width = 47
|
||||||
@ -104,7 +72,7 @@ object ProgressFrm: TProgressFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lbSpeed: TLabel
|
object lbSpeed: TLabel
|
||||||
Left = 16
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 34
|
Top = 34
|
||||||
Width = 35
|
Width = 35
|
||||||
@ -112,7 +80,7 @@ object ProgressFrm: TProgressFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lbElapsed: TLabel
|
object lbElapsed: TLabel
|
||||||
Left = 16
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 56
|
Top = 56
|
||||||
Width = 43
|
Width = 43
|
||||||
@ -120,7 +88,7 @@ object ProgressFrm: TProgressFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lbRemaining: TLabel
|
object lbRemaining: TLabel
|
||||||
Left = 16
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 78
|
Top = 78
|
||||||
Width = 60
|
Width = 60
|
||||||
@ -128,40 +96,78 @@ object ProgressFrm: TProgressFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object pb: TProgressBar
|
object pb: TProgressBar
|
||||||
Left = 16
|
AnchorSideTop.Control = lbReceived
|
||||||
Height = 20
|
AnchorSideTop.Side = asrBottom
|
||||||
Top = 164
|
Left = 8
|
||||||
Width = 473
|
Height = 19
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Top = 171
|
||||||
|
Width = 481
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 6
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object pbTotal: TProgressBar
|
object pbTotal: TProgressBar
|
||||||
Left = 16
|
AnchorSideTop.Control = lbReceivedTotal
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 8
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 208
|
Top = 217
|
||||||
Width = 473
|
Width = 481
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 6
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object lbReceived: TLabel
|
object lbReceived: TLabel
|
||||||
Left = 16
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 149
|
Top = 150
|
||||||
Width = 50
|
Width = 50
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Received:'
|
Caption = 'Received:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lbReceivedTotal: TLabel
|
object lbReceivedTotal: TLabel
|
||||||
Left = 16
|
AnchorSideTop.Control = pb
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 8
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 193
|
Top = 196
|
||||||
Width = 74
|
Width = 74
|
||||||
Anchors = [akLeft, akBottom]
|
BorderSpacing.Top = 6
|
||||||
Caption = 'Received total'
|
Caption = 'Received total'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
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
|
object imTree: TImageList
|
||||||
left = 123
|
left = 123
|
||||||
top = 72
|
top = 72
|
||||||
|
@ -29,17 +29,16 @@ interface
|
|||||||
uses
|
uses
|
||||||
SysUtils,
|
SysUtils,
|
||||||
// LCL
|
// LCL
|
||||||
Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, ExtCtrls,
|
Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, ExtCtrls, ButtonPanel,
|
||||||
// OpkMan
|
// OpkMan
|
||||||
opkman_installer, opkman_common, opkman_const, opkman_downloader, opkman_zipper,
|
opkman_installer, opkman_common, opkman_const, opkman_downloader, opkman_zipper,
|
||||||
opkman_VirtualTrees;
|
opkman_VirtualTrees, Classes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TProgressFrm }
|
{ TProgressFrm }
|
||||||
|
|
||||||
TProgressFrm = class(TForm)
|
TProgressFrm = class(TForm)
|
||||||
bCancel: TButton;
|
|
||||||
cbExtractOpen: TCheckBox;
|
cbExtractOpen: TCheckBox;
|
||||||
imTree: TImageList;
|
imTree: TImageList;
|
||||||
lbElapsed: TLabel;
|
lbElapsed: TLabel;
|
||||||
@ -54,15 +53,14 @@ type
|
|||||||
lbSpeedData: TLabel;
|
lbSpeedData: TLabel;
|
||||||
pb: TProgressBar;
|
pb: TProgressBar;
|
||||||
pbTotal: TProgressBar;
|
pbTotal: TProgressBar;
|
||||||
|
bpCancel: TButtonPanel;
|
||||||
pnLabels: TPanel;
|
pnLabels: TPanel;
|
||||||
pnButtons: TPanel;
|
|
||||||
tmWait: TTimer;
|
tmWait: TTimer;
|
||||||
procedure bCancelClick(Sender: TObject);
|
procedure bCancelClick(Sender: TObject);
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure FormKeyPress(Sender: TObject; var Key: char);
|
procedure FormKeyPress(Sender: TObject; var Key: char);
|
||||||
procedure FormResize(Sender: TObject);
|
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure tmWaitTimer(Sender: TObject);
|
procedure tmWaitTimer(Sender: TObject);
|
||||||
private
|
private
|
||||||
@ -205,11 +203,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
procedure TProgressFrm.DoOnPackageDownloadProgress(Sender: TObject; AFrom, ATo: String;
|
||||||
ACnt, ATotCnt: Integer; ACurPos, ACurSize, ATotPos, ATotSize: Int64;
|
ACnt, ATotCnt: Integer; ACurPos, ACurSize, ATotPos, ATotSize: Int64;
|
||||||
AElapsed, ARemaining, ASpeed: LongInt);
|
AElapsed, ARemaining, ASpeed: LongInt);
|
||||||
@ -503,7 +496,7 @@ end;
|
|||||||
procedure TProgressFrm.bCancelClick(Sender: TObject);
|
procedure TProgressFrm.bCancelClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Self.Caption := rsProgressFrm_Info4;
|
Self.Caption := rsProgressFrm_Info4;
|
||||||
bCancel.Enabled := False;
|
bpCancel.CancelButton.Enabled := False;
|
||||||
FCanClose := True;
|
FCanClose := True;
|
||||||
case FType of
|
case FType of
|
||||||
0: begin
|
0: begin
|
||||||
@ -580,10 +573,10 @@ begin
|
|||||||
lbSpeedData.Caption := rsProgressFrm_lbSpeedCalc_Caption;
|
lbSpeedData.Caption := rsProgressFrm_lbSpeedCalc_Caption;
|
||||||
lbElapsed.Caption := rsProgressFrm_lbElapsed_Caption;
|
lbElapsed.Caption := rsProgressFrm_lbElapsed_Caption;
|
||||||
lbRemaining.Caption := rsProgressFrm_lbRemaining_Caption;
|
lbRemaining.Caption := rsProgressFrm_lbRemaining_Caption;
|
||||||
pb.Top := lbReceived.Top + lbReceived.Height + 1;
|
//pb.Top := lbReceived.Top + lbReceived.Height + 1;
|
||||||
pbTotal.Top := lbReceivedTotal.Top + lbReceivedTotal.Height + 1;
|
//pbTotal.Top := lbReceivedTotal.Top + lbReceivedTotal.Height + 1;
|
||||||
bCancel.Top := (pnButtons.Height - bCancel.Height) div 2;
|
//bCancel.Top := (bpCancel.Height - bCancel.Height) div 2;
|
||||||
cbExtractOpen.Top := bCancel.Top + (bCancel.Height - cbExtractOpen.Height) div 2;
|
//cbExtractOpen.Top := bCancel.Top + (bCancel.Height - cbExtractOpen.Height) div 2;
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user