mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Virtual file system list file source
This commit is contained in:
parent
de84272150
commit
fab47eda45
7 changed files with 329 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
|||
object frmMain: TfrmMain
|
||||
Left = 182
|
||||
Left = 182
|
||||
Height = 659
|
||||
Top = 54
|
||||
Top = 54
|
||||
Width = 659
|
||||
ActiveControl = pnlSyncSize
|
||||
Caption = 'Double Commander'
|
||||
|
|
@ -50,7 +50,7 @@ object frmMain: TfrmMain
|
|||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 24
|
||||
Top = 24
|
||||
Width = 659
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
|
|
@ -71,7 +71,7 @@ object frmMain: TfrmMain
|
|||
TabOrder = 0
|
||||
object dskLeft: TKASToolBar
|
||||
Left = 1
|
||||
Height = 20
|
||||
Height = 20
|
||||
Top = 1
|
||||
Width = 142
|
||||
Align = alLeft
|
||||
|
|
@ -110,23 +110,23 @@ object frmMain: TfrmMain
|
|||
end
|
||||
object pnlNotebooks: TPanel
|
||||
Left = 0
|
||||
Height = 499
|
||||
Top = 50
|
||||
Height = 499
|
||||
Top = 50
|
||||
Width = 659
|
||||
Align = alClient
|
||||
ClientHeight = 499
|
||||
ClientHeight = 499
|
||||
ClientWidth = 659
|
||||
FullRepaint = False
|
||||
TabOrder = 1
|
||||
object pnlLeft: TPanel
|
||||
Left = 1
|
||||
Height = 323
|
||||
Height = 323
|
||||
Top = 1
|
||||
Width = 170
|
||||
Align = alLeft
|
||||
BorderSpacing.Right = 3
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 323
|
||||
ClientHeight = 323
|
||||
ClientWidth = 170
|
||||
TabOrder = 0
|
||||
OnDblClick = pnlLeftRightDblClick
|
||||
|
|
@ -226,13 +226,13 @@ object frmMain: TfrmMain
|
|||
end
|
||||
object pnlRight: TPanel
|
||||
Left = 174
|
||||
Height = 323
|
||||
Height = 323
|
||||
Top = 1
|
||||
Width = 484
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 3
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 323
|
||||
ClientHeight = 323
|
||||
ClientWidth = 484
|
||||
TabOrder = 1
|
||||
OnDblClick = pnlLeftRightDblClick
|
||||
|
|
@ -327,7 +327,7 @@ object frmMain: TfrmMain
|
|||
object pnlCommand: TPanel
|
||||
Left = 1
|
||||
Height = 169
|
||||
Top = 329
|
||||
Top = 329
|
||||
Width = 657
|
||||
Align = alBottom
|
||||
Anchors = [akLeft, akRight]
|
||||
|
|
@ -362,11 +362,11 @@ object frmMain: TfrmMain
|
|||
object edtCommand: TComboBox
|
||||
AnchorSideTop.Control = Panel1
|
||||
Left = 56
|
||||
Height = 21
|
||||
Height = 21
|
||||
Top = 2
|
||||
Width = 590
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ItemHeight = 13
|
||||
ItemHeight = 13
|
||||
OnEnter = edtCommandEnter
|
||||
OnExit = edtCommandExit
|
||||
OnKeyDown = edtCommandKeyDown
|
||||
|
|
@ -417,7 +417,7 @@ object frmMain: TfrmMain
|
|||
Cursor = crVSplit
|
||||
Left = 1
|
||||
Height = 5
|
||||
Top = 324
|
||||
Top = 324
|
||||
Width = 657
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
|
|
@ -1025,7 +1025,7 @@ object frmMain: TfrmMain
|
|||
Caption = '-'
|
||||
end
|
||||
object mnuOpenVFSList: TMenuItem
|
||||
Action = actOpenVFSList
|
||||
Action = actOpenVirtualFileSystemList
|
||||
OnClick = actExecute
|
||||
end
|
||||
object mnuCmdSwapSourceTarget: TMenuItem
|
||||
|
|
@ -1430,7 +1430,7 @@ object frmMain: TfrmMain
|
|||
Caption = 'Extract files...'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actOpenVFSList: TAction
|
||||
object actOpenVirtualFileSystemList: TAction
|
||||
Category = 'Commands'
|
||||
Caption = 'Open VFS List'
|
||||
OnExecute = actExecute
|
||||
|
|
@ -1894,26 +1894,26 @@ object frmMain: TfrmMain
|
|||
top = 136
|
||||
object miNewTab: TMenuItem
|
||||
Action = actNewTab
|
||||
OnClick = mnuTabMenuClick
|
||||
OnClick = mnuTabMenuClick
|
||||
end
|
||||
object miToggleLockTab: TMenuItem
|
||||
Action = actToggleLockTab
|
||||
OnClick = mnuTabMenuClick
|
||||
OnClick = mnuTabMenuClick
|
||||
end
|
||||
object miToggleLockDcaTab: TMenuItem
|
||||
Action = actToggleLockDcaTab
|
||||
OnClick = mnuTabMenuClick
|
||||
OnClick = mnuTabMenuClick
|
||||
end
|
||||
object miLine14: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miRemoveTab: TMenuItem
|
||||
Action = actRemoveTab
|
||||
OnClick = mnuTabMenuClick
|
||||
OnClick = mnuTabMenuClick
|
||||
end
|
||||
object miRemoveAllTabs: TMenuItem
|
||||
Action = actRemoveAllTabs
|
||||
OnClick = mnuTabMenuClick
|
||||
OnClick = mnuTabMenuClick
|
||||
end
|
||||
end
|
||||
object tmHAL: TTimer
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ TFRMMAIN.ACTNEWTAB.CAPTION=New tab
|
|||
TFRMMAIN.ACTREMOVETAB.CAPTION=Remove tab
|
||||
TFRMMAIN.ACTPACKFILES.CAPTION=Pack files...
|
||||
TFRMMAIN.ACTEXTRACTFILES.CAPTION=Extract files...
|
||||
TFRMMAIN.ACTOPENVFSLIST.CAPTION=Open VFS List
|
||||
TFRMMAIN.ACTOPENVIRTUALFILESYSTEMLIST.CAPTION=Open VFS List
|
||||
TFRMMAIN.ACTLEFTOPENDRIVES.CAPTION=Open left drive list
|
||||
TFRMMAIN.ACTRIGHTOPENDRIVES.CAPTION=Open right drive list
|
||||
TFRMMAIN.ACTADDPATHTOCMDLINE.CAPTION=Copy path to command line
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ type
|
|||
actTransferLeft: TAction;
|
||||
actRightOpenDrives: TAction;
|
||||
actLeftOpenDrives: TAction;
|
||||
actOpenVFSList: TAction;
|
||||
actOpenVirtualFileSystemList: TAction;
|
||||
actPackFiles: TAction;
|
||||
actRemoveTab: TAction;
|
||||
actNewTab: TAction;
|
||||
|
|
|
|||
130
src/newdesign/uvfsfile.pas
Normal file
130
src/newdesign/uvfsfile.pas
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
unit uVfsFile;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
uFile, uFileProperty;
|
||||
|
||||
type
|
||||
|
||||
TVfsFile = class(TFile)
|
||||
private
|
||||
FSize: TFileSizeProperty;
|
||||
FAttributes: TFileAttributesProperty;
|
||||
FModificationTime: TFileModificationDateTimeProperty;
|
||||
|
||||
procedure AssignProperties;
|
||||
|
||||
protected
|
||||
function GetAttributes: Cardinal; virtual;
|
||||
procedure SetAttributes(NewAttributes: Cardinal); virtual;
|
||||
function GetSize: Int64; virtual;
|
||||
procedure SetSize(NewSize: Int64); virtual;
|
||||
function GetModificationTime: TDateTime; virtual;
|
||||
procedure SetModificationTime(NewTime: TDateTime); virtual;
|
||||
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
|
||||
{en
|
||||
Creates an identical copy of the object (as far as object data is concerned).
|
||||
}
|
||||
function Clone: TVfsFile; override;
|
||||
procedure CloneTo(AFile: TFile); override;
|
||||
|
||||
class function GetSupportedProperties: TFilePropertiesTypes; override;
|
||||
|
||||
property Size: Int64 read GetSize write SetSize;
|
||||
property Attributes: Cardinal read GetAttributes write SetAttributes;
|
||||
property ModificationTime: TDateTime read GetModificationTime write SetModificationTime;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TVfsFile.Create;
|
||||
begin
|
||||
FSize := TFileSizeProperty.Create;
|
||||
FAttributes := TNtfsFileAttributesProperty.Create;
|
||||
FModificationTime := TFileModificationDateTimeProperty.Create;
|
||||
|
||||
AssignProperties;
|
||||
|
||||
// Set name after assigning Attributes property, because it is used to get extension.
|
||||
Name := '';
|
||||
end;
|
||||
|
||||
destructor TVfsFile.Destroy;
|
||||
begin
|
||||
if Assigned(FAttributes) then
|
||||
FreeAndNil(FAttributes);
|
||||
if Assigned(FSize) then
|
||||
FreeAndNil(FSize);
|
||||
if Assigned(FModificationTime) then
|
||||
FreeAndNil(FModificationTime);
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TVfsFile.Clone: TVfsFile;
|
||||
begin
|
||||
Result := TVfsFile.Create;
|
||||
CloneTo(Result);
|
||||
end;
|
||||
|
||||
procedure TVfsFile.CloneTo(AFile: TFile);
|
||||
begin
|
||||
if Assigned(AFile) then
|
||||
begin
|
||||
inherited CloneTo(AFile);
|
||||
// All properties are cloned in base class.
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVfsFile.AssignProperties;
|
||||
begin
|
||||
FProperties[fpSize] := FSize;
|
||||
FProperties[fpAttributes] := FAttributes;
|
||||
FProperties[fpModificationTime] := FModificationTime;
|
||||
end;
|
||||
|
||||
class function TVfsFile.GetSupportedProperties: TFilePropertiesTypes;
|
||||
begin
|
||||
Result := [{fpName, }fpSize, fpAttributes, fpModificationTime];
|
||||
end;
|
||||
|
||||
function TVfsFile.GetAttributes: Cardinal;
|
||||
begin
|
||||
Result := FAttributes.Value;
|
||||
end;
|
||||
|
||||
procedure TVfsFile.SetAttributes(NewAttributes: Cardinal);
|
||||
begin
|
||||
FAttributes.Value := NewAttributes;
|
||||
end;
|
||||
|
||||
function TVfsFile.GetSize: Int64;
|
||||
begin
|
||||
Result := FSize.Value;
|
||||
end;
|
||||
|
||||
procedure TVfsFile.SetSize(NewSize: Int64);
|
||||
begin
|
||||
FSize.Value := NewSize;
|
||||
end;
|
||||
|
||||
function TVfsFile.GetModificationTime: TDateTime;
|
||||
begin
|
||||
Result := FModificationTime.Value;
|
||||
end;
|
||||
|
||||
procedure TVfsFile.SetModificationTime(NewTime: TDateTime);
|
||||
begin
|
||||
FModificationTime.Value := NewTime;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
108
src/newdesign/uvfsfilesource.pas
Normal file
108
src/newdesign/uvfsfilesource.pas
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
unit uVfsFileSource;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, uWFXModule,
|
||||
uFile, uFileSourceProperty, uFileSourceOperationTypes,
|
||||
uVirtualFileSource, uFileProperty, uFileSource, uFileSourceOperation;
|
||||
|
||||
type
|
||||
|
||||
TVfsFileSource = class(TVirtualFileSource)
|
||||
private
|
||||
FWFXModuleList: TWFXModuleList;
|
||||
|
||||
protected
|
||||
class function GetSupportedFileProperties: TFilePropertiesTypes; override;
|
||||
|
||||
public
|
||||
constructor Create(aWFXModuleList: TWFXModuleList); reintroduce;
|
||||
destructor Destroy; override;
|
||||
|
||||
function Clone: TVfsFileSource; override;
|
||||
procedure CloneTo(FileSource: TFileSource); override;
|
||||
|
||||
// Retrieve operations permitted on the source. = capabilities?
|
||||
class function GetOperationsTypes: TFileSourceOperationTypes; override;
|
||||
|
||||
// Returns a list of property types supported by this source for each file.
|
||||
class function GetFilePropertiesDescriptions: TFilePropertiesDescriptions; override;
|
||||
|
||||
// Retrieve some properties of the file source.
|
||||
class function GetProperties: TFileSourceProperties; override;
|
||||
|
||||
// These functions create an operation object specific to the file source.
|
||||
// Each parameter will be owned by the operation (will be freed).
|
||||
function CreateListOperation: TFileSourceOperation; override;
|
||||
|
||||
property VfsFileList: TWFXModuleList read FWFXModuleList;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
LCLProc, uGlobs,
|
||||
uVfsListOperation;
|
||||
|
||||
constructor TVfsFileSource.Create(aWFXModuleList: TWFXModuleList);
|
||||
begin
|
||||
inherited Create;
|
||||
FWFXModuleList:= TWFXModuleList.Create;
|
||||
FWFXModuleList.Assign(aWFXModuleList);
|
||||
end;
|
||||
|
||||
destructor TVfsFileSource.Destroy;
|
||||
begin
|
||||
FreeThenNil(FWFXModuleList);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TVfsFileSource.Clone: TVfsFileSource;
|
||||
begin
|
||||
Result := TVfsFileSource.Create(FWFXModuleList);
|
||||
CloneTo(Result);
|
||||
end;
|
||||
|
||||
procedure TVfsFileSource.CloneTo(FileSource: TFileSource);
|
||||
begin
|
||||
if Assigned(FileSource) then
|
||||
begin
|
||||
inherited CloneTo(FileSource);
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TVfsFileSource.GetOperationsTypes: TFileSourceOperationTypes;
|
||||
begin
|
||||
Result := [fsoList];
|
||||
end;
|
||||
|
||||
class function TVfsFileSource.GetFilePropertiesDescriptions: TFilePropertiesDescriptions;
|
||||
begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
class function TVfsFileSource.GetProperties: TFileSourceProperties;
|
||||
begin
|
||||
Result := [fspVirtual];
|
||||
end;
|
||||
|
||||
class function TVfsFileSource.GetSupportedFileProperties: TFilePropertiesTypes;
|
||||
begin
|
||||
Result := [];
|
||||
end;
|
||||
|
||||
function TVfsFileSource.CreateListOperation: TFileSourceOperation;
|
||||
var
|
||||
TargetFileSource: TFileSource;
|
||||
begin
|
||||
TargetFileSource := Self.Clone;
|
||||
Result := TVfsListOperation.Create(TargetFileSource);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
55
src/newdesign/uvfslistoperation.pas
Normal file
55
src/newdesign/uvfslistoperation.pas
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
unit uVfsListOperation;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
uFileSourceListOperation,
|
||||
uVfsFileSource,
|
||||
uFileSource;
|
||||
|
||||
type
|
||||
|
||||
TVfsListOperation = class(TFileSourceListOperation)
|
||||
private
|
||||
FVfsFileSource: TVfsFileSource;
|
||||
public
|
||||
constructor Create(var aFileSource: TFileSource); reintroduce;
|
||||
procedure MainExecute; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
LCLProc, uOSUtils, uDCUtils, uVfsFile, uFile;
|
||||
|
||||
constructor TVfsListOperation.Create(var aFileSource: TFileSource);
|
||||
begin
|
||||
FFiles := TFiles.Create;
|
||||
FVfsFileSource := aFileSource as TVfsFileSource;
|
||||
inherited Create(aFileSource);
|
||||
end;
|
||||
|
||||
procedure TVfsListOperation.MainExecute;
|
||||
var
|
||||
I : Integer;
|
||||
aFile: TVfsFile;
|
||||
begin
|
||||
FFiles.Clear;
|
||||
FFiles.Path := IncludeTrailingPathDelimiter(FileSource.CurrentPath);
|
||||
|
||||
with FVfsFileSource do
|
||||
for I := 0 to VfsFileList.Count - 1 do
|
||||
begin
|
||||
aFile := TVfsFile.Create;
|
||||
aFile.Name:= VfsFileList.Name[I];
|
||||
aFile.Path := FileSource.CurrentPath;
|
||||
aFile.ModificationTime:= FileDateToDateTime(mbFileAge(VfsFileList.FileName[I]));
|
||||
FFiles.Add(aFile);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ const cf_Null=0;
|
|||
procedure cm_OpenArchive(param:string='');
|
||||
procedure cm_OpenDirInNewTab(param:string='');
|
||||
procedure cm_Open(param:string='');
|
||||
procedure cm_OpenVFSList(param:string='');
|
||||
procedure cm_OpenVirtualFileSystemList(param:string='');
|
||||
procedure cm_TargetEqualSource(param:string='');
|
||||
procedure cm_LeftEqualRight(param:string='');
|
||||
procedure cm_RightEqualLeft(param:string='');
|
||||
|
|
@ -252,7 +252,7 @@ uses uLng,fMain,uGlobs,uFileList,uTypes,uShowMsg,uOSForms,Controls,
|
|||
uFileSystemDeleteOperation,
|
||||
uFileSourceOperationMessageBoxesUI, uFileSourceCalcChecksumOperation,
|
||||
uFileSourceCalcStatisticsOperation, uFileSystemFile,
|
||||
uFileSource, uFileSourceProperty;
|
||||
uFileSource, uFileSourceProperty, uVfsFileSource;
|
||||
|
||||
{ TActs }
|
||||
|
||||
|
|
@ -869,11 +869,17 @@ begin
|
|||
frmMain.ActiveFrame.ExecuteCommand('cm_Open', param);
|
||||
end;
|
||||
|
||||
procedure TActs.cm_OpenVFSList(param:string);
|
||||
procedure TActs.cm_OpenVirtualFileSystemList(param:string);
|
||||
var
|
||||
FileSource: TFileSource;
|
||||
begin
|
||||
{
|
||||
FrmMain.ActiveFrame.pnlFile.LoadVFSListInPanel;
|
||||
}
|
||||
with frmMain do
|
||||
begin
|
||||
if gWFXPlugins.Count = 0 then Exit;
|
||||
FileSource:= TVfsFileSource.Create(gWFXPlugins);
|
||||
if Assigned(FileSource) then
|
||||
ActiveFrame.AddFileSource(FileSource);
|
||||
end;
|
||||
end;
|
||||
|
||||
//------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue