ADD: Capability to queue extract operation

This commit is contained in:
Alexander Koblov 2015-11-04 11:58:49 +00:00
commit 0ab2249f92
4 changed files with 212 additions and 219 deletions

View file

@ -1,8 +1,8 @@
object frmExtractDlg: TfrmExtractDlg
Left = 540
Height = 225
Top = 144
Width = 528
inherited frmExtractDlg: TfrmExtractDlg
Left = 552
Height = 222
Top = 162
Width = 516
HelpContext = 160
HorzScrollBar.Page = 446
HorzScrollBar.Range = 437
@ -15,221 +15,217 @@ object frmExtractDlg: TfrmExtractDlg
BorderStyle = bsDialog
Caption = 'Unpack files'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 5
ClientHeight = 225
ClientWidth = 528
ChildSizing.TopBottomSpacing = 6
ClientHeight = 222
ClientWidth = 516
Constraints.MinWidth = 500
OnCreate = FormCreate
Position = poScreenCenter
SessionProperties = 'cbOverwrite.Checked'
LCLVersion = '1.0.4.0'
object pnlLabels: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = cbFileMask
AnchorSideBottom.Control = edtPassword
AnchorSideBottom.Side = asrBottom
inherited pnlContent: TPanel
Left = 6
Height = 157
Height = 148
Top = 5
Width = 211
Anchors = [akTop, akLeft, akBottom]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 157
ClientWidth = 211
Color = clForm
ParentColor = False
TabOrder = 7
object lblFileMask: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideTop.Control = pnlLabels
Left = 0
Height = 16
Top = 3
Width = 211
BorderSpacing.Top = 3
Caption = '&Extract files matching file mask:'
FocusControl = cbFileMask
ParentColor = False
end
object lblPassword: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideBottom.Control = pnlLabels
Width = 500
Align = alNone
ChildSizing.TopBottomSpacing = 4
ClientHeight = 148
ClientWidth = 500
Constraints.MinWidth = 500
object pnlLabels: TPanel[0]
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = cbFileMask
AnchorSideBottom.Control = edtPassword
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 16
Top = 138
Width = 188
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 3
Caption = '&Password for encrypted files:'
FocusControl = edtPassword
Height = 140
Top = 5
Width = 166
Anchors = [akTop, akLeft, akBottom]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 140
ClientWidth = 166
Color = clForm
ParentColor = False
TabOrder = 4
object lblFileMask: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideTop.Control = pnlLabels
Left = 0
Height = 15
Top = 3
Width = 166
BorderSpacing.Top = 3
Caption = '&Extract files matching file mask:'
FocusControl = cbFileMask
ParentColor = False
end
object lblPassword: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideBottom.Control = pnlLabels
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 15
Top = 122
Width = 151
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 3
Caption = '&Password for encrypted files:'
FocusControl = edtPassword
ParentColor = False
end
object lblExtractTo: TLabel
AnchorSideTop.Control = lblFileMask
AnchorSideTop.Side = asrBottom
Left = 0
Height = 15
Top = 26
Width = 86
BorderSpacing.Top = 8
Caption = 'To the &directory:'
FocusControl = edtExtractTo
ParentColor = False
end
end
object lblExtractTo: TLabel
AnchorSideTop.Control = lblFileMask
AnchorSideTop.Side = asrBottom
Left = 0
Height = 16
Top = 27
Width = 105
BorderSpacing.Top = 8
Caption = 'To the &directory:'
FocusControl = edtExtractTo
ParentColor = False
end
end
object cbFileMask: TComboBox
AnchorSideLeft.Control = pnlLabels
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 222
Height = 27
Top = 5
Width = 270
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 5
BorderSpacing.Top = 2
BorderSpacing.Right = 36
ItemHeight = 0
ParentFont = False
TabOrder = 0
Text = '*.*'
end
object btnOK: TButton
AnchorSideTop.Control = edtPassword
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnCancel
Left = 249
Height = 32
Top = 168
Width = 85
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.InnerBorder = 4
Caption = '&OK'
Default = True
ModalResult = 1
TabOrder = 4
end
object btnCancel: TButton
AnchorSideTop.Control = btnOK
AnchorSideRight.Control = btnHelp
Left = 340
Height = 32
Top = 168
Width = 85
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
BorderSpacing.InnerBorder = 4
Cancel = True
Caption = '&Cancel'
ModalResult = 2
TabOrder = 5
end
object btnHelp: TButton
AnchorSideTop.Control = btnCancel
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 431
Height = 32
Top = 168
Width = 85
Anchors = [akTop, akRight]
BorderSpacing.Right = 12
BorderSpacing.InnerBorder = 4
Caption = '&Help'
TabOrder = 6
end
object edtExtractTo: TDirectoryEdit
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = cbFileMask
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = cbFileMask
AnchorSideRight.Side = asrBottom
Left = 222
Height = 25
Top = 34
Width = 270
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
MaxLength = 0
TabOrder = 1
end
object edtPassword: TEdit
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = pnlCheckBoxes
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edtExtractTo
AnchorSideRight.Side = asrBottom
Left = 222
Height = 25
Top = 137
Width = 270
Anchors = [akTop, akLeft, akRight]
EchoMode = emPassword
Enabled = False
PasswordChar = '*'
TabOrder = 3
end
object pnlCheckBoxes: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = edtExtractTo
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 78
Top = 59
Width = 516
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BevelOuter = bvNone
ChildSizing.TopBottomSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 78
ClientWidth = 516
Color = clForm
ParentColor = False
TabOrder = 2
object cbInSeparateFolder: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 6
Width = 439
object cbFileMask: TComboBox[1]
AnchorSideLeft.Control = pnlLabels
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 5
Width = 321
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 5
BorderSpacing.Top = 2
Caption = 'Unpack each archive to a &separate subdir (name of the archive)'
BorderSpacing.Right = 36
ItemHeight = 15
ParentFont = False
TabOrder = 0
Text = '*.*'
end
object cbExtractPath: TCheckBox
object edtExtractTo: TDirectoryEdit[2]
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = cbFileMask
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 28
Width = 439
Caption = '&Unpack path names if stored with files'
Checked = True
OnChange = cbExtractPathChange
State = cbChecked
AnchorSideRight.Control = cbFileMask
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 30
Width = 321
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
MaxLength = 0
TabOrder = 1
end
object cbOverwrite: TCheckBox
object edtPassword: TEdit[3]
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = pnlCheckBoxes
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edtExtractTo
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 122
Width = 321
Anchors = [akTop, akLeft, akRight]
EchoMode = emPassword
Enabled = False
PasswordChar = '*'
TabOrder = 3
end
object pnlCheckBoxes: TPanel[4]
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = edtExtractTo
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 22
Top = 50
Width = 439
Caption = 'O&verwrite existing files'
Checked = True
State = cbChecked
Height = 69
Top = 53
Width = 506
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BevelOuter = bvNone
ChildSizing.TopBottomSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 69
ClientWidth = 506
Color = clForm
ParentColor = False
TabOrder = 2
object cbInSeparateFolder: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Top = 6
Width = 351
BorderSpacing.Top = 2
Caption = 'Unpack each archive to a &separate subdir (name of the archive)'
TabOrder = 0
end
object cbExtractPath: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Top = 25
Width = 351
Caption = '&Unpack path names if stored with files'
Checked = True
OnChange = cbExtractPathChange
State = cbChecked
TabOrder = 1
end
object cbOverwrite: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Top = 44
Width = 351
Caption = 'O&verwrite existing files'
Checked = True
State = cbChecked
TabOrder = 2
end
end
end
inherited pnlButtons: TPanel
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = DividerBevel
AnchorSideRight.Control = pnlContent
AnchorSideRight.Side = asrBottom
Left = 6
Top = 176
Width = 500
Align = alNone
Anchors = [akTop, akLeft, akRight]
ClientWidth = 500
inherited btnCancel: TBitBtn
Left = 318
end
inherited btnOK: TBitBtn
Left = 412
end
end
object DividerBevel: TDividerBevel[2]
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = pnlContent
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pnlContent
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 157
Width = 500
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
Font.Style = [fsBold]
ParentFont = False
end
inherited pmQueuePopup: TPopupMenu[3]
end
end

View file

@ -3,9 +3,6 @@ TFRMEXTRACTDLG.LBLFILEMASK.CAPTION=&Extract files matching file mask:
TFRMEXTRACTDLG.LBLPASSWORD.CAPTION=&Password for encrypted files:
TFRMEXTRACTDLG.LBLEXTRACTTO.CAPTION=To the &directory:
TFRMEXTRACTDLG.CBFILEMASK.TEXT=*.*
TFRMEXTRACTDLG.CBINSEPARATEFOLDER.CAPTION=Unpack each archive to a &separate subdir (name of the archive)
TFRMEXTRACTDLG.CBEXTRACTPATH.CAPTION=&Unpack path names if stored with files
TFRMEXTRACTDLG.CBOVERWRITE.CAPTION=O&verwrite existing files
TFRMEXTRACTDLG.BTNOK.CAPTION=&OK
TFRMEXTRACTDLG.BTNCANCEL.CAPTION=&Cancel
TFRMEXTRACTDLG.BTNHELP.CAPTION=&Help
TFRMEXTRACTDLG.CBINSEPARATEFOLDER.CAPTION=Unpack each archive to a &separate subdir (name of the archive)

View file

@ -28,25 +28,24 @@ unit fExtractDlg;
interface
uses
Classes, SysUtils, Forms, Controls, StdCtrls, EditBtn, ExtCtrls,
uFile, uFileSource, uArchiveFileSource;
Classes, SysUtils, Forms, Controls, StdCtrls, EditBtn, ExtCtrls, Buttons,
Menus, DividerBevel, uFile, uFileSource, uArchiveFileSource, fButtonForm,
uOperationsManager;
type
{ TfrmExtractDlg }
TfrmExtractDlg = class(TForm)
TfrmExtractDlg = class(TfrmButtonForm)
cbExtractPath: TCheckBox;
cbInSeparateFolder: TCheckBox;
cbOverwrite: TCheckBox;
DividerBevel: TDividerBevel;
edtPassword: TEdit;
edtExtractTo: TDirectoryEdit;
lblExtractTo: TLabel;
lblPassword: TLabel;
cbFileMask: TComboBox;
btnOK: TButton;
btnCancel: TButton;
btnHelp: TButton;
lblFileMask: TLabel;
pnlCheckBoxes: TPanel;
pnlLabels: TPanel;
@ -57,7 +56,7 @@ type
FArcType: String;
procedure SwitchOptions;
procedure ExtractArchive(ArchiveFileSource: IArchiveFileSource; TargetFileSource: IFileSource;
const TargetPath: String);
const TargetPath: String; QueueId: TOperationsManagerQueueIdentifier);
public
{ public declarations }
end;
@ -82,7 +81,6 @@ uses
uWcxArchiveFileSource,
uWcxArchiveCopyOutOperation,
uFileSourceOperationOptions,
uOperationsManager,
uMasks;
procedure ShowExtractDlg(SourceFileSource: IFileSource; var SourceFiles: TFiles;
@ -145,7 +143,7 @@ begin
if Assigned(Operation) then
begin
// Start operation.
OperationsManager.AddOperation(Operation);
OperationsManager.AddOperation(Operation, QueueIdentifier, False);
end
else
msgWarning(rsMsgNotImplemented);
@ -163,11 +161,12 @@ begin
// Check if there is a ArchiveFileSource for possible archive.
ArchiveFileSource := GetArchiveFileSource(SourceFileSource, SourceFiles[i]);
// Extract current archive
ExtractArchive(ArchiveFileSource, TargetFileSource, sDestPath);
// Extract current item, if files count > 1 then put to queue
if (I > 0) and (QueueIdentifier = FreeOperationsQueueId) then
ExtractArchive(ArchiveFileSource, TargetFileSource, sDestPath, SingleQueueId)
else
ExtractArchive(ArchiveFileSource, TargetFileSource, sDestPath, QueueIdentifier);
// Short pause, so that all operations are not spawned at once.
Sleep(100);
except
on E: Exception do
begin
@ -231,7 +230,8 @@ begin
end;
procedure TfrmExtractDlg.ExtractArchive(ArchiveFileSource: IArchiveFileSource;
TargetFileSource: IFileSource; const TargetPath: String);
TargetFileSource: IFileSource; const TargetPath: String;
QueueId: TOperationsManagerQueueIdentifier);
var
FilesToExtract: TFiles;
Operation: TFileSourceOperation;
@ -284,7 +284,7 @@ begin
end;
// Start operation.
OperationsManager.AddOperation(Operation);
OperationsManager.AddOperation(Operation, QueueId, False);
end
else
msgWarning(rsMsgNotImplemented);

View file

@ -244,10 +244,10 @@ inherited frmPackDlg: TfrmPackDlg
AnchorSideRight.Side = asrBottom
Left = 8
Height = 15
Top = 193
Top = 191
Width = 524
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Top = 4
Font.Style = [fsBold]
ParentFont = False
end